summaryrefslogtreecommitdiff
path: root/sdk/java_sdk_test.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2021-03-21 22:01:55 +0000
committerPaul Duffin <paulduffin@google.com>2021-03-25 12:53:22 +0000
commitdb462dd9878e6d412139e853e2c1224caf7452a3 (patch)
tree8afb8fc0316e279834af1c18214747926e7bee97 /sdk/java_sdk_test.go
parent1822a0a3710e47fb97c84fc6c53f1b98b695f2e1 (diff)
Disallow non-existent paths in sdk package
Test behavior was changed a while ago so that tests by default ignore non-existent source paths (unless they explicitly check for/rely on them). Prior to that CheckSnapshot() could detect when files were missing from the snapshot but it no longer can. This change disallows non-existent source files in all the sdk tests which means that they are disallowed when processing the snapshots as they use the same preparers as were used to process the sources. This caused a test failure which has been temporarily ignored and has a TODO and bug associated with it. Bug: 183184375 Test: m nothing Change-Id: I969d8515d20ef5ae515f2b5f93d8ed4e4f8ede75
Diffstat (limited to 'sdk/java_sdk_test.go')
-rw-r--r--sdk/java_sdk_test.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index 6f78ded35..2bc248d22 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -24,6 +24,16 @@ import (
var prepareForSdkTestWithJava = android.GroupFixturePreparers(
java.PrepareForTestWithJavaBuildComponents,
PrepareForTestWithSdkBuildComponents,
+
+ // Ensure that all source paths are provided. This helps ensure that the snapshot generation is
+ // consistent and all files referenced from the snapshot's Android.bp file have actually been
+ // copied into the snapshot.
+ android.PrepareForTestDisallowNonExistentPaths,
+
+ // Files needs by most of the tests.
+ android.MockFS{
+ "Test.java": nil,
+ }.AddToFixture(),
)
var prepareForSdkTestWithJavaSdkLibrary = android.GroupFixturePreparers(
@@ -339,6 +349,7 @@ func TestSnapshotWithJavaImplLibrary(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil),
+ android.FixtureAddFile("resource.txt", nil),
).RunTestWithBp(t, `
module_exports {
name: "myexports",
@@ -394,7 +405,11 @@ aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
}
func TestSnapshotWithJavaBootLibrary(t *testing.T) {
- result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
+ result := android.GroupFixturePreparers(
+ prepareForSdkTestWithJava,
+ android.FixtureAddFile("aidl", nil),
+ android.FixtureAddFile("resource.txt", nil),
+ ).RunTestWithBp(t, `
module_exports {
name: "myexports",
java_boot_libs: ["myjavalib"],
@@ -1539,7 +1554,10 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_DoctagFiles(t *testing.T) {
- result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
+ result := android.GroupFixturePreparers(
+ prepareForSdkTestWithJavaSdkLibrary,
+ android.FixtureAddFile("docs/known_doctags", nil),
+ ).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],