summaryrefslogtreecommitdiff
path: root/java/testing.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-03-13 22:19:17 +0000
committer Paul Duffin <paulduffin@google.com> 2021-03-14 01:08:26 +0000
commitbf028b533d2f5fa59879876206071338af429cd7 (patch)
treef637035e2d2740b3582d2e3c38130c741ed811c3 /java/testing.go
parent6bac49c560e9aecd7c90550bc38c0270351aa33b (diff)
Extract PrepareForTestWithJavaSdkLibraryFiles from javaMockFS()
Needed for tests in both java and sdk packages. Bug: 182638834 Test: m nothing Change-Id: Ia8c5e7db47d8b63bf8dcf2965b3af60a4d35a9e5
Diffstat (limited to 'java/testing.go')
-rw-r--r--java/testing.go30
1 files changed, 17 insertions, 13 deletions
diff --git a/java/testing.go b/java/testing.go
index 4e1997e45..a1404a5ae 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -61,27 +61,30 @@ var PrepareForIntegrationTestWithJava = android.GroupFixturePreparers(
PrepareForTestWithJavaDefaultModules,
)
+// Prepare a fixture with the standard files required by a java_sdk_library module.
+var PrepareForTestWithJavaSdkLibraryFiles = android.FixtureMergeMockFs(javaSdkLibraryFiles)
+
+var javaSdkLibraryFiles = android.MockFS{
+ "api/current.txt": nil,
+ "api/removed.txt": nil,
+ "api/system-current.txt": nil,
+ "api/system-removed.txt": nil,
+ "api/test-current.txt": nil,
+ "api/test-removed.txt": nil,
+ "api/module-lib-current.txt": nil,
+ "api/module-lib-removed.txt": nil,
+ "api/system-server-current.txt": nil,
+ "api/system-server-removed.txt": nil,
+}
+
func javaMockFS() android.MockFS {
mockFS := android.MockFS{
- "api/current.txt": nil,
- "api/removed.txt": nil,
- "api/system-current.txt": nil,
- "api/system-removed.txt": nil,
- "api/test-current.txt": nil,
- "api/test-removed.txt": nil,
-
"prebuilts/sdk/tools/core-lambda-stubs.jar": nil,
"prebuilts/sdk/Android.bp": []byte(`prebuilt_apis { name: "sdk", api_dirs: ["14", "28", "30", "current"], imports_sdk_version: "none", imports_compile_dex:true,}`),
"bin.py": nil,
python.StubTemplateHost: []byte(`PYTHON_BINARY = '%interpreter%'
MAIN_FILE = '%main%'`),
-
- // For java_sdk_library
- "api/module-lib-current.txt": nil,
- "api/module-lib-removed.txt": nil,
- "api/system-server-current.txt": nil,
- "api/system-server-removed.txt": nil,
}
levels := []string{"14", "28", "29", "30", "current"}
@@ -101,6 +104,7 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
bp += GatherRequiredDepsForTest()
mockFS := javaMockFS()
+ mockFS.Merge(javaSdkLibraryFiles)
cc.GatherRequiredFilesForTest(mockFS)