Support test fixtures in sdk package
Bug: 181070625
Test: m nothing
Change-Id: Ifc96992e54c1b1d89a82b88ab27e555ae267a51e
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index 6da135a..28c9e9e 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -21,7 +21,7 @@
"android/soong/cc"
)
-var ccTestFs = map[string][]byte{
+var ccTestFs = android.MockFS{
"Test.cpp": nil,
"myinclude/Test.h": nil,
"myinclude-android/AndroidTest.h": nil,
@@ -32,7 +32,7 @@
"some/where/stubslib.map.txt": nil,
}
-func testSdkWithCc(t *testing.T, bp string) *testSdkResult {
+func testSdkWithCc(t *testing.T, bp string) *android.TestResult {
t.Helper()
return testSdkWithFs(t, bp, ccTestFs)
}
@@ -808,7 +808,15 @@
}
func TestSnapshotWithSingleHostOsType(t *testing.T) {
- ctx, config := testSdkContext(`
+ result := sdkFixtureFactory.Extend(
+ ccTestFs.AddToFixture(),
+ cc.PrepareForTestOnLinuxBionic,
+ android.FixtureModifyConfig(func(config android.Config) {
+ config.Targets[android.LinuxBionic] = []android.Target{
+ {android.LinuxBionic, android.Arch{ArchType: android.X86_64}, android.NativeBridgeDisabled, "", "", false},
+ }
+ }),
+ ).RunTestWithBp(t, `
cc_defaults {
name: "mydefaults",
device_supported: false,
@@ -849,9 +857,7 @@
],
stl: "none",
}
- `, ccTestFs, []android.OsType{android.LinuxBionic})
-
- result := runTests(t, ctx, config)
+ `)
CheckSnapshot(result, "myexports", "",
checkUnversionedAndroidBpContents(`