Merge "Remove extraneous calls to TestingBuildParams.RelativeToTop()" am: dff50dffbc
am: c9ec211cca
am: 31638bfb46
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1655209 Change-Id: I8cac59260ab0d3f5c4ffe4cb6629c76105cf50ca
This commit is contained in:
commit
49e0d8b637
|
@ -645,7 +645,7 @@ func TestRuleBuilder_Build(t *testing.T) {
|
|||
rspFile := "out/soong/.intermediates/foo/rsp"
|
||||
rspFile2 := "out/soong/.intermediates/foo/rsp2"
|
||||
module := result.ModuleForTests("foo", "")
|
||||
check(t, module.Rule("rule").RelativeToTop(), module.Output(rspFile2).RelativeToTop(),
|
||||
check(t, module.Rule("rule"), module.Output(rspFile2),
|
||||
"cp bar "+outFile+" @"+rspFile+" @"+rspFile2,
|
||||
outFile, outFile+".d", rspFile, rspFile2, true, nil, nil)
|
||||
})
|
||||
|
@ -662,7 +662,7 @@ func TestRuleBuilder_Build(t *testing.T) {
|
|||
cmd := `rm -rf ` + outDir + `/gen && ` +
|
||||
sbox + ` --sandbox-path ` + sandboxPath + ` --manifest ` + manifest
|
||||
module := result.ModuleForTests("foo_sbox", "")
|
||||
check(t, module.Output("gen/foo_sbox").RelativeToTop(), module.Output(rspFile2).RelativeToTop(),
|
||||
check(t, module.Output("gen/foo_sbox"), module.Output(rspFile2),
|
||||
cmd, outFile, depFile, rspFile, rspFile2, false, []string{manifest}, []string{sbox})
|
||||
})
|
||||
t.Run("sbox_inputs", func(t *testing.T) {
|
||||
|
@ -679,7 +679,7 @@ func TestRuleBuilder_Build(t *testing.T) {
|
|||
sbox + ` --sandbox-path ` + sandboxPath + ` --manifest ` + manifest
|
||||
|
||||
module := result.ModuleForTests("foo_sbox_inputs", "")
|
||||
check(t, module.Output("gen/foo_sbox_inputs").RelativeToTop(), module.Output(rspFile2).RelativeToTop(),
|
||||
check(t, module.Output("gen/foo_sbox_inputs"), module.Output(rspFile2),
|
||||
cmd, outFile, depFile, rspFile, rspFile2, false, []string{manifest}, []string{sbox})
|
||||
})
|
||||
t.Run("singleton", func(t *testing.T) {
|
||||
|
@ -687,7 +687,7 @@ func TestRuleBuilder_Build(t *testing.T) {
|
|||
rspFile := filepath.Join("out/soong/singleton/rsp")
|
||||
rspFile2 := filepath.Join("out/soong/singleton/rsp2")
|
||||
singleton := result.SingletonForTests("rule_builder_test")
|
||||
check(t, singleton.Rule("rule").RelativeToTop(), singleton.Output(rspFile2).RelativeToTop(),
|
||||
check(t, singleton.Rule("rule"), singleton.Output(rspFile2),
|
||||
"cp bar "+outFile+" @"+rspFile+" @"+rspFile2,
|
||||
outFile, outFile+".d", rspFile, rspFile2, true, nil, nil)
|
||||
})
|
||||
|
|
|
@ -551,6 +551,8 @@ type TestingBuildParams struct {
|
|||
// * CommandOrderOnly
|
||||
//
|
||||
// See PathRelativeToTop for more details.
|
||||
//
|
||||
// deprecated: this is no longer needed as TestingBuildParams are created in this form.
|
||||
func (p TestingBuildParams) RelativeToTop() TestingBuildParams {
|
||||
// If this is not a valid params then just return it back. That will make it easy to use with the
|
||||
// Maybe...() methods.
|
||||
|
|
|
@ -485,7 +485,7 @@ func TestBasicApex(t *testing.T) {
|
|||
}
|
||||
`)
|
||||
|
||||
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule").RelativeToTop()
|
||||
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
|
||||
|
||||
// Make sure that Android.mk is created
|
||||
ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
|
||||
|
@ -2498,7 +2498,7 @@ func TestVendorApex_use_vndk_as_stable(t *testing.T) {
|
|||
|
||||
vendorVariant := "android_vendor.VER_arm64_armv8-a"
|
||||
|
||||
ldRule := ctx.ModuleForTests("mybin", vendorVariant+"_apex10000").Rule("ld").RelativeToTop()
|
||||
ldRule := ctx.ModuleForTests("mybin", vendorVariant+"_apex10000").Rule("ld")
|
||||
libs := names(ldRule.Args["libFlags"])
|
||||
// VNDK libs(libvndk/libc++) as they are
|
||||
ensureListContains(t, libs, "out/soong/.intermediates/libvndk/"+vendorVariant+"_shared/libvndk.so")
|
||||
|
@ -6849,7 +6849,7 @@ func TestTestFor(t *testing.T) {
|
|||
`)
|
||||
|
||||
ensureLinkedLibIs := func(mod, variant, linkedLib, expectedVariant string) {
|
||||
ldFlags := strings.Split(ctx.ModuleForTests(mod, variant).Rule("ld").RelativeToTop().Args["libFlags"], " ")
|
||||
ldFlags := strings.Split(ctx.ModuleForTests(mod, variant).Rule("ld").Args["libFlags"], " ")
|
||||
mylibLdFlags := android.FilterListPred(ldFlags, func(s string) bool { return strings.HasPrefix(s, linkedLib) })
|
||||
android.AssertArrayString(t, "unexpected "+linkedLib+" link library for "+mod, []string{linkedLib + expectedVariant}, mylibLdFlags)
|
||||
}
|
||||
|
@ -6907,7 +6907,7 @@ func TestIndirectTestFor(t *testing.T) {
|
|||
`)
|
||||
|
||||
ensureLinkedLibIs := func(mod, variant, linkedLib, expectedVariant string) {
|
||||
ldFlags := strings.Split(ctx.ModuleForTests(mod, variant).Rule("ld").RelativeToTop().Args["libFlags"], " ")
|
||||
ldFlags := strings.Split(ctx.ModuleForTests(mod, variant).Rule("ld").Args["libFlags"], " ")
|
||||
mylibLdFlags := android.FilterListPred(ldFlags, func(s string) bool { return strings.HasPrefix(s, linkedLib) })
|
||||
android.AssertArrayString(t, "unexpected "+linkedLib+" link library for "+mod, []string{linkedLib + expectedVariant}, mylibLdFlags)
|
||||
}
|
||||
|
|
|
@ -652,7 +652,7 @@ func TestLibraryAssets(t *testing.T) {
|
|||
} else {
|
||||
aapt2link = m.Output("package-res.apk")
|
||||
}
|
||||
aapt2link = aapt2link.RelativeToTop()
|
||||
aapt2link = aapt2link
|
||||
aapt2Flags := aapt2link.Args["flags"]
|
||||
if test.assetFlag != "" {
|
||||
android.AssertStringDoesContain(t, "asset flag", aapt2Flags, test.assetFlag)
|
||||
|
@ -1993,14 +1993,14 @@ func TestOverrideAndroidAppDependency(t *testing.T) {
|
|||
`)
|
||||
|
||||
// Verify baz, which depends on the overridden module foo, has the correct classpath javac arg.
|
||||
javac := ctx.ModuleForTests("baz", "android_common").Rule("javac").RelativeToTop()
|
||||
javac := ctx.ModuleForTests("baz", "android_common").Rule("javac")
|
||||
fooTurbine := "out/soong/.intermediates/foo/android_common/turbine-combined/foo.jar"
|
||||
if !strings.Contains(javac.Args["classpath"], fooTurbine) {
|
||||
t.Errorf("baz classpath %v does not contain %q", javac.Args["classpath"], fooTurbine)
|
||||
}
|
||||
|
||||
// Verify qux, which depends on the overriding module bar, has the correct classpath javac arg.
|
||||
javac = ctx.ModuleForTests("qux", "android_common").Rule("javac").RelativeToTop()
|
||||
javac = ctx.ModuleForTests("qux", "android_common").Rule("javac")
|
||||
barTurbine := "out/soong/.intermediates/foo/android_common_bar/turbine-combined/foo.jar"
|
||||
if !strings.Contains(javac.Args["classpath"], barTurbine) {
|
||||
t.Errorf("qux classpath %v does not contain %q", javac.Args["classpath"], barTurbine)
|
||||
|
@ -2077,7 +2077,7 @@ func TestOverrideAndroidTest(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check if javac classpath has the correct jar file path. This checks instrumentation_for overrides.
|
||||
javac := variant.Rule("javac").RelativeToTop()
|
||||
javac := variant.Rule("javac")
|
||||
turbine := filepath.Join("out", "soong", ".intermediates", "foo", expected.targetVariant, "turbine-combined", "foo.jar")
|
||||
if !strings.Contains(javac.Args["classpath"], turbine) {
|
||||
t.Errorf("classpath %q does not contain %q", javac.Args["classpath"], turbine)
|
||||
|
@ -2151,7 +2151,7 @@ func TestAndroidTest_FixTestConfig(t *testing.T) {
|
|||
|
||||
for _, test := range testCases {
|
||||
variant := ctx.ModuleForTests(test.moduleName, test.variantName)
|
||||
params := variant.MaybeOutput("test_config_fixer/AndroidTest.xml").RelativeToTop()
|
||||
params := variant.MaybeOutput("test_config_fixer/AndroidTest.xml")
|
||||
|
||||
if len(test.expectedFlags) > 0 {
|
||||
if params.Rule == nil {
|
||||
|
@ -2647,14 +2647,14 @@ func TestEmbedNotice(t *testing.T) {
|
|||
t.Errorf("GENRULE_NOTICE is missing from notice files, %q", noticeInputs)
|
||||
}
|
||||
// aapt2 flags should include -A <NOTICE dir> so that its contents are put in the APK's /assets.
|
||||
res := foo.Output("package-res.apk").RelativeToTop()
|
||||
res := foo.Output("package-res.apk")
|
||||
aapt2Flags := res.Args["flags"]
|
||||
e := "-A out/soong/.intermediates/foo/android_common/NOTICE"
|
||||
android.AssertStringDoesContain(t, "expected.apkPath", aapt2Flags, e)
|
||||
|
||||
// bar has NOTICE files to process, but embed_notices is not set.
|
||||
bar := result.ModuleForTests("bar", "android_common")
|
||||
res = bar.Output("package-res.apk").RelativeToTop()
|
||||
res = bar.Output("package-res.apk")
|
||||
aapt2Flags = res.Args["flags"]
|
||||
e = "-A out/soong/.intermediates/bar/android_common/NOTICE"
|
||||
android.AssertStringDoesNotContain(t, "bar shouldn't have the asset dir flag for NOTICE", aapt2Flags, e)
|
||||
|
|
|
@ -80,7 +80,7 @@ func TestDroiddoc(t *testing.T) {
|
|||
|
||||
barStubsOutput := barStubsOutputs[0]
|
||||
barDoc := ctx.ModuleForTests("bar-doc", "android_common")
|
||||
javaDoc := barDoc.Rule("javadoc").RelativeToTop()
|
||||
javaDoc := barDoc.Rule("javadoc")
|
||||
if g, w := android.PathsRelativeToTop(javaDoc.Implicits), android.PathRelativeToTop(barStubsOutput); !inList(w, g) {
|
||||
t.Errorf("implicits of bar-doc must contain %q, but was %q.", w, g)
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ func TestHiddenAPISingleton(t *testing.T) {
|
|||
`)
|
||||
|
||||
hiddenAPI := result.SingletonForTests("hiddenapi")
|
||||
hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
|
||||
hiddenapiRule := hiddenAPI.Rule("hiddenapi")
|
||||
want := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
|
||||
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want)
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ func TestHiddenAPISingletonWithPrebuilt(t *testing.T) {
|
|||
`)
|
||||
|
||||
hiddenAPI := result.SingletonForTests("hiddenapi")
|
||||
hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
|
||||
hiddenapiRule := hiddenAPI.Rule("hiddenapi")
|
||||
want := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
|
||||
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want)
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ func TestHiddenAPISingletonWithPrebuiltUseSource(t *testing.T) {
|
|||
`)
|
||||
|
||||
hiddenAPI := result.SingletonForTests("hiddenapi")
|
||||
hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
|
||||
hiddenapiRule := hiddenAPI.Rule("hiddenapi")
|
||||
fromSourceJarArg := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
|
||||
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, fromSourceJarArg)
|
||||
|
||||
|
@ -196,7 +196,7 @@ func TestHiddenAPISingletonWithPrebuiltOverrideSource(t *testing.T) {
|
|||
`)
|
||||
|
||||
hiddenAPI := result.SingletonForTests("hiddenapi")
|
||||
hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
|
||||
hiddenapiRule := hiddenAPI.Rule("hiddenapi")
|
||||
prebuiltJarArg := "--boot-dex=out/soong/.intermediates/prebuilt_foo/android_common/dex/foo.jar"
|
||||
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, prebuiltJarArg)
|
||||
|
||||
|
@ -244,7 +244,7 @@ func TestHiddenAPISingletonSdks(t *testing.T) {
|
|||
).RunTest(t)
|
||||
|
||||
hiddenAPI := result.SingletonForTests("hiddenapi")
|
||||
hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
|
||||
hiddenapiRule := hiddenAPI.Rule("hiddenapi")
|
||||
wantPublicStubs := "--public-stub-classpath=" + generateSdkDexPath(tc.publicStub, tc.unbundledBuild)
|
||||
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, wantPublicStubs)
|
||||
|
||||
|
@ -307,7 +307,7 @@ func TestHiddenAPISingletonWithPrebuiltCsvFile(t *testing.T) {
|
|||
cpRule := hiddenAPI.Rule("Cp")
|
||||
actualCpInput := cpRule.BuildParams.Input
|
||||
actualCpOutput := cpRule.BuildParams.Output
|
||||
encodeDexRule := foo.Rule("hiddenAPIEncodeDex").RelativeToTop()
|
||||
encodeDexRule := foo.Rule("hiddenAPIEncodeDex")
|
||||
actualFlagsCsv := encodeDexRule.BuildParams.Args["flagsCsv"]
|
||||
|
||||
android.AssertPathRelativeToTopEquals(t, "hiddenapi cp rule input", expectedCpInput, actualCpInput)
|
||||
|
|
|
@ -250,7 +250,7 @@ func TestSimple(t *testing.T) {
|
|||
}
|
||||
`)
|
||||
|
||||
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac").RelativeToTop()
|
||||
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
|
||||
combineJar := ctx.ModuleForTests("foo", "android_common").Description("for javac")
|
||||
|
||||
if len(javac.Inputs) != 1 || javac.Inputs[0].String() != "a.java" {
|
||||
|
@ -976,7 +976,7 @@ func TestDefaults(t *testing.T) {
|
|||
}
|
||||
`)
|
||||
|
||||
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac").RelativeToTop()
|
||||
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
|
||||
combineJar := ctx.ModuleForTests("foo", "android_common").Description("for javac")
|
||||
|
||||
if len(javac.Inputs) != 1 || javac.Inputs[0].String() != "a.java" {
|
||||
|
@ -1336,11 +1336,11 @@ func TestTurbine(t *testing.T) {
|
|||
}
|
||||
`)
|
||||
|
||||
fooTurbine := result.ModuleForTests("foo", "android_common").Rule("turbine").RelativeToTop()
|
||||
barTurbine := result.ModuleForTests("bar", "android_common").Rule("turbine").RelativeToTop()
|
||||
barJavac := result.ModuleForTests("bar", "android_common").Rule("javac").RelativeToTop()
|
||||
barTurbineCombined := result.ModuleForTests("bar", "android_common").Description("for turbine").RelativeToTop()
|
||||
bazJavac := result.ModuleForTests("baz", "android_common").Rule("javac").RelativeToTop()
|
||||
fooTurbine := result.ModuleForTests("foo", "android_common").Rule("turbine")
|
||||
barTurbine := result.ModuleForTests("bar", "android_common").Rule("turbine")
|
||||
barJavac := result.ModuleForTests("bar", "android_common").Rule("javac")
|
||||
barTurbineCombined := result.ModuleForTests("bar", "android_common").Description("for turbine")
|
||||
bazJavac := result.ModuleForTests("baz", "android_common").Rule("javac")
|
||||
|
||||
android.AssertPathsRelativeToTopEquals(t, "foo inputs", []string{"a.java"}, fooTurbine.Inputs)
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ func TestSharding(t *testing.T) {
|
|||
|
||||
barHeaderJar := filepath.Join("out", "soong", ".intermediates", "bar", "android_common", "turbine-combined", "bar.jar")
|
||||
for i := 0; i < 3; i++ {
|
||||
barJavac := ctx.ModuleForTests("bar", "android_common").Description("javac" + strconv.Itoa(i)).RelativeToTop()
|
||||
barJavac := ctx.ModuleForTests("bar", "android_common").Description("javac" + strconv.Itoa(i))
|
||||
if !strings.Contains(barJavac.Args["classpath"], barHeaderJar) {
|
||||
t.Errorf("bar javac classpath %v does not contain %q", barJavac.Args["classpath"], barHeaderJar)
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
|
|||
m := result.ModuleForTests("foo", "android_common")
|
||||
|
||||
// Check AAPT2 link flags.
|
||||
aapt2Flags := m.Output("package-res.apk").RelativeToTop().Args["flags"]
|
||||
aapt2Flags := m.Output("package-res.apk").Args["flags"]
|
||||
expectedFlags := []string{"--keep-raw-values", "--no-resource-deduping", "--no-resource-removal"}
|
||||
absentFlags := android.RemoveListFromList(expectedFlags, strings.Split(aapt2Flags, " "))
|
||||
if len(absentFlags) > 0 {
|
||||
|
|
|
@ -313,10 +313,10 @@ func TestClasspath(t *testing.T) {
|
|||
|
||||
checkClasspath := func(t *testing.T, result *android.TestResult, isJava8 bool) {
|
||||
foo := result.ModuleForTests("foo", variant)
|
||||
javac := foo.Rule("javac").RelativeToTop()
|
||||
javac := foo.Rule("javac")
|
||||
var deps []string
|
||||
|
||||
aidl := foo.MaybeRule("aidl").RelativeToTop()
|
||||
aidl := foo.MaybeRule("aidl")
|
||||
if aidl.Rule != nil {
|
||||
deps = append(deps, android.PathRelativeToTop(aidl.Output))
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ func TestClasspath(t *testing.T) {
|
|||
checkClasspath(t, result, true /* isJava8 */)
|
||||
|
||||
if testcase.host != android.Host {
|
||||
aidl := result.ModuleForTests("foo", variant).Rule("aidl").RelativeToTop()
|
||||
aidl := result.ModuleForTests("foo", variant).Rule("aidl")
|
||||
|
||||
android.AssertStringDoesContain(t, "aidl command", aidl.RuleParams.Command, testcase.aidl+" -I.")
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ func TestClasspath(t *testing.T) {
|
|||
checkClasspath(t, result, false /* isJava8 */)
|
||||
|
||||
if testcase.host != android.Host {
|
||||
aidl := result.ModuleForTests("foo", variant).Rule("aidl").RelativeToTop()
|
||||
aidl := result.ModuleForTests("foo", variant).Rule("aidl")
|
||||
|
||||
android.AssertStringDoesContain(t, "aidl command", aidl.RuleParams.Command, testcase.aidl+" -I.")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue