summaryrefslogtreecommitdiff
path: root/zip/zip_test.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2020-08-19 13:51:47 -0700
committer Colin Cross <ccross@android.com> 2020-08-19 21:18:56 +0000
commit053fca10c935b50cf803abdcff991ea574f2a2fc (patch)
tree0bfdba7df03588405a2d73a13b9e18bd39f3b99a /zip/zip_test.go
parent2d815963ba597cce3b2401d405d0ed3a7beb5737 (diff)
Support ninja rsp files in soong_zip
Add a -r argument to soong_zip that reads a list of files from a file like the -l argument but treats it as a Ninja rsp file with escaping. Replace the -l arguments in Soong that are using rsp files with -r. Fixes: 162435077 Test: TestReadRespFile, TestZip Change-Id: I4605312e99406ab1bd0c37af9c5ad212393f0403
Diffstat (limited to 'zip/zip_test.go')
-rw-r--r--zip/zip_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/zip/zip_test.go b/zip/zip_test.go
index 9705d6c49..302a749a3 100644
--- a/zip/zip_test.go
+++ b/zip/zip_test.go
@@ -49,6 +49,9 @@ var mockFs = pathtools.MockFs(map[string][]byte{
"l_nl": []byte("a/a/a\na/a/b\nc\n"),
"l_sp": []byte("a/a/a a/a/b c"),
"l2": []byte("missing\n"),
+ "rsp": []byte("'a/a/a'\na/a/b\n'@'\n'foo'\\''bar'"),
+ "@ -> c": nil,
+ "foo'bar -> c": nil,
"manifest.txt": fileCustomManifest,
})
@@ -247,6 +250,19 @@ func TestZip(t *testing.T) {
},
},
{
+ name: "rsp",
+ args: fileArgsBuilder().
+ RspFile("rsp"),
+ compressionLevel: 9,
+
+ files: []zip.FileHeader{
+ fh("a/a/a", fileA, zip.Deflate),
+ fh("a/a/b", fileB, zip.Deflate),
+ fh("@", fileC, zip.Deflate),
+ fh("foo'bar", fileC, zip.Deflate),
+ },
+ },
+ {
name: "prefix in zip",
args: fileArgsBuilder().
PathPrefixInZip("foo").
@@ -568,6 +584,11 @@ func TestReadRespFile(t *testing.T) {
in: `./cmd "\""-C`,
out: []string{"./cmd", `"-C`},
},
+ {
+ name: "ninja rsp file",
+ in: "'a'\nb\n'@'\n'foo'\\''bar'\n'foo\"bar'",
+ out: []string{"a", "b", "@", "foo'bar", `foo"bar`},
+ },
}
for _, testCase := range testCases {