Merge "Convert fuchsia tests to use test fixtures"

This commit is contained in:
Paul Duffin
2021-03-11 14:07:01 +00:00
committed by Gerrit Code Review
3 changed files with 22 additions and 21 deletions

View File

@@ -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) {

View File

@@ -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)
}