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