summaryrefslogtreecommitdiff
path: root/filesystem/filesystem_test.go
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-05-16 00:33:24 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-05-16 00:33:24 +0000
commitc6541077deff038a0da3b944b06f919609405264 (patch)
tree27b8a37982bd51bbc4a00dfa152f764c8882ed2f /filesystem/filesystem_test.go
parent277e444cb3184824580d4a09b0bdc591159f2d17 (diff)
parentc6a773df6493ac4697d9e6ad244028a54eceabec (diff)
Merge "Filter-out deps of unsupported arch" into main
Diffstat (limited to 'filesystem/filesystem_test.go')
-rw-r--r--filesystem/filesystem_test.go67
1 files changed, 67 insertions, 0 deletions
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index 861918f16..015d39aab 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -497,3 +497,70 @@ func TestTrackPhonyAsRequiredDep(t *testing.T) {
android.AssertStringListContains(t, "missing entry", fs.entries, e)
}
}
+
+func TestFilterOutUnsupportedArches(t *testing.T) {
+ result := fixture.RunTestWithBp(t, `
+ android_filesystem {
+ name: "fs_64_only",
+ deps: ["foo"],
+ }
+
+ android_filesystem {
+ name: "fs_64_32",
+ compile_multilib: "both",
+ multilib: {
+ first: {
+ deps: ["foo"],
+ },
+ },
+ }
+
+ cc_binary {
+ name: "foo",
+ required: ["phony"],
+ }
+
+ phony {
+ name: "phony",
+ required: [
+ "libbar",
+ "app",
+ ],
+ }
+
+ cc_library {
+ name: "libbar",
+ }
+
+ android_app {
+ name: "app",
+ srcs: ["a.java"],
+ platform_apis: true,
+ }
+ `)
+ testcases := []struct {
+ fsName string
+ expected []string
+ unexpected []string
+ }{
+ {
+ fsName: "fs_64_only",
+ expected: []string{"app/app/app.apk", "bin/foo", "lib64/libbar.so"},
+ unexpected: []string{"lib/libbar.so"},
+ },
+ {
+ fsName: "fs_64_32",
+ expected: []string{"app/app/app.apk", "bin/foo", "lib64/libbar.so", "lib/libbar.so"},
+ unexpected: []string{},
+ },
+ }
+ for _, c := range testcases {
+ fs := result.ModuleForTests(c.fsName, "android_common").Module().(*filesystem)
+ for _, e := range c.expected {
+ android.AssertStringListContains(t, "missing entry", fs.entries, e)
+ }
+ for _, e := range c.unexpected {
+ android.AssertStringListDoesNotContain(t, "unexpected entry", fs.entries, e)
+ }
+ }
+}