Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a71a67a4 authored by Paul Duffin's avatar Paul Duffin
Browse files

Remove extraneous calls to TestingBuildParams.RelativeToTop()

Deprecated the method to try and prevent any other uses being added.

Bug: 183650682
Test: m nothing
Change-Id: Ia6f43851e5a00c9d96af780e3bd21e03175e1a2f
parent e8366da1
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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)
	})
+2 −0
Original line number Diff line number Diff line
@@ -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.
+4 −4
Original line number Diff line number Diff line
@@ -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)
	}
+7 −7
Original line number Diff line number Diff line
@@ -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)
+1 −1
Original line number Diff line number Diff line
@@ -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)
	}
Loading