Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

//src/test/java/com/google/devtools/build/lib/rules/cpp:cpp-rules-tests not running on Windows #4127

Closed
meteorcloudy opened this issue Nov 20, 2017 · 13 comments
Assignees
Labels
category: misc > testing P1 I'll work on this now. (Assignee required) platform: windows

Comments

@meteorcloudy
Copy link
Member

I just noticed cpp-rules-tests is not running on Windows for a while.
I believe we missed many Windows breakage due to this.

I believe this is due to our change for Windows tests configuration?
See

name = "all_windows_tests",

@laszlocsomor Any specific reason we are not running this test?

@meteorcloudy meteorcloudy added category: misc > testing platform: windows P1 I'll work on this now. (Assignee required) labels Nov 20, 2017
@laszlocsomor
Copy link
Contributor

laszlocsomor commented Nov 20, 2017

I remember checking that //:all_windows_tests contained the same tests as the query used to in bazel-tests.json.

Indeed, commit 3f2f480 moved //src/test/java/com/google/devtools/build/lib:cpp-rules-tests to //src/test/java/com/google/devtools/build/lib/rules/cpp:cpp-rules-tests about 2 weeks ago, and I suppose @c-parsons didn't know he had to update the all_windows_tests rules.

Yun, do you have any idea how we could prevent such inadvertent test suite changes in the future?

@meteorcloudy
Copy link
Member Author

meteorcloudy commented Nov 20, 2017

I see, thanks for looking into it.
Did we refer cpp-rules-tests explicitly?
Because if we did, moving it should cause an error, right?

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Nov 20, 2017

Did we refer cpp-rules-tests explicitly?
Because if we did, moving it should cause an error, right?

We didn't. It was matched by the test_suite in its old package:

test_suite(
name = "windows_tests",
tags = [
"-no_windows",
"-slow",
],
visibility = ["//visibility:private"],
)

@meteorcloudy
Copy link
Member Author

I see, explicitly refer every test is not feasible. But can test_suite also match tests under its subpackage?

@meteorcloudy
Copy link
Member Author

Or we have to use genquery to check the tests lists match every time..

@laszlocsomor
Copy link
Contributor

No, test_suite cannot match tests in subpackages.
I'm not aware of any better solution than using genquery and comparing its output to a golden file.

@meteorcloudy
Copy link
Member Author

meteorcloudy commented Nov 20, 2017

Or comparing its output to another genquery? Something like:
//src/test/java/... //src/test/cpp/... //src/test/py/... --tag=-no_windows

So that we don't have to modify the test list every time it changes.

@laszlocsomor
Copy link
Contributor

Sure, if genquery supports "..." targets then let's do that.

@meteorcloudy
Copy link
Member Author

Yes, it does.

pcloudy@pcloudy0-w MSYS ~/workspace/bazel
$ bazel-0.7.0 query 'tests(//src/test/py/...)'
...........
//src/test/py/bazel:launcher_test
//src/test/py/bazel:bazel_windows_test
//src/test/py/bazel:bazel_windows_cpp_test
//src/test/py/bazel:bazel_server_mode_test
//src/test/py/bazel:bazel_external_repository_test
//src/test/py/bazel:bazel_clean_test
//src/test/py/bazel:action_temp_test

@laszlocsomor
Copy link
Contributor

"bazel query" and "genquery" are slightly different:

The only difference between the queries allowed here and on the command line is that queries containing wildcard target specifications (e.g. //pkg:* or //pkg:all) are not allowed here. The reasons for this are two-fold: first, because genquery has to specify a scope to prevent targets outside the transitive closure of the query to influence its output; and, second, because BUILD files do not support wildcard dependencies (e.g. deps=["//a/..."] is not allowed).

(source: https://docs.bazel.build/versions/master/be/general.html#genquery)

And unfortunately in this case they are different.

Query:

d:\os\bazel>bazel query "kind(filegroup, '//foo/...')"
//foo/bar:srcs
//foo:srcs

Genquery:

d:\os\bazel>bazel query --output=build //foo:q
# D:/os/bazel/foo/BUILD:7:1
genquery(
  name = "q",
  scope = ["//foo:__subpackages__"],
  expression = "kind(filegroup, '//foo/...')",
)


d:\os\bazel>bazel build //foo:q
ERROR: D:/os/bazel/foo/BUILD:7:1: in genquery rule //foo:q: query failed: recursive target patterns are not permitted: '//foo/...''.
ERROR: Analysis of target '//foo:q' failed; build aborted: Analysis of target '//foo:q' failed; build aborted.
INFO: Elapsed time: 0.435s

@meteorcloudy
Copy link
Member Author

;( Looks like the golden test list is the only way ...

@laszlocsomor
Copy link
Contributor

This bug is superseded by #4292. Dropping to P2 to match that bug's current priority.

@laszlocsomor laszlocsomor added P2 We'll consider working on this in future. (Assignee optional) windows-q1-2018-maybe and removed P1 I'll work on this now. (Assignee required) labels Dec 13, 2017
@laszlocsomor
Copy link
Contributor

aaand raising to P1 to match #4292 's new priority.

@laszlocsomor laszlocsomor added P1 I'll work on this now. (Assignee required) and removed P2 We'll consider working on this in future. (Assignee optional) labels Dec 18, 2017
@laszlocsomor laszlocsomor self-assigned this Dec 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: misc > testing P1 I'll work on this now. (Assignee required) platform: windows
Projects
None yet
Development

No branches or pull requests

2 participants