Merge "Convert fuchsia tests to use test fixtures" am: 4e1916011c
am: 3dbfef078e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1626509 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I595f9751658d369f20b1b17003442ae1b47a18ac
This commit is contained in:
commit
9225cc2bf9
|
@ -287,24 +287,21 @@ func TestArchConfigNativeBridge(buildDir string, env map[string]string, bp strin
|
||||||
return testConfig
|
return testConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestArchConfigFuchsia returns a Config object suitable for using for
|
func fuchsiaTargets() map[OsType][]Target {
|
||||||
// tests that need to run the arch mutator for the Fuchsia arch.
|
return map[OsType][]Target{
|
||||||
func TestArchConfigFuchsia(buildDir string, env map[string]string, bp string, fs map[string][]byte) Config {
|
Fuchsia: {
|
||||||
testConfig := TestConfig(buildDir, env, bp, fs)
|
|
||||||
config := testConfig.config
|
|
||||||
|
|
||||||
config.Targets = map[OsType][]Target{
|
|
||||||
Fuchsia: []Target{
|
|
||||||
{Fuchsia, Arch{ArchType: Arm64, ArchVariant: "", Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", "", false},
|
{Fuchsia, Arch{ArchType: Arm64, ArchVariant: "", Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", "", false},
|
||||||
},
|
},
|
||||||
BuildOs: []Target{
|
BuildOs: {
|
||||||
{BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", "", false},
|
{BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", "", false},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return testConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var PrepareForTestSetDeviceToFuchsia = FixtureModifyConfig(func(config Config) {
|
||||||
|
config.Targets = fuchsiaTargets()
|
||||||
|
})
|
||||||
|
|
||||||
func modifyTestConfigToSupportArchMutator(testConfig Config) {
|
func modifyTestConfigToSupportArchMutator(testConfig Config) {
|
||||||
config := testConfig.config
|
config := testConfig.config
|
||||||
|
|
||||||
|
|
|
@ -181,13 +181,12 @@ func TestFuchsiaDeps(t *testing.T) {
|
||||||
},
|
},
|
||||||
}`
|
}`
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Fuchsia, nil, bp, nil)
|
result := ccFixtureFactory.Extend(PrepareForTestOnFuchsia).RunTestWithBp(t, bp)
|
||||||
ctx := testCcWithConfig(t, config)
|
|
||||||
|
|
||||||
rt := false
|
rt := false
|
||||||
fb := false
|
fb := false
|
||||||
|
|
||||||
ld := ctx.ModuleForTests("libTest", "fuchsia_arm64_shared").Rule("ld")
|
ld := result.ModuleForTests("libTest", "fuchsia_arm64_shared").Rule("ld")
|
||||||
implicits := ld.Implicits
|
implicits := ld.Implicits
|
||||||
for _, lib := range implicits {
|
for _, lib := range implicits {
|
||||||
if strings.Contains(lib.Rel(), "libcompiler_rt") {
|
if strings.Contains(lib.Rel(), "libcompiler_rt") {
|
||||||
|
@ -218,16 +217,13 @@ func TestFuchsiaTargetDecl(t *testing.T) {
|
||||||
},
|
},
|
||||||
}`
|
}`
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Fuchsia, nil, bp, nil)
|
result := ccFixtureFactory.Extend(PrepareForTestOnFuchsia).RunTestWithBp(t, bp)
|
||||||
ctx := testCcWithConfig(t, config)
|
ld := result.ModuleForTests("libTest", "fuchsia_arm64_shared").Rule("ld")
|
||||||
ld := ctx.ModuleForTests("libTest", "fuchsia_arm64_shared").Rule("ld")
|
|
||||||
var objs []string
|
var objs []string
|
||||||
for _, o := range ld.Inputs {
|
for _, o := range ld.Inputs {
|
||||||
objs = append(objs, o.Base())
|
objs = append(objs, o.Base())
|
||||||
}
|
}
|
||||||
if len(objs) != 2 || objs[0] != "foo.o" || objs[1] != "bar.o" {
|
result.AssertArrayString("libTest inputs", []string{"foo.o", "bar.o"}, objs)
|
||||||
t.Errorf("inputs of libTest must be []string{\"foo.o\", \"bar.o\"}, but was %#v.", objs)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVendorSrc(t *testing.T) {
|
func TestVendorSrc(t *testing.T) {
|
||||||
|
|
|
@ -653,6 +653,14 @@ var PrepareForTestOnLinuxBionic = android.GroupFixturePreparers(
|
||||||
android.FixtureAddTextFile(linuxBionicDefaultsPath, withLinuxBionic()),
|
android.FixtureAddTextFile(linuxBionicDefaultsPath, withLinuxBionic()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// The preparer to include if running a cc related test for fuchsia.
|
||||||
|
var PrepareForTestOnFuchsia = android.GroupFixturePreparers(
|
||||||
|
// Place the default cc test modules for fuschia in a location that will not conflict with default
|
||||||
|
// test modules defined by other packages.
|
||||||
|
android.FixtureAddTextFile("defaults/cc/fuschia/Android.bp", withFuchsiaModules()),
|
||||||
|
android.PrepareForTestSetDeviceToFuchsia,
|
||||||
|
)
|
||||||
|
|
||||||
// This adds some additional modules and singletons which might negatively impact the performance
|
// This adds some additional modules and singletons which might negatively impact the performance
|
||||||
// of tests so they are not included in the PrepareForIntegrationTestWithCc.
|
// of tests so they are not included in the PrepareForIntegrationTestWithCc.
|
||||||
var PrepareForTestWithCcIncludeVndk = android.GroupFixturePreparers(
|
var PrepareForTestWithCcIncludeVndk = android.GroupFixturePreparers(
|
||||||
|
@ -685,7 +693,7 @@ func TestConfig(buildDir string, os android.OsType, env map[string]string,
|
||||||
|
|
||||||
var config android.Config
|
var config android.Config
|
||||||
if os == android.Fuchsia {
|
if os == android.Fuchsia {
|
||||||
config = android.TestArchConfigFuchsia(buildDir, env, bp, mockFS)
|
panic("Fuchsia not supported use test fixture instead")
|
||||||
} else {
|
} else {
|
||||||
config = android.TestArchConfig(buildDir, env, bp, mockFS)
|
config = android.TestArchConfig(buildDir, env, bp, mockFS)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue