aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zip2zip/zip2zip_test.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-06-23 13:00:17 -0700
committerColin Cross <ccross@android.com>2017-06-23 14:08:32 -0700
commit8936b02b58901cda6a14788a299d65f384b7b30d (patch)
treed17d3605964dd7036d2d94510a610f504fa47c24 /cmd/zip2zip/zip2zip_test.go
parent3e3e72da90ab94f0a763b6b53567ff335c9e1b3e (diff)
downloadbuild_soong-8936b02b58901cda6a14788a299d65f384b7b30d.tar.gz
build_soong-8936b02b58901cda6a14788a299d65f384b7b30d.tar.bz2
build_soong-8936b02b58901cda6a14788a299d65f384b7b30d.zip
Add jar sorting to zip2zip
Jars have a strange sorting order; the META-INF/ directory should come first, then META-INF/MANIFEST.MF, then any other files in META-INF/, and then any files outside META-INF. Add a -j argument to zip2zip that sorts using jar ordering. Test: zip2zip_test Change-Id: I80e2bc7e284ef74f6561c26cb6541298834db1bc
Diffstat (limited to 'cmd/zip2zip/zip2zip_test.go')
-rw-r--r--cmd/zip2zip/zip2zip_test.go32
1 files changed, 31 insertions, 1 deletions
diff --git a/cmd/zip2zip/zip2zip_test.go b/cmd/zip2zip/zip2zip_test.go
index 7f2e31a4..2b5b5623 100644
--- a/cmd/zip2zip/zip2zip_test.go
+++ b/cmd/zip2zip/zip2zip_test.go
@@ -28,6 +28,7 @@ var testCases = []struct {
inputFiles []string
sortGlobs bool
+ sortJava bool
args []string
outputFiles []string
@@ -116,6 +117,35 @@ var testCases = []struct {
},
},
{
+ name: "sort jar",
+
+ inputFiles: []string{
+ "MANIFEST.MF",
+ "META-INF/MANIFEST.MF",
+ "META-INF/aaa/",
+ "META-INF/aaa/aaa",
+ "META-INF/AAA",
+ "META-INF.txt",
+ "META-INF/",
+ "AAA",
+ "aaa",
+ },
+ sortJava: true,
+ args: nil,
+
+ outputFiles: []string{
+ "META-INF/",
+ "META-INF/MANIFEST.MF",
+ "META-INF/AAA",
+ "META-INF/aaa/",
+ "META-INF/aaa/aaa",
+ "AAA",
+ "MANIFEST.MF",
+ "META-INF.txt",
+ "aaa",
+ },
+ },
+ {
name: "double input",
inputFiles: []string{
@@ -161,7 +191,7 @@ func TestZip2Zip(t *testing.T) {
}
outputWriter := zip.NewWriter(outputBuf)
- err = zip2zip(inputReader, outputWriter, testCase.sortGlobs, false, testCase.args)
+ err = zip2zip(inputReader, outputWriter, testCase.sortGlobs, testCase.sortJava, false, testCase.args)
if errorString(testCase.err) != errorString(err) {
t.Fatalf("Unexpected error:\n got: %q\nwant: %q", errorString(err), errorString(testCase.err))
}