Merge changes Ia3e93b8a,I964af3cb am: 4f6d15465b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1655215 Change-Id: Ic544a97baed5a669a9528505b5a4110b8e738762
This commit is contained in:
112
cc/cc_test.go
112
cc/cc_test.go
@@ -16,7 +16,6 @@ package cc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
@@ -27,36 +26,10 @@ import (
|
|||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
var buildDir string
|
|
||||||
|
|
||||||
func setUp() {
|
|
||||||
var err error
|
|
||||||
buildDir, err = ioutil.TempDir("", "soong_cc_test")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func tearDown() {
|
|
||||||
os.RemoveAll(buildDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
run := func() int {
|
os.Exit(m.Run())
|
||||||
setUp()
|
|
||||||
defer tearDown()
|
|
||||||
|
|
||||||
return m.Run()
|
|
||||||
}
|
|
||||||
|
|
||||||
os.Exit(run())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var ccFixtureFactory = android.NewFixtureFactory(
|
|
||||||
&buildDir,
|
|
||||||
prepareForCcTest,
|
|
||||||
)
|
|
||||||
|
|
||||||
var prepareForCcTest = android.GroupFixturePreparers(
|
var prepareForCcTest = android.GroupFixturePreparers(
|
||||||
PrepareForTestWithCcIncludeVndk,
|
PrepareForTestWithCcIncludeVndk,
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
@@ -66,62 +39,62 @@ var prepareForCcTest = android.GroupFixturePreparers(
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
// testCcWithConfig runs tests using the ccFixtureFactory
|
// testCcWithConfig runs tests using the prepareForCcTest
|
||||||
//
|
//
|
||||||
// See testCc for an explanation as to how to stop using this deprecated method.
|
// See testCc for an explanation as to how to stop using this deprecated method.
|
||||||
//
|
//
|
||||||
// deprecated
|
// deprecated
|
||||||
func testCcWithConfig(t *testing.T, config android.Config) *android.TestContext {
|
func testCcWithConfig(t *testing.T, config android.Config) *android.TestContext {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
result := ccFixtureFactory.RunTestWithConfig(t, config)
|
result := prepareForCcTest.RunTestWithConfig(t, config)
|
||||||
return result.TestContext
|
return result.TestContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// testCc runs tests using the ccFixtureFactory
|
// testCc runs tests using the prepareForCcTest
|
||||||
//
|
//
|
||||||
// Do not add any new usages of this, instead use the ccFixtureFactory directly as it makes it much
|
// Do not add any new usages of this, instead use the prepareForCcTest directly as it makes it much
|
||||||
// easier to customize the test behavior.
|
// easier to customize the test behavior.
|
||||||
//
|
//
|
||||||
// If it is necessary to customize the behavior of an existing test that uses this then please first
|
// If it is necessary to customize the behavior of an existing test that uses this then please first
|
||||||
// convert the test to using ccFixtureFactory first and then in a following change add the
|
// convert the test to using prepareForCcTest first and then in a following change add the
|
||||||
// appropriate fixture preparers. Keeping the conversion change separate makes it easy to verify
|
// appropriate fixture preparers. Keeping the conversion change separate makes it easy to verify
|
||||||
// that it did not change the test behavior unexpectedly.
|
// that it did not change the test behavior unexpectedly.
|
||||||
//
|
//
|
||||||
// deprecated
|
// deprecated
|
||||||
func testCc(t *testing.T, bp string) *android.TestContext {
|
func testCc(t *testing.T, bp string) *android.TestContext {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
result := ccFixtureFactory.RunTestWithBp(t, bp)
|
result := prepareForCcTest.RunTestWithBp(t, bp)
|
||||||
return result.TestContext
|
return result.TestContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// testCcNoVndk runs tests using the ccFixtureFactory
|
// testCcNoVndk runs tests using the prepareForCcTest
|
||||||
//
|
//
|
||||||
// See testCc for an explanation as to how to stop using this deprecated method.
|
// See testCc for an explanation as to how to stop using this deprecated method.
|
||||||
//
|
//
|
||||||
// deprecated
|
// deprecated
|
||||||
func testCcNoVndk(t *testing.T, bp string) *android.TestContext {
|
func testCcNoVndk(t *testing.T, bp string) *android.TestContext {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
|
|
||||||
return testCcWithConfig(t, config)
|
return testCcWithConfig(t, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
// testCcNoProductVndk runs tests using the ccFixtureFactory
|
// testCcNoProductVndk runs tests using the prepareForCcTest
|
||||||
//
|
//
|
||||||
// See testCc for an explanation as to how to stop using this deprecated method.
|
// See testCc for an explanation as to how to stop using this deprecated method.
|
||||||
//
|
//
|
||||||
// deprecated
|
// deprecated
|
||||||
func testCcNoProductVndk(t *testing.T, bp string) *android.TestContext {
|
func testCcNoProductVndk(t *testing.T, bp string) *android.TestContext {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
|
|
||||||
return testCcWithConfig(t, config)
|
return testCcWithConfig(t, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
// testCcErrorWithConfig runs tests using the ccFixtureFactory
|
// testCcErrorWithConfig runs tests using the prepareForCcTest
|
||||||
//
|
//
|
||||||
// See testCc for an explanation as to how to stop using this deprecated method.
|
// See testCc for an explanation as to how to stop using this deprecated method.
|
||||||
//
|
//
|
||||||
@@ -129,33 +102,33 @@ func testCcNoProductVndk(t *testing.T, bp string) *android.TestContext {
|
|||||||
func testCcErrorWithConfig(t *testing.T, pattern string, config android.Config) {
|
func testCcErrorWithConfig(t *testing.T, pattern string, config android.Config) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
ccFixtureFactory.Extend().
|
prepareForCcTest.
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(pattern)).
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(pattern)).
|
||||||
RunTestWithConfig(t, config)
|
RunTestWithConfig(t, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
// testCcError runs tests using the ccFixtureFactory
|
// testCcError runs tests using the prepareForCcTest
|
||||||
//
|
//
|
||||||
// See testCc for an explanation as to how to stop using this deprecated method.
|
// See testCc for an explanation as to how to stop using this deprecated method.
|
||||||
//
|
//
|
||||||
// deprecated
|
// deprecated
|
||||||
func testCcError(t *testing.T, pattern string, bp string) {
|
func testCcError(t *testing.T, pattern string, bp string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
testCcErrorWithConfig(t, pattern, config)
|
testCcErrorWithConfig(t, pattern, config)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// testCcErrorProductVndk runs tests using the ccFixtureFactory
|
// testCcErrorProductVndk runs tests using the prepareForCcTest
|
||||||
//
|
//
|
||||||
// See testCc for an explanation as to how to stop using this deprecated method.
|
// See testCc for an explanation as to how to stop using this deprecated method.
|
||||||
//
|
//
|
||||||
// deprecated
|
// deprecated
|
||||||
func testCcErrorProductVndk(t *testing.T, pattern string, bp string) {
|
func testCcErrorProductVndk(t *testing.T, pattern string, bp string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
@@ -193,7 +166,10 @@ func TestFuchsiaDeps(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}`
|
}`
|
||||||
|
|
||||||
result := ccFixtureFactory.Extend(PrepareForTestOnFuchsia).RunTestWithBp(t, bp)
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForCcTest,
|
||||||
|
PrepareForTestOnFuchsia,
|
||||||
|
).RunTestWithBp(t, bp)
|
||||||
|
|
||||||
rt := false
|
rt := false
|
||||||
fb := false
|
fb := false
|
||||||
@@ -229,7 +205,10 @@ func TestFuchsiaTargetDecl(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}`
|
}`
|
||||||
|
|
||||||
result := ccFixtureFactory.Extend(PrepareForTestOnFuchsia).RunTestWithBp(t, bp)
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForCcTest,
|
||||||
|
PrepareForTestOnFuchsia,
|
||||||
|
).RunTestWithBp(t, bp)
|
||||||
ld := result.ModuleForTests("libTest", "fuchsia_arm64_shared").Rule("ld")
|
ld := result.ModuleForTests("libTest", "fuchsia_arm64_shared").Rule("ld")
|
||||||
var objs []string
|
var objs []string
|
||||||
for _, o := range ld.Inputs {
|
for _, o := range ld.Inputs {
|
||||||
@@ -474,7 +453,7 @@ func TestVndk(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
@@ -495,7 +474,7 @@ func TestVndk(t *testing.T) {
|
|||||||
|
|
||||||
// Check VNDK snapshot output.
|
// Check VNDK snapshot output.
|
||||||
snapshotDir := "vndk-snapshot"
|
snapshotDir := "vndk-snapshot"
|
||||||
snapshotVariantPath := filepath.Join(buildDir, snapshotDir, "arm64")
|
snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64")
|
||||||
|
|
||||||
vndkLibPath := filepath.Join(snapshotVariantPath, fmt.Sprintf("arch-%s-%s",
|
vndkLibPath := filepath.Join(snapshotVariantPath, fmt.Sprintf("arch-%s-%s",
|
||||||
"arm64", "armv8-a"))
|
"arm64", "armv8-a"))
|
||||||
@@ -596,7 +575,7 @@ func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
|
|||||||
name: "llndk.libraries.txt",
|
name: "llndk.libraries.txt",
|
||||||
insert_vndk_version: true,
|
insert_vndk_version: true,
|
||||||
}`
|
}`
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
ctx := testCcWithConfig(t, config)
|
ctx := testCcWithConfig(t, config)
|
||||||
@@ -646,7 +625,7 @@ func TestVndkUsingCoreVariant(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
|
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
|
||||||
@@ -673,7 +652,7 @@ func TestDataLibs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
|
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
|
||||||
@@ -724,7 +703,7 @@ func TestDataLibsRelativeInstallPath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
|
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
|
||||||
@@ -1349,7 +1328,7 @@ func TestVndkExt(t *testing.T) {
|
|||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
@@ -1794,7 +1773,7 @@ func TestProductVndkExtDependency(t *testing.T) {
|
|||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
@@ -2121,7 +2100,7 @@ func TestEnforceProductVndkVersion(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
ctx := ccFixtureFactory.RunTestWithBp(t, bp).TestContext
|
ctx := prepareForCcTest.RunTestWithBp(t, bp).TestContext
|
||||||
|
|
||||||
checkVndkModule(t, ctx, "libvndk", "", false, "", productVariant)
|
checkVndkModule(t, ctx, "libvndk", "", false, "", productVariant)
|
||||||
checkVndkModule(t, ctx, "libvndk_sp", "", true, "", productVariant)
|
checkVndkModule(t, ctx, "libvndk_sp", "", true, "", productVariant)
|
||||||
@@ -2349,7 +2328,7 @@ func TestMakeLinkType(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
// native:vndk
|
// native:vndk
|
||||||
@@ -3141,7 +3120,7 @@ func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
|
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
|
||||||
@@ -3457,7 +3436,8 @@ func TestProductVariableDefaults(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
result := ccFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForCcTest,
|
||||||
android.PrepareForTestWithVariables,
|
android.PrepareForTestWithVariables,
|
||||||
|
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
@@ -3484,7 +3464,8 @@ func TestEmptyWholeStaticLibsAllowMissingDependencies(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
result := ccFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForCcTest,
|
||||||
android.PrepareForTestWithAllowMissingDependencies,
|
android.PrepareForTestWithAllowMissingDependencies,
|
||||||
).RunTestWithBp(t, bp)
|
).RunTestWithBp(t, bp)
|
||||||
|
|
||||||
@@ -3536,7 +3517,7 @@ func TestInstallSharedLibs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
ctx := testCcWithConfig(t, config)
|
ctx := testCcWithConfig(t, config)
|
||||||
|
|
||||||
hostBin := ctx.ModuleForTests("bin", config.BuildOSTarget.String()).Description("install")
|
hostBin := ctx.ModuleForTests("bin", config.BuildOSTarget.String()).Description("install")
|
||||||
@@ -3827,7 +3808,10 @@ var prepareForTestWithMemtagHeap = android.GroupFixturePreparers(
|
|||||||
func TestSanitizeMemtagHeap(t *testing.T) {
|
func TestSanitizeMemtagHeap(t *testing.T) {
|
||||||
variant := "android_arm64_armv8-a"
|
variant := "android_arm64_armv8-a"
|
||||||
|
|
||||||
result := ccFixtureFactory.Extend(prepareForTestWithMemtagHeap).RunTest(t)
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForCcTest,
|
||||||
|
prepareForTestWithMemtagHeap,
|
||||||
|
).RunTest(t)
|
||||||
ctx := result.TestContext
|
ctx := result.TestContext
|
||||||
|
|
||||||
checkHasMemtagNote(t, ctx.ModuleForTests("default_test", variant), Sync)
|
checkHasMemtagNote(t, ctx.ModuleForTests("default_test", variant), Sync)
|
||||||
@@ -3882,7 +3866,8 @@ func TestSanitizeMemtagHeap(t *testing.T) {
|
|||||||
func TestSanitizeMemtagHeapWithSanitizeDevice(t *testing.T) {
|
func TestSanitizeMemtagHeapWithSanitizeDevice(t *testing.T) {
|
||||||
variant := "android_arm64_armv8-a"
|
variant := "android_arm64_armv8-a"
|
||||||
|
|
||||||
result := ccFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForCcTest,
|
||||||
prepareForTestWithMemtagHeap,
|
prepareForTestWithMemtagHeap,
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
variables.SanitizeDevice = []string{"memtag_heap"}
|
variables.SanitizeDevice = []string{"memtag_heap"}
|
||||||
@@ -3942,7 +3927,8 @@ func TestSanitizeMemtagHeapWithSanitizeDevice(t *testing.T) {
|
|||||||
func TestSanitizeMemtagHeapWithSanitizeDeviceDiag(t *testing.T) {
|
func TestSanitizeMemtagHeapWithSanitizeDeviceDiag(t *testing.T) {
|
||||||
variant := "android_arm64_armv8-a"
|
variant := "android_arm64_armv8-a"
|
||||||
|
|
||||||
result := ccFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForCcTest,
|
||||||
prepareForTestWithMemtagHeap,
|
prepareForTestWithMemtagHeap,
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
variables.SanitizeDevice = []string{"memtag_heap"}
|
variables.SanitizeDevice = []string{"memtag_heap"}
|
||||||
|
@@ -52,7 +52,7 @@ func TestArchGenruleCmd(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
config := android.TestArchConfig(buildDir, nil, bp, fs)
|
config := android.TestArchConfig(t.TempDir(), nil, bp, fs)
|
||||||
|
|
||||||
ctx := testGenruleContext(config)
|
ctx := testGenruleContext(config)
|
||||||
|
|
||||||
|
@@ -199,7 +199,7 @@ func TestStubsVersions(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.Platform_version_active_codenames = []string{"R"}
|
config.TestProductVariables.Platform_version_active_codenames = []string{"R"}
|
||||||
ctx := testCcWithConfig(t, config)
|
ctx := testCcWithConfig(t, config)
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ func TestStubsVersions_NotSorted(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.Platform_version_active_codenames = []string{"R"}
|
config.TestProductVariables.Platform_version_active_codenames = []string{"R"}
|
||||||
testCcErrorWithConfig(t, `"libfoo" .*: versions: not sorted`, config)
|
testCcErrorWithConfig(t, `"libfoo" .*: versions: not sorted`, config)
|
||||||
}
|
}
|
||||||
|
@@ -22,14 +22,17 @@ import (
|
|||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
)
|
)
|
||||||
|
|
||||||
var prebuiltFixtureFactory = ccFixtureFactory.Extend(
|
var prepareForPrebuiltTest = android.GroupFixturePreparers(
|
||||||
|
prepareForCcTest,
|
||||||
android.PrepareForTestWithAndroidMk,
|
android.PrepareForTestWithAndroidMk,
|
||||||
)
|
)
|
||||||
|
|
||||||
func testPrebuilt(t *testing.T, bp string, fs android.MockFS, handlers ...android.FixturePreparer) *android.TestContext {
|
func testPrebuilt(t *testing.T, bp string, fs android.MockFS, handlers ...android.FixturePreparer) *android.TestContext {
|
||||||
result := prebuiltFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForPrebuiltTest,
|
||||||
fs.AddToFixture(),
|
fs.AddToFixture(),
|
||||||
).Extend(handlers...).RunTestWithBp(t, bp)
|
android.GroupFixturePreparers(handlers...),
|
||||||
|
).RunTestWithBp(t, bp)
|
||||||
|
|
||||||
return result.TestContext
|
return result.TestContext
|
||||||
}
|
}
|
||||||
|
@@ -86,7 +86,7 @@ func TestVendorSnapshotCapture(t *testing.T) {
|
|||||||
symbol_file: "",
|
symbol_file: "",
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
ctx := testCcWithConfig(t, config)
|
ctx := testCcWithConfig(t, config)
|
||||||
@@ -94,7 +94,7 @@ func TestVendorSnapshotCapture(t *testing.T) {
|
|||||||
// Check Vendor snapshot output.
|
// Check Vendor snapshot output.
|
||||||
|
|
||||||
snapshotDir := "vendor-snapshot"
|
snapshotDir := "vendor-snapshot"
|
||||||
snapshotVariantPath := filepath.Join(buildDir, snapshotDir, "arm64")
|
snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64")
|
||||||
snapshotSingleton := ctx.SingletonForTests("vendor-snapshot")
|
snapshotSingleton := ctx.SingletonForTests("vendor-snapshot")
|
||||||
|
|
||||||
var jsonFiles []string
|
var jsonFiles []string
|
||||||
@@ -212,7 +212,7 @@ func TestVendorSnapshotDirected(t *testing.T) {
|
|||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
config.TestProductVariables.DirectedVendorSnapshot = true
|
config.TestProductVariables.DirectedVendorSnapshot = true
|
||||||
@@ -224,7 +224,7 @@ func TestVendorSnapshotDirected(t *testing.T) {
|
|||||||
// Check Vendor snapshot output.
|
// Check Vendor snapshot output.
|
||||||
|
|
||||||
snapshotDir := "vendor-snapshot"
|
snapshotDir := "vendor-snapshot"
|
||||||
snapshotVariantPath := filepath.Join(buildDir, snapshotDir, "arm64")
|
snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64")
|
||||||
snapshotSingleton := ctx.SingletonForTests("vendor-snapshot")
|
snapshotSingleton := ctx.SingletonForTests("vendor-snapshot")
|
||||||
|
|
||||||
var includeJsonFiles []string
|
var includeJsonFiles []string
|
||||||
@@ -516,7 +516,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
"vndk/libvndk.so": nil,
|
"vndk/libvndk.so": nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, "", mockFS)
|
config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("BOARD")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("BOARD")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
ctx := CreateTestContext(config)
|
ctx := CreateTestContext(config)
|
||||||
@@ -628,7 +628,7 @@ func TestVendorSnapshotSanitizer(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("BOARD")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("BOARD")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
ctx := testCcWithConfig(t, config)
|
ctx := testCcWithConfig(t, config)
|
||||||
@@ -707,7 +707,7 @@ func TestVendorSnapshotExclude(t *testing.T) {
|
|||||||
"device/vendor.cpp": nil,
|
"device/vendor.cpp": nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, "", mockFS)
|
config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
ctx := CreateTestContext(config)
|
ctx := CreateTestContext(config)
|
||||||
@@ -730,7 +730,7 @@ func TestVendorSnapshotExclude(t *testing.T) {
|
|||||||
// Verify the content of the vendor snapshot.
|
// Verify the content of the vendor snapshot.
|
||||||
|
|
||||||
snapshotDir := "vendor-snapshot"
|
snapshotDir := "vendor-snapshot"
|
||||||
snapshotVariantPath := filepath.Join(buildDir, snapshotDir, "arm64")
|
snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64")
|
||||||
snapshotSingleton := ctx.SingletonForTests("vendor-snapshot")
|
snapshotSingleton := ctx.SingletonForTests("vendor-snapshot")
|
||||||
|
|
||||||
var includeJsonFiles []string
|
var includeJsonFiles []string
|
||||||
@@ -799,7 +799,7 @@ func TestVendorSnapshotExcludeInVendorProprietaryPathErrors(t *testing.T) {
|
|||||||
"device/vendor.cpp": nil,
|
"device/vendor.cpp": nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, "", mockFS)
|
config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
ctx := CreateTestContext(config)
|
ctx := CreateTestContext(config)
|
||||||
@@ -873,7 +873,7 @@ func TestRecoverySnapshotCapture(t *testing.T) {
|
|||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current")
|
config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
ctx := testCcWithConfig(t, config)
|
ctx := testCcWithConfig(t, config)
|
||||||
@@ -881,7 +881,7 @@ func TestRecoverySnapshotCapture(t *testing.T) {
|
|||||||
// Check Recovery snapshot output.
|
// Check Recovery snapshot output.
|
||||||
|
|
||||||
snapshotDir := "recovery-snapshot"
|
snapshotDir := "recovery-snapshot"
|
||||||
snapshotVariantPath := filepath.Join(buildDir, snapshotDir, "arm64")
|
snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64")
|
||||||
snapshotSingleton := ctx.SingletonForTests("recovery-snapshot")
|
snapshotSingleton := ctx.SingletonForTests("recovery-snapshot")
|
||||||
|
|
||||||
var jsonFiles []string
|
var jsonFiles []string
|
||||||
@@ -991,7 +991,7 @@ func TestRecoverySnapshotExclude(t *testing.T) {
|
|||||||
"device/recovery.cpp": nil,
|
"device/recovery.cpp": nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, "", mockFS)
|
config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS)
|
||||||
config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current")
|
config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
ctx := CreateTestContext(config)
|
ctx := CreateTestContext(config)
|
||||||
@@ -1014,7 +1014,7 @@ func TestRecoverySnapshotExclude(t *testing.T) {
|
|||||||
// Verify the content of the recovery snapshot.
|
// Verify the content of the recovery snapshot.
|
||||||
|
|
||||||
snapshotDir := "recovery-snapshot"
|
snapshotDir := "recovery-snapshot"
|
||||||
snapshotVariantPath := filepath.Join(buildDir, snapshotDir, "arm64")
|
snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64")
|
||||||
snapshotSingleton := ctx.SingletonForTests("recovery-snapshot")
|
snapshotSingleton := ctx.SingletonForTests("recovery-snapshot")
|
||||||
|
|
||||||
var includeJsonFiles []string
|
var includeJsonFiles []string
|
||||||
@@ -1091,7 +1091,7 @@ func TestRecoverySnapshotDirected(t *testing.T) {
|
|||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
config := TestConfig(buildDir, android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current")
|
config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current")
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
@@ -1104,7 +1104,7 @@ func TestRecoverySnapshotDirected(t *testing.T) {
|
|||||||
// Check recovery snapshot output.
|
// Check recovery snapshot output.
|
||||||
|
|
||||||
snapshotDir := "recovery-snapshot"
|
snapshotDir := "recovery-snapshot"
|
||||||
snapshotVariantPath := filepath.Join(buildDir, snapshotDir, "arm64")
|
snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64")
|
||||||
snapshotSingleton := ctx.SingletonForTests("recovery-snapshot")
|
snapshotSingleton := ctx.SingletonForTests("recovery-snapshot")
|
||||||
|
|
||||||
var includeJsonFiles []string
|
var includeJsonFiles []string
|
||||||
|
Reference in New Issue
Block a user