apex: fix a test util (ensureExactContents)
ensureExactContents shouldn't return immediately when it finds a match
from expected list of files.
Bug: 151491839
Test: m nothing
Merged-In: Ie15c811f9cfcae7ede28dee0fcf203cee24659a0
Change-Id: Ie15c811f9cfcae7ede28dee0fcf203cee24659a0
(cherry picked from commit e6436d7bf08c81032c54690e465026f858f30fdb)
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 3532027..698fdc8 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -1828,13 +1828,17 @@
var surplus []string
filesMatched := make(map[string]bool)
for _, file := range getFiles(t, ctx, moduleName, variant) {
+ mactchFound := false
for _, expected := range files {
if matched, _ := path.Match(expected, file.path); matched {
filesMatched[expected] = true
- return
+ mactchFound = true
+ break
}
}
- surplus = append(surplus, file.path)
+ if !mactchFound {
+ surplus = append(surplus, file.path)
+ }
}
if len(surplus) > 0 {
@@ -1901,8 +1905,10 @@
ensureExactContents(t, ctx, "myapex", "android_common_image", []string{
"lib/libvndk.so",
"lib/libvndksp.so",
+ "lib/libc++.so",
"lib64/libvndk.so",
"lib64/libvndksp.so",
+ "lib64/libc++.so",
"etc/llndk.libraries.VER.txt",
"etc/vndkcore.libraries.VER.txt",
"etc/vndksp.libraries.VER.txt",
@@ -1962,6 +1968,8 @@
"lib/libvndk.so",
"lib/libvndk.arm.so",
"lib64/libvndk.so",
+ "lib/libc++.so",
+ "lib64/libc++.so",
"etc/*",
})
}
@@ -2173,6 +2181,8 @@
ensureExactContents(t, ctx, "myapex", "android_common_image", []string{
"lib/libvndk.so",
"lib64/libvndk.so",
+ "lib/libc++.so",
+ "lib64/libc++.so",
"etc/*",
})
}