Skip to content

Commit

Permalink
Miscellaneous fixes to tests to avoid using --test_arg as no-op, etc.
Browse files Browse the repository at this point in the history
Instead of using --test_arg as a no-op configuration setting, use a garbage cpu value (since not building anyway), define and define_values, or just change the associated targets to test targets (to avoid any trimming for when --trim_test_configuration is on).

These are not BuildViewTestCase so introducing the DummyTestFragment is non-trivial hence the use of 'different' 'no-op' configuration flags.

PiperOrigin-RevId: 366139254
  • Loading branch information
twigg authored and copybara-github committed Mar 31, 2021
1 parent b7308f8 commit 551fabd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public void testFileVisibilityError() throws Exception {

@Test
public void testVisibilityErrorNoKeepGoing() throws Exception {
scratch.file("foo/BUILD", "sh_library(name = 'foo', deps = ['//bar'])");
scratch.file("foo/BUILD", "sh_test(name = 'foo', srcs = ['test.sh'], deps = ['//bar'])");
scratch.file("bar/BUILD", "sh_library(name = 'bar', visibility = ['//visibility:private'])");

try {
Expand All @@ -222,7 +222,7 @@ public void testVisibilityErrorNoKeepGoing() throws Exception {
.getBuildConfigurationCollection()
.getTargetConfigurations());
String message =
"in sh_library rule //foo:foo: target '//bar:bar' is not visible from"
"in sh_test rule //foo:foo: target '//bar:bar' is not visible from"
+ " target '//foo:foo'. Check the visibility declaration of the"
+ " former target if you think the dependency is legitimate";
assertThat(collector.events.get(topLevel))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ public void testPostProcessedConfigurableAttributes() throws Exception {
reporter.removeHandler(failFastHandler); // Expect errors from action conflicts.
scratch.file(
"conflict/BUILD",
"config_setting(name = 'a', values = {'test_arg': 'a'})",
"config_setting(name = 'a', values = {'cpu': 'unobtainiumx'})",
"cc_library(name='x', srcs=select({':a': ['a.cc'], '//conditions:default': ['foo.cc']}))",
"cc_binary(name='_objs/x/foo.o', srcs=['bar.cc'])");
AnalysisResult result =
Expand Down

0 comments on commit 551fabd

Please sign in to comment.