Merge "Add TestContext parameter to ContentFromFileRuleForTests" into main

This commit is contained in:
Colin Cross
2023-12-05 00:29:10 +00:00
committed by Gerrit Code Review
13 changed files with 53 additions and 45 deletions

View File

@@ -341,9 +341,9 @@ func checkVndkModule(t *testing.T, ctx *android.TestContext, name, subDir string
}
}
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 checkWriteFileOutput(t *testing.T, params android.TestingBuildParams, expec
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 @@ func TestAidlLibraryWithHeaders(t *testing.T) {
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 @@ func TestAidlFlagsPassedToTheAidlCompiler(t *testing.T) {
`)
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 @@ func TestAidlFlagsWithMinSdkVersion(t *testing.T) {
}
`)
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) {