-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Default --instrumentation_filter
when 2 targets share a prefix is incorrect
#10949
Comments
sure can! |
@lberki I would like to fix this issue, taking the open PR that @caiyulun created. In the PR @caiyulun mentioned 4 months ago that was working on tests but I assume that something prevented to continue on the topic. However I have some question about the code base, would it be here, in the PR, or in bazel-dev the place to ask? For the moment I will put it here in case you can answer right a way and if not I can move it to some other channel. What is missing in the PR is a test case but I wanted to derive from Here my question: Can the new test derive from Bonus: I was also thinking if indeed |
The internal Since we have internal tests, I would not worry too much about where you implement your test case, since we don't need to pull in the test class itself and can instead, transfer the cases you write into the existing test class. With a little bit of inlining, the existing tests look kind of like this: @Test
private void testFoo() throws Exception {
EventCollector events = new EventCollector(EventKind.INFO);
scratch.file("foo/BUILD", "sh_test(name='t', srcs=['t.sh']")
Collection<Target> targets = Collections.singletonList(getTarget("//foo:t");
String expectedFilter = "^//foo[/:]";
assertThat(InstrumentationFilterSupport.computeInstrumentationFilter(events, targets))
.isEqualTo(expectedFilter);
} (Caveat, I might have got the expectedFilter wrong, I haven't checked it). It's not ideal, and it would be much nicer if we could get the test code open sourced, but I don't know where we are with that effort at the moment. |
In case that two path share a prefix, the instrumentation filter is not computed proper. bazelbuild#10949 This PR takes as a base the one that was created by @caiyulun and adds some tests. Original PR: bazelbuild#10949
Does that PR fix this one? If so I can close this |
Yes, and I would also recommend to close #11690 |
In case that two path share a prefix, the instrumentation filter is not computed proper. bazelbuild#10949 This PR takes as a base the one that was created by @caiyulun and adds some tests. Original PR: bazelbuild#10949 Closes bazelbuild#12607. PiperOrigin-RevId: 346097533
The instrumentation_filter flag appears to to have a few different default cases:
//Modules/ResourceSupport:ResourceSupportTests
it will default to//Modules/ResourceSupport[/:]
//Modules/ResourceSupport:ResourceSupportTests
and//Modules/LyftKit:LyftKitTests
it will default to their commonprefix:
//Modules[/:]
//Modules/TransitNearby:TransitNearbyTests
and//Modules/TransitNearbyFlow:TransitNearbyFlowTests
where they havea common prefix, it defaults to
//Modules/TransitNearby[/:]
whichends up excluding the
TransitNearbyFlow
files from the coverage manifest.Am I correct in thinking that this is a bug and in that case it should either be
//Modules[/:]
or//Modules/TransitNearby
without the[/:]
What operating system are you running Bazel on?
macOS
What's the output of
bazel info release
?release 2.2.0
The text was updated successfully, but these errors were encountered: