Merge changes I6b868bac,If75f4718
* changes: Migrate android package to a per test build directory Convert android/path_properties_test.go to test fixtures
This commit is contained in:
@@ -15,34 +15,12 @@
|
||||
package android
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var buildDir string
|
||||
|
||||
func setUp() {
|
||||
var err error
|
||||
buildDir, err = ioutil.TempDir("", "soong_android_test")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func tearDown() {
|
||||
os.RemoveAll(buildDir)
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
run := func() int {
|
||||
setUp()
|
||||
defer tearDown()
|
||||
|
||||
return m.Run()
|
||||
}
|
||||
|
||||
os.Exit(run())
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
var emptyTestFixtureFactory = NewFixtureFactory(&buildDir)
|
||||
var emptyTestFixtureFactory = NewFixtureFactory(nil)
|
||||
|
@@ -15,7 +15,6 @@
|
||||
package android
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -158,23 +157,18 @@ func TestPathDepsMutator(t *testing.T) {
|
||||
}
|
||||
`
|
||||
|
||||
config := TestArchConfig(buildDir, nil, bp, nil)
|
||||
ctx := NewTestArchContext(config)
|
||||
result := emptyTestFixtureFactory.RunTest(t,
|
||||
PrepareForTestWithArchMutator,
|
||||
PrepareForTestWithFilegroup,
|
||||
FixtureRegisterWithContext(func(ctx RegistrationContext) {
|
||||
ctx.RegisterModuleType("test", pathDepsMutatorTestModuleFactory)
|
||||
}),
|
||||
FixtureWithRootAndroidBp(bp),
|
||||
)
|
||||
|
||||
ctx.RegisterModuleType("test", pathDepsMutatorTestModuleFactory)
|
||||
ctx.RegisterModuleType("filegroup", FileGroupFactory)
|
||||
m := result.Module("foo", "android_arm64_armv8-a").(*pathDepsMutatorTestModule)
|
||||
|
||||
ctx.Register()
|
||||
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
|
||||
FailIfErrored(t, errs)
|
||||
_, errs = ctx.PrepareBuildActions(config)
|
||||
FailIfErrored(t, errs)
|
||||
|
||||
m := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*pathDepsMutatorTestModule)
|
||||
|
||||
if g, w := m.sourceDeps, test.deps; !reflect.DeepEqual(g, w) {
|
||||
t.Errorf("want deps %q, got %q", w, g)
|
||||
}
|
||||
AssertDeepEquals(t, "deps", test.deps, m.sourceDeps)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user