Convert cc/prebuilt_test.go to use fixtures
Bug: 181070625 Test: m nothing Change-Id: I6048812962382e2adaf79d941a24e5c0ffdd9b25
This commit is contained in:
parent
6c9da044f8
commit
6a1160e749
|
@ -23,27 +23,16 @@ import (
|
|||
"github.com/google/blueprint"
|
||||
)
|
||||
|
||||
func testPrebuilt(t *testing.T, bp string, fs map[string][]byte, handlers ...configCustomizer) *android.TestContext {
|
||||
config := TestConfig(buildDir, android.Android, nil, bp, fs)
|
||||
ctx := CreateTestContext(config)
|
||||
var prebuiltFixtureFactory = ccFixtureFactory.Extend(
|
||||
android.PrepareForTestWithAndroidMk,
|
||||
)
|
||||
|
||||
// Enable androidmk support.
|
||||
// * Register the singleton
|
||||
// * Configure that we are inside make
|
||||
// * Add CommonOS to ensure that androidmk processing works.
|
||||
android.RegisterAndroidMkBuildComponents(ctx)
|
||||
android.SetKatiEnabledForTests(config)
|
||||
func testPrebuilt(t *testing.T, bp string, fs android.MockFS, handlers ...android.FixturePreparer) *android.TestContext {
|
||||
result := prebuiltFixtureFactory.Extend(
|
||||
fs.AddToFixture(),
|
||||
).Extend(handlers...).RunTestWithBp(t, bp)
|
||||
|
||||
for _, handler := range handlers {
|
||||
handler(config)
|
||||
}
|
||||
|
||||
ctx.Register()
|
||||
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
|
||||
android.FailIfErrored(t, errs)
|
||||
_, errs = ctx.PrepareBuildActions(config)
|
||||
android.FailIfErrored(t, errs)
|
||||
return ctx
|
||||
return result.TestContext
|
||||
}
|
||||
|
||||
type configCustomizer func(config android.Config)
|
||||
|
@ -370,9 +359,11 @@ func TestPrebuiltLibrarySanitized(t *testing.T) {
|
|||
assertString(t, static2.OutputFile().Path().Base(), "libf.a")
|
||||
|
||||
// With SANITIZE_TARGET=hwaddress
|
||||
ctx = testPrebuilt(t, bp, fs, func(config android.Config) {
|
||||
config.TestProductVariables.SanitizeDevice = []string{"hwaddress"}
|
||||
})
|
||||
ctx = testPrebuilt(t, bp, fs,
|
||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||
variables.SanitizeDevice = []string{"hwaddress"}
|
||||
}),
|
||||
)
|
||||
|
||||
shared_rule = ctx.ModuleForTests("libtest", "android_arm64_armv8-a_shared_hwasan").Rule("android/soong/cc.strip")
|
||||
assertString(t, shared_rule.Input.String(), "hwasan/libf.so")
|
||||
|
|
Loading…
Reference in New Issue