From 0529fdb18f42c1381cdefe7534e5b5d86ac1e673 Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 7 Jun 2022 00:38:03 -0700 Subject: [PATCH] Prep build output tests for sh_library as a Starlark rule When sh_library is implemented as a Starlark rule, the traceback includes the location of the sh_library implementation. Because this would make the test fragile, this CL adjusts tests in two different ways: 1) checking only the portion of the traceback for the pieces defined in the test. 2) implementing the test using filegroup instead of sh_library. TESTED: Ran these tests with and without a patch to exports.bzl that enables the sh_library as a Starlark rule by default. PiperOrigin-RevId: 453370399 Change-Id: Ic3ad637e170186abc4c27d2b8682d3dbaa738aff --- .../build/lib/buildtool/QueryIntegrationTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/QueryIntegrationTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/QueryIntegrationTest.java index 8eebfb10126422..58bee2ea682731 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/QueryIntegrationTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/QueryIntegrationTest.java @@ -636,7 +636,7 @@ public void ruleStackRegressionTest() throws Exception { write( "package/inc.bzl", "def g(name):", - " native.sh_library(name = name)", + " native.filegroup(name = name)", "", "def f(name):", " g(name)"); @@ -650,7 +650,7 @@ public void ruleStackRegressionTest() throws Exception { "# " + workspaceDir + "/package/BUILD:2:2\n" - + "sh_library(\n" + + "filegroup(\n" + " name = \"a\",\n" + " generator_name = \"a\",\n" + " generator_function = \"f\",\n" @@ -666,12 +666,12 @@ public void ruleStackRegressionTest() throws Exception { + "/package/inc.bzl:5:6 in f\n" + "# " + workspaceDir - + "/package/inc.bzl:2:22 in g\n" + + "/package/inc.bzl:2:21 in g\n" + "\n" + "# " + workspaceDir + "/package/BUILD:3:2\n" - + "sh_library(\n" + + "filegroup(\n" + " name = \"b\",\n" + " generator_name = \"b\",\n" + " generator_function = \"f\",\n" @@ -687,7 +687,7 @@ public void ruleStackRegressionTest() throws Exception { + "/package/inc.bzl:5:6 in f\n" + "# " + workspaceDir - + "/package/inc.bzl:2:22 in g\n\n"; + + "/package/inc.bzl:2:21 in g\n\n"; String out = new String(result.getStdout(), UTF_8); assertThat(out).isEqualTo(expectedOut);