Add TestContext parameter to ContentFromFileRuleForTests
The next CL will need a TestContext parameter in
ContentFromFileRuleForTests in order to retrieve the file rule contents
from the Config. Add it and update all the tests that use it in order
to simply review of the next CL.
Bug: 306029038
Test: go test ./...
Change-Id: Ia4b4c9854017ea3472fa2f8ba42cf7f72720496e
diff --git a/android/defs.go b/android/defs.go
index b28d2fa..03968c1 100644
--- a/android/defs.go
+++ b/android/defs.go
@@ -232,7 +232,7 @@
// ContentFromFileRuleForTests returns the content that was passed to a WriteFileRule for use
// in tests.
-func ContentFromFileRuleForTests(t *testing.T, params TestingBuildParams) string {
+func ContentFromFileRuleForTests(t *testing.T, ctx *TestContext, params TestingBuildParams) string {
t.Helper()
if g, w := params.Rule, writeFile; g != w {
t.Errorf("expected params.Rule to be %q, was %q", w, g)
diff --git a/android/rule_builder.go b/android/rule_builder.go
index 5c6dffe..1a491f7 100644
--- a/android/rule_builder.go
+++ b/android/rule_builder.go
@@ -1341,9 +1341,9 @@
// RuleBuilderSboxProtoForTests takes the BuildParams for the manifest passed to RuleBuilder.Sbox()
// and returns sbox testproto generated by the RuleBuilder.
-func RuleBuilderSboxProtoForTests(t *testing.T, params TestingBuildParams) *sbox_proto.Manifest {
+func RuleBuilderSboxProtoForTests(t *testing.T, ctx *TestContext, params TestingBuildParams) *sbox_proto.Manifest {
t.Helper()
- content := ContentFromFileRuleForTests(t, params)
+ content := ContentFromFileRuleForTests(t, ctx, params)
manifest := sbox_proto.Manifest{}
err := prototext.Unmarshal([]byte(content), &manifest)
if err != nil {
diff --git a/android/rule_builder_test.go b/android/rule_builder_test.go
index a6b3a27..63c3527 100644
--- a/android/rule_builder_test.go
+++ b/android/rule_builder_test.go
@@ -683,7 +683,7 @@
t.Errorf("want Deps = %q, got %q", blueprint.DepsGCC, params.Deps)
}
- rspFile2Content := ContentFromFileRuleForTests(t, rspFile2Params)
+ rspFile2Content := ContentFromFileRuleForTests(t, result.TestContext, rspFile2Params)
AssertStringEquals(t, "rspFile2 content", "rsp_in2\n", rspFile2Content)
}
@@ -797,7 +797,7 @@
t.Run(test.name, func(t *testing.T) {
t.Run("sbox", func(t *testing.T) {
gen := result.ModuleForTests(test.name+"_sbox", "")
- manifest := RuleBuilderSboxProtoForTests(t, gen.Output("sbox.textproto"))
+ manifest := RuleBuilderSboxProtoForTests(t, result.TestContext, gen.Output("sbox.textproto"))
hash := manifest.Commands[0].GetInputHash()
AssertStringEquals(t, "hash", test.expectedHash, hash)
diff --git a/apex/apex_test.go b/apex/apex_test.go
index ddb9a40..479bf1a 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -595,13 +595,15 @@
t.Errorf("Could not find all expected symlinks! foo: %t, foo_link_64: %t. Command was %s", found_foo, found_foo_link_64, copyCmds)
}
- fullDepsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex").Output("depsinfo/fulllist.txt").Args["content"], "\\n")
+ fullDepsInfo := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
+ ctx.ModuleForTests("myapex", "android_common_myapex").Output("depsinfo/fulllist.txt")), "\n")
ensureListContains(t, fullDepsInfo, " myjar(minSdkVersion:(no version)) <- myapex")
ensureListContains(t, fullDepsInfo, " mylib2(minSdkVersion:(no version)) <- mylib")
ensureListContains(t, fullDepsInfo, " myotherjar(minSdkVersion:(no version)) <- myjar")
ensureListContains(t, fullDepsInfo, " mysharedjar(minSdkVersion:(no version)) (external) <- myjar")
- flatDepsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex").Output("depsinfo/flatlist.txt").Args["content"], "\\n")
+ flatDepsInfo := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
+ ctx.ModuleForTests("myapex", "android_common_myapex").Output("depsinfo/flatlist.txt")), "\n")
ensureListContains(t, flatDepsInfo, "myjar(minSdkVersion:(no version))")
ensureListContains(t, flatDepsInfo, "mylib2(minSdkVersion:(no version))")
ensureListContains(t, flatDepsInfo, "myotherjar(minSdkVersion:(no version))")
@@ -1281,10 +1283,12 @@
// Ensure that libfoo stubs is not linking to libbar (since it is a stubs)
ensureNotContains(t, libFooStubsLdFlags, "libbar.so")
- fullDepsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2").Output("depsinfo/fulllist.txt").Args["content"], "\\n")
+ fullDepsInfo := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
+ ctx.ModuleForTests("myapex2", "android_common_myapex2").Output("depsinfo/fulllist.txt")), "\n")
ensureListContains(t, fullDepsInfo, " libfoo(minSdkVersion:(no version)) (external) <- mylib")
- flatDepsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2").Output("depsinfo/flatlist.txt").Args["content"], "\\n")
+ flatDepsInfo := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
+ ctx.ModuleForTests("myapex2", "android_common_myapex2").Output("depsinfo/flatlist.txt")), "\n")
ensureListContains(t, flatDepsInfo, "libfoo(minSdkVersion:(no version)) (external)")
}
@@ -2030,7 +2034,8 @@
"out/soong/.intermediates/myapex2/android_common_myapex2/depsinfo/flatlist.txt")
myapex := ctx.ModuleForTests("myapex", "android_common_myapex")
- flatlist := strings.Split(myapex.Output("depsinfo/flatlist.txt").BuildParams.Args["content"], "\\n")
+ flatlist := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
+ myapex.Output("depsinfo/flatlist.txt")), "\n")
android.AssertStringListContains(t, "deps with stubs should be tracked in depsinfo as external dep",
flatlist, "libbar(minSdkVersion:(no version)) (external)")
android.AssertStringListDoesNotContain(t, "do not track if not available for platform",
@@ -8154,7 +8159,7 @@
`, withManifestPackageNameOverrides([]string{"AppFoo:com.android.foo"}))
bundleConfigRule := ctx.ModuleForTests("myapex", "android_common_myapex").Output("bundle_config.json")
- content := bundleConfigRule.Args["content"]
+ content := android.ContentFromFileRuleForTests(t, ctx, bundleConfigRule)
ensureContains(t, content, `"compression":{"uncompressed_glob":["apex_payload.img","apex_manifest.*"]}`)
ensureContains(t, content, `"apex_config":{"apex_embedded_apk_config":[{"package_name":"com.android.foo","path":"app/AppFoo@TEST.BUILD_ID/AppFoo.apk"}]}`)
@@ -8181,7 +8186,7 @@
}`)
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
bundleConfigRule := mod.Output("bundle_config.json")
- content := bundleConfigRule.Args["content"]
+ content := android.ContentFromFileRuleForTests(t, ctx, bundleConfigRule)
ensureContains(t, content, `"compression":{"uncompressed_glob":["apex_payload.img","apex_manifest.*"]}`)
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
@@ -9126,7 +9131,7 @@
`)
myapex := ctx.ModuleForTests("myapex", "android_common_myapex")
- content := myapex.Output("apexkeys.txt").BuildParams.Args["content"]
+ content := android.ContentFromFileRuleForTests(t, ctx, myapex.Output("apexkeys.txt"))
ensureContains(t, content, `name="myapex.apex" public_key="vendor/foo/devkeys/testkey.avbpubkey" private_key="vendor/foo/devkeys/testkey.pem" container_certificate="vendor/foo/devkeys/test.x509.pem" container_private_key="vendor/foo/devkeys/test.pk8" partition="system" sign_tool="sign_myapex"`)
}
@@ -9166,9 +9171,11 @@
}
`)
- content := ctx.ModuleForTests("myapex", "android_common_myapex").Output("apexkeys.txt").BuildParams.Args["content"]
+ content := android.ContentFromFileRuleForTests(t, ctx,
+ ctx.ModuleForTests("myapex", "android_common_myapex").Output("apexkeys.txt"))
ensureContains(t, content, `name="myapex.apex" public_key="vendor/foo/devkeys/testkey.avbpubkey" private_key="vendor/foo/devkeys/testkey.pem" container_certificate="vendor/foo/devkeys/test.x509.pem" container_private_key="vendor/foo/devkeys/test.pk8" partition="system" sign_tool="sign_myapex"`)
- content = ctx.ModuleForTests("myapex_set", "android_common_myapex_set").Output("apexkeys.txt").BuildParams.Args["content"]
+ content = android.ContentFromFileRuleForTests(t, ctx,
+ ctx.ModuleForTests("myapex_set", "android_common_myapex_set").Output("apexkeys.txt"))
ensureContains(t, content, `name="myapex_set.apex" public_key="PRESIGNED" private_key="PRESIGNED" container_certificate="PRESIGNED" container_private_key="PRESIGNED" partition="system"`)
}
diff --git a/cc/cc_test.go b/cc/cc_test.go
index e2dba90..6e71f5e 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -341,9 +341,9 @@
}
}
-func checkWriteFileOutput(t *testing.T, params android.TestingBuildParams, expected []string) {
+func checkWriteFileOutput(t *testing.T, ctx *android.TestContext, params android.TestingBuildParams, expected []string) {
t.Helper()
- content := android.ContentFromFileRuleForTests(t, params)
+ content := android.ContentFromFileRuleForTests(t, ctx, params)
actual := strings.FieldsFunc(content, func(r rune) bool { return r == '\n' })
assertArrayString(t, actual, expected)
}
@@ -351,7 +351,7 @@
func checkVndkOutput(t *testing.T, ctx *android.TestContext, output string, expected []string) {
t.Helper()
vndkSnapshot := ctx.SingletonForTests("vndk-snapshot")
- checkWriteFileOutput(t, vndkSnapshot.Output(output), expected)
+ checkWriteFileOutput(t, ctx, vndkSnapshot.Output(output), expected)
}
func checkVndkLibrariesOutput(t *testing.T, ctx *android.TestContext, module string, expected []string) {
@@ -4302,7 +4302,7 @@
libfoo.Rule("aidl_library").Implicits,
)
- manifest := android.RuleBuilderSboxProtoForTests(t, libfoo.Output("aidl_library.sbox.textproto"))
+ manifest := android.RuleBuilderSboxProtoForTests(t, ctx, libfoo.Output("aidl_library.sbox.textproto"))
aidlCommand := manifest.Commands[0].GetCommand()
expectedAidlFlags := "-Ipackage_foo/a -Ipackage_bar/x"
@@ -4337,7 +4337,7 @@
`)
libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_static")
- manifest := android.RuleBuilderSboxProtoForTests(t, libfoo.Output("aidl.sbox.textproto"))
+ manifest := android.RuleBuilderSboxProtoForTests(t, ctx.TestContext, libfoo.Output("aidl.sbox.textproto"))
aidlCommand := manifest.Commands[0].GetCommand()
expectedAidlFlag := "-Werror"
if !strings.Contains(aidlCommand, expectedAidlFlag) {
@@ -4388,7 +4388,7 @@
}
`)
libfoo := ctx.ModuleForTests("libfoo", tc.variant)
- manifest := android.RuleBuilderSboxProtoForTests(t, libfoo.Output("aidl.sbox.textproto"))
+ manifest := android.RuleBuilderSboxProtoForTests(t, ctx, libfoo.Output("aidl.sbox.textproto"))
aidlCommand := manifest.Commands[0].GetCommand()
expectedAidlFlag := "--min_sdk_version=" + tc.expected
if !strings.Contains(aidlCommand, expectedAidlFlag) {
diff --git a/cc/gen_test.go b/cc/gen_test.go
index 85df333..439f0a9 100644
--- a/cc/gen_test.go
+++ b/cc/gen_test.go
@@ -67,7 +67,7 @@
t.Errorf("missing aidl includes in global flags")
}
- aidlCommand := android.RuleBuilderSboxProtoForTests(t, aidlManifest).Commands[0].GetCommand()
+ aidlCommand := android.RuleBuilderSboxProtoForTests(t, ctx, aidlManifest).Commands[0].GetCommand()
if !strings.Contains(aidlCommand, "-Isub") {
t.Errorf("aidl command for c.aidl should contain \"-Isub\", but was %q", aidlCommand)
}
diff --git a/cc/genrule_test.go b/cc/genrule_test.go
index 0d16e62..9295244 100644
--- a/cc/genrule_test.go
+++ b/cc/genrule_test.go
@@ -178,7 +178,7 @@
android.OptionalFixturePreparer(tt.preparer),
).RunTestWithBp(t, bp)
gen := result.ModuleForTests("gen", tt.variant)
- sboxProto := android.RuleBuilderSboxProtoForTests(t, gen.Output("genrule.sbox.textproto"))
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, result.TestContext, gen.Output("genrule.sbox.textproto"))
cmd := *sboxProto.Commands[0].Command
android.AssertStringDoesContain(t, "incorrect CC_ARCH", cmd, "CC_ARCH="+tt.arch+" ")
android.AssertStringDoesContain(t, "incorrect CC_NATIVE_BRIDGE", cmd, "CC_NATIVE_BRIDGE="+tt.nativeBridge+" ")
diff --git a/cc/testing.go b/cc/testing.go
index 71d986b..b1583f1 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -797,7 +797,7 @@
func checkOverrides(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, jsonPath string, expected []string) {
t.Helper()
out := singleton.MaybeOutput(jsonPath)
- content := android.ContentFromFileRuleForTests(t, out)
+ content := android.ContentFromFileRuleForTests(t, ctx, out)
var flags snapshotJsonFlags
if err := json.Unmarshal([]byte(content), &flags); err != nil {
diff --git a/cc/vendor_snapshot_test.go b/cc/vendor_snapshot_test.go
index c5431b3..890a533 100644
--- a/cc/vendor_snapshot_test.go
+++ b/cc/vendor_snapshot_test.go
@@ -23,13 +23,14 @@
"testing"
)
-func checkJsonContents(t *testing.T, ctx android.TestingSingleton, jsonPath string, key string, value string) {
- jsonOut := ctx.MaybeOutput(jsonPath)
+func checkJsonContents(t *testing.T, ctx *android.TestContext, snapshotSingleton android.TestingSingleton, jsonPath string, key string, value string) {
+ jsonOut := snapshotSingleton.MaybeOutput(jsonPath)
if jsonOut.Rule == nil {
t.Errorf("%q expected but not found", jsonPath)
return
}
- if !strings.Contains(jsonOut.Args["content"], fmt.Sprintf("%q:%q", key, value)) {
+ content := android.ContentFromFileRuleForTests(t, ctx, jsonOut)
+ if !strings.Contains(content, fmt.Sprintf("%q:%q", key, value)) {
t.Errorf("%q must include %q:%q but it only has %v", jsonPath, key, value, jsonOut.Args["content"])
}
}
@@ -167,8 +168,8 @@
filepath.Join(staticDir, "libvendor_available.a.json"),
filepath.Join(staticDir, "libvendor_available.cfi.a.json"))
- checkJsonContents(t, snapshotSingleton, filepath.Join(staticDir, "libb.a.json"), "MinSdkVersion", "apex_inherit")
- checkJsonContents(t, snapshotSingleton, filepath.Join(staticDir, "libvendor_available.a.json"), "MinSdkVersion", "29")
+ checkJsonContents(t, ctx, snapshotSingleton, filepath.Join(staticDir, "libb.a.json"), "MinSdkVersion", "apex_inherit")
+ checkJsonContents(t, ctx, snapshotSingleton, filepath.Join(staticDir, "libvendor_available.a.json"), "MinSdkVersion", "29")
// For binary executables, all vendor:true and vendor_available modules are captured.
if archType == "arm64" {
diff --git a/genrule/genrule_test.go b/genrule/genrule_test.go
index 7c14531..4cff4b8 100644
--- a/genrule/genrule_test.go
+++ b/genrule/genrule_test.go
@@ -543,7 +543,7 @@
for _, test := range testcases {
t.Run(test.name, func(t *testing.T) {
gen := result.ModuleForTests(test.name, "")
- manifest := android.RuleBuilderSboxProtoForTests(t, gen.Output("genrule.sbox.textproto"))
+ manifest := android.RuleBuilderSboxProtoForTests(t, result.TestContext, gen.Output("genrule.sbox.textproto"))
hash := manifest.Commands[0].GetInputHash()
android.AssertStringEquals(t, "hash", test.expectedHash, hash)
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index f86e1ac..7b89dde 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -84,7 +84,7 @@
for _, c := range testcases {
m := ctx.ModuleForTests(c.moduleName, "android_common")
manifest := m.Output("metalava.sbox.textproto")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, manifest)
cmdline := String(sboxProto.Commands[0].Command)
android.AssertStringContainsEquals(t, "api-versions generation flag", cmdline, "--generate-api-levels", c.generate_xml)
if c.expectedJarFilename != "" {
@@ -133,7 +133,7 @@
m := ctx.ModuleForTests("foo-stubs", "android_common")
manifest := m.Output("metalava.sbox.textproto")
- cmd := String(android.RuleBuilderSboxProtoForTests(t, manifest).Commands[0].Command)
+ cmd := String(android.RuleBuilderSboxProtoForTests(t, ctx, manifest).Commands[0].Command)
r := regexp.MustCompile(`--android-jar-pattern [^ ]+/android.jar`)
return r.FindAllString(cmd, -1)
}
@@ -212,7 +212,7 @@
t.Errorf("Expected inputs %q, got %q", w, g)
}
- manifest := android.RuleBuilderSboxProtoForTests(t, m.Output("metalava.sbox.textproto"))
+ manifest := android.RuleBuilderSboxProtoForTests(t, ctx, m.Output("metalava.sbox.textproto"))
if g, w := manifest.Commands[0].GetCommand(), "reference __SBOX_SANDBOX_DIR__/out/.intermediates/foo/gen/foo.txt"; !strings.Contains(g, w) {
t.Errorf("Expected command to contain %q, got %q", w, g)
}
@@ -302,7 +302,7 @@
})
m := ctx.ModuleForTests("baz-stubs", "android_common")
manifest := m.Output("metalava.sbox.textproto")
- cmdline := String(android.RuleBuilderSboxProtoForTests(t, manifest).Commands[0].Command)
+ cmdline := String(android.RuleBuilderSboxProtoForTests(t, ctx, manifest).Commands[0].Command)
android.AssertStringDoesContain(t, "sdk-extensions-root present", cmdline, "--sdk-extensions-root sdk/extensions")
android.AssertStringDoesContain(t, "sdk-extensions-info present", cmdline, "--sdk-extensions-info sdk/extensions/info.txt")
}
@@ -434,6 +434,6 @@
m := result.ModuleForTests("foo", "android_common")
manifest := m.Output("metalava.sbox.textproto")
- cmdline := String(android.RuleBuilderSboxProtoForTests(t, manifest).Commands[0].Command)
+ cmdline := String(android.RuleBuilderSboxProtoForTests(t, result.TestContext, manifest).Commands[0].Command)
android.AssertStringDoesContain(t, "flagged api hide command not included", cmdline, "--hide-annotation android.annotation.FlaggedApi")
}
diff --git a/java/java_test.go b/java/java_test.go
index 81119a7..0c750eb 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -1921,7 +1921,7 @@
for _, c := range testcases {
m := ctx.ModuleForTests(c.moduleName, "android_common")
manifest := m.Output("metalava.sbox.textproto")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx.TestContext, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
sourceFilesFlag := "--source-files " + strings.Join(c.sourceTextFileDirs, " ")
android.AssertStringDoesContain(t, "source text files not present", manifestCommand, sourceFilesFlag)
@@ -2026,7 +2026,7 @@
for _, c := range testcases {
m := ctx.ModuleForTests(c.moduleName, "android_common")
manifest := m.Output("metalava.sbox.textproto")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx.TestContext, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
sourceFilesFlag := "--source-files " + strings.Join(c.sourceTextFileDirs, " ")
android.AssertStringDoesContain(t, "source text files not present", manifestCommand, sourceFilesFlag)
@@ -2316,7 +2316,7 @@
m := ctx.ModuleForTests("bar1", "android_common")
manifest := m.Output("metalava.sbox.textproto")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx.TestContext, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
android.AssertStringDoesContain(t, "Command expected to contain full_api_surface_stub output jar", manifestCommand, "lib1.jar")
}
@@ -2480,7 +2480,7 @@
`)
m := ctx.ModuleForTests("foo", "android_common")
manifest := m.Output("metalava.sbox.textproto")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx.TestContext, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
sourceFilesFlag := "--source-files current.txt"
android.AssertStringDoesContain(t, "source text files not present", manifestCommand, sourceFilesFlag)
@@ -2501,7 +2501,7 @@
`)
m := ctx.ModuleForTests("foo", "android_common")
manifest := m.Output("metalava.sbox.textproto")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
// Api files are sorted from the narrowest api scope to the widest api scope.
@@ -2543,7 +2543,7 @@
`)
m := result.ModuleForTests(apiScopePublic.apiLibraryModuleName("foo"), "android_common")
manifest := m.Output("metalava.sbox.textproto")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, result.TestContext, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
classPathFlag := "--classpath __SBOX_SANDBOX_DIR__/out/.intermediates/bar/android_common/turbine-combined/bar.jar"
android.AssertStringDoesContain(t, "command expected to contain classpath flag", manifestCommand, classPathFlag)
diff --git a/java/lint_test.go b/java/lint_test.go
index ec901aa..5e6b8bc 100644
--- a/java/lint_test.go
+++ b/java/lint_test.go
@@ -39,7 +39,7 @@
foo := ctx.ModuleForTests("foo", "android_common")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.Output("lint.sbox.textproto"))
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, foo.Output("lint.sbox.textproto"))
if !strings.Contains(*sboxProto.Commands[0].Command, "--baseline lint-baseline.xml") {
t.Error("did not pass --baseline flag")
}
@@ -61,7 +61,7 @@
foo := ctx.ModuleForTests("foo", "android_common")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.Output("lint.sbox.textproto"))
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, foo.Output("lint.sbox.textproto"))
if strings.Contains(*sboxProto.Commands[0].Command, "--baseline") {
t.Error("passed --baseline flag for non existent file")
}
@@ -108,7 +108,7 @@
foo := ctx.ModuleForTests("foo", "android_common")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.Output("lint.sbox.textproto"))
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, foo.Output("lint.sbox.textproto"))
if !strings.Contains(*sboxProto.Commands[0].Command, "--baseline mybaseline.xml") {
t.Error("did not use the correct file for baseline")
}
@@ -276,7 +276,7 @@
RunTestWithBp(t, thisBp)
foo := result.ModuleForTests("foo", "android_common")
- sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.Output("lint.sbox.textproto"))
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, result.TestContext, foo.Output("lint.sbox.textproto"))
if !strings.Contains(*sboxProto.Commands[0].Command, "/"+testCase.expected_file) {
t.Error("did not use full api database for case", testCase)
}