aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/zip
diff options
context:
space:
mode:
authorGravatar Adam Michael <ajmichael@google.com>2016-09-21 17:39:10 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2016-09-22 09:53:08 +0000
commitabcca0cfe94e4eae0df9b0ba2d77aa80e5e7b012 (patch)
treeb1ac4ff7c966ccfad2b04fb52f54dcb2f377e984 /tools/zip
parent2e2b459aaff7e33d9a9fce6a89ef32634b99f439 (diff)
Add test for //tools/zip/zip_manifest_creator
-- MOS_MIGRATED_REVID=133847278
Diffstat (limited to 'tools/zip')
-rw-r--r--tools/zip/BUILD7
-rwxr-xr-xtools/zip/zip_manifest_creator_test.sh37
2 files changed, 44 insertions, 0 deletions
diff --git a/tools/zip/BUILD b/tools/zip/BUILD
index 09951bfa72..0703d7f3bb 100644
--- a/tools/zip/BUILD
+++ b/tools/zip/BUILD
@@ -21,3 +21,10 @@ sh_binary(
name = "zip_manifest_creator",
srcs = ["zip_manifest_creator.sh"],
)
+
+sh_test(
+ name = "zip_manifest_creator_test",
+ size = "small",
+ srcs = ["zip_manifest_creator_test.sh"],
+ data = [":zip_manifest_creator"],
+)
diff --git a/tools/zip/zip_manifest_creator_test.sh b/tools/zip/zip_manifest_creator_test.sh
new file mode 100755
index 0000000000..05dffd97a1
--- /dev/null
+++ b/tools/zip/zip_manifest_creator_test.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+# Copyright 2016 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+CUT=$(dirname "{BASH_SOURCE[0]}")/tools/zip/zip_manifest_creator.sh
+
+touch classes.jar
+touch AndroidManifest.xml
+mkdir -p res/values
+touch res/values/bar.xml
+touch res/values/baz.xml
+
+zip -q foo.zip classes.jar
+zip -q foo.zip AndroidManifest.xml
+zip -q foo.zip res/values/bar.xml
+zip -q foo.zip res/values/baz.xml
+
+$CUT 'res/.*' foo.zip actual.manifest
+
+cat <<EOT >> expected.manifest
+res/values/bar.xml
+res/values/baz.xml
+EOT
+
+cmp expected.manifest actual.manifest