I'm switching to a new laptop, and found this from 2017-07. I think
these are the tests used for the Android libziparchive-based unzip.
They pass on the host.
---
tests/files/zip/d1/d2/a.txt | 1 +
tests/files/zip/d1/d2/b.txt | 1 +
tests/files/zip/d1/d2/c.txt | 1 +
tests/files/zip/d1/d2/empty.txt | 0
tests/files/zip/d1/d2/x.txt | 1 +
tests/files/zip/example.zip | Bin 0 -> 1082 bytes
tests/unzip.test | 86 ++++++++++++++++++++++++++++++++
7 files changed, 90 insertions(+)
create mode 100644 tests/files/zip/d1/d2/a.txt
create mode 100644 tests/files/zip/d1/d2/b.txt
create mode 100644 tests/files/zip/d1/d2/c.txt
create mode 100644 tests/files/zip/d1/d2/empty.txt
create mode 100644 tests/files/zip/d1/d2/x.txt
create mode 100644 tests/files/zip/example.zip
create mode 100755 tests/unzip.test
From ba670f9ab79def4b32c2cc841407ba5cd1343dc8 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Thu, 24 Jan 2019 10:31:51 -0800
Subject: [PATCH] unzip tests.
I'm switching to a new laptop, and found this from 2017-07. I think
these are the tests used for the Android libziparchive-based unzip.
They pass on the host.
---
tests/files/zip/d1/d2/a.txt | 1 +
tests/files/zip/d1/d2/b.txt | 1 +
tests/files/zip/d1/d2/c.txt | 1 +
tests/files/zip/d1/d2/empty.txt | 0
tests/files/zip/d1/d2/x.txt | 1 +
tests/files/zip/example.zip | Bin 0 -> 1082 bytes
tests/unzip.test | 86 ++++++++++++++++++++++++++++++++
7 files changed, 90 insertions(+)
create mode 100644 tests/files/zip/d1/d2/a.txt
create mode 100644 tests/files/zip/d1/d2/b.txt
create mode 100644 tests/files/zip/d1/d2/c.txt
create mode 100644 tests/files/zip/d1/d2/empty.txt
create mode 100644 tests/files/zip/d1/d2/x.txt
create mode 100644 tests/files/zip/example.zip
create mode 100755 tests/unzip.test
diff --git a/tests/files/zip/d1/d2/a.txt b/tests/files/zip/d1/d2/a.txt
new file mode 100644
index 00000000..78981922
--- /dev/null
+++ b/tests/files/zip/d1/d2/a.txt
@@ -0,0 +1 @@
+a
diff --git a/tests/files/zip/d1/d2/b.txt b/tests/files/zip/d1/d2/b.txt
new file mode 100644
index 00000000..e0b3f1b0
--- /dev/null
+++ b/tests/files/zip/d1/d2/b.txt
@@ -0,0 +1 @@
+bb
diff --git a/tests/files/zip/d1/d2/c.txt b/tests/files/zip/d1/d2/c.txt
new file mode 100644
index 00000000..b2a75466
--- /dev/null
+++ b/tests/files/zip/d1/d2/c.txt
@@ -0,0 +1 @@
+ccc
diff --git a/tests/files/zip/d1/d2/empty.txt b/tests/files/zip/d1/d2/empty.txt
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/files/zip/d1/d2/x.txt b/tests/files/zip/d1/d2/x.txt
new file mode 100644
index 00000000..c6a9d2f1
--- /dev/null
+++ b/tests/files/zip/d1/d2/x.txt
@@ -0,0 +1 @@
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
\ No newline at end of file
diff --git a/tests/files/zip/example.zip b/tests/files/zip/example.zip
new file mode 100644
index 0000000000000000000000000000000000000000..c3292e929d466733eb5b9106047a53900cfad380
GIT binary patch
literal 1082
zcmaLWF-yZh6bJB2lUPjz1zYH#A_zhiES9VeB4V{mhAPBCY!VR>L8L-D3Jwl_0w={q
z5Cp%2gM+)1tB5#AH#h$;NiWCcYQk&U;eLI0?;p3R8y2I>UVGk*zoZ{Jn`GfqZL2lH
z^pC3JQJqCL(~Rnj#*E7e#$3L*jK#&<ulE8LQ`yPluwH8~cA`#<`~skokhYaE>tGJ%
zMs*zoRmS+7*`9YiDv9xZ!P$V*n_c}jU{GaFz?~f!RFV?}fdCyzhcd?ZwSRol>2mBE
z5S4_{&Pw?IVfF+l_<3vC_(d&c9Yq|OT5von33<4$n0I@ntCo1+FH&O`Z!A1KO@`J0
zMI~`=Q!7mCgJxc#{&0=6&lP&c2{4lc`~&6ZpFkRjoAc!a%F+N(kp!``d=f<Pf`e%;
z04g#eg84{@;425yfB;m4Lj?2D=${>Jxs09T?674aC_t4Vp@9sFiP+^XN7K*%R0Kxs
gGM|%vmo(u=4koFAr%a4Fg!5rV+;zO&J(?=}1CW}sMF0Q*
literal 0
HcmV?d00001
diff --git a/tests/unzip.test b/tests/unzip.test
new file mode 100755
index 00000000..7e4c5bc2
--- /dev/null
+++ b/tests/unzip.test
@@ -0,0 +1,86 @@
+#!/bin/bash
+
+[ -f testing.sh ] && . testing.sh
+
+#testing "name" "command" "result" "infile" "stdin"
+
+# Note: since "master key", Android uses libziparchive for all zip file
+# handling, and that scans the whole central directory immediately. Not only
+# lookups by name but also iteration is implemented using the resulting hash
+# table, meaning that any test that makes assumptions about iteration order
+# will fail on Android.
+
+# unzip -l
+testing "-l" "unzip -l $FILES/zip/example.zip d1/d2/x.txt && [ ! -f d1/d2/x.txt ] && echo okay" "\
+Archive: $FILES/zip/example.zip\n\
+ Length Date Time Name\n\
+--------- ---------- ----- ----\n\
+ 1024 2017-06-04 08:45 d1/d2/x.txt\n\
+--------- -------\n\
+ 1024 1 file\n\
+okay\n" "" ""
+
+# unzip -lq
+testing "-lq" "unzip -lq $FILES/zip/example.zip d1/d2/x.txt && [ ! -f d1/d2/x.txt ] && echo okay" "\
+ Length Date Time Name\n\
+--------- ---------- ----- ----\n\
+ 1024 2017-06-04 08:45 d1/d2/x.txt\n\
+--------- -------\n\
+ 1024 1 file\n\
+okay\n" "" ""
+
+# unzip -lv
+testing "-lv" "unzip -lv $FILES/zip/example.zip d1/d2/x.txt && [ ! -f d1/d2/file ] && echo okay" "\
+Archive: $FILES/zip/example.zip\n\
+ Length Method Size Cmpr Date Time CRC-32 Name\n\
+-------- ------ ------- ---- ---------- ----- -------- ----\n\
+ 1024 Defl:N 11 99% 2017-06-04 08:45 48d7f063 d1/d2/x.txt\n\
+-------- ------- --- -------\n\
+ 1024 11 99% 1 file\n\
+okay\n" "" ""
+
+# unzip -v
+testing "-v" "unzip -v $FILES/zip/example.zip d1/d2/x.txt && [ ! -f d1/d2/file ] && echo okay" "\
+Archive: $FILES/zip/example.zip\n\
+ Length Method Size Cmpr Date Time CRC-32 Name\n\
+-------- ------ ------- ---- ---------- ----- -------- ----\n\
+ 1024 Defl:N 11 99% 2017-06-04 08:45 48d7f063 d1/d2/x.txt\n\
+-------- ------- --- -------\n\
+ 1024 11 99% 1 file\n\
+okay\n" "" ""
+
+# unzip
+testing "one file" "unzip -q $FILES/zip/example.zip d1/d2/a.txt && [ ! -f d1/d2/b.txt ] && cat d1/d2/a.txt" "a\n" "" ""
+rm -rf d1
+testing "all files" "unzip -q $FILES/zip/example.zip && [ -f d1/d2/a.txt ] && [ -f d1/d2/b.txt ] && [ -f d1/d2/c.txt ] && [ -f d1/d2/empty.txt ] && [ -f d1/d2/x.txt ] && [ -d d1/d2/dir ] && echo okay" "okay\n" "" ""
+rm -rf d1
+
+# unzip -o
+mkdir -p d1/d2
+echo b > d1/d2/a.txt
+testing "-o" "unzip -q -o $FILES/zip/example.zip d1/d2/a.txt && cat d1/d2/a.txt" "a\n" "" ""
+rm -rf d1
+
+# unzip -n
+mkdir -p d1/d2
+echo b > d1/d2/a.txt
+testing "-n" "unzip -q -n $FILES/zip/example.zip d1/d2/a.txt && cat d1/d2/a.txt" "b\n" "" ""
+rm -rf d1
+
+# unzip -d DIR
+testing "-d non-existent" "unzip -q -d will/not/be/created $FILES/zip/example.zip d1/d2/a.txt 2> /dev/null ; [ ! -d will ] && echo okay" "okay\n" "" ""
+mkdir dir
+testing "-d exists" "unzip -q -d dir $FILES/zip/example.zip d1/d2/a.txt && [ ! -f d1/d2/a.txt ] && cat dir/d1/d2/a.txt" "a\n" "" ""
+rm -rf dir
+
+# unzip -p
+testing "-p" "unzip -p $FILES/zip/example.zip d1/d2/a.txt && [ ! -f d1/d2/a.txt ] && echo okay" "a\nokay\n" "" ""
+
+# unzip -x FILE...
+# Note: the RI ignores -x DIR for some reason, but it's not obvious we should.
+testing "-x FILE..." "unzip -q $FILES/zip/example.zip -x d1/d2/a.txt d1/d2/b.txt d1/d2/empty.txt d1/d2/x.txt && [ ! -f d1/d2/a.txt ] && [ ! -f d1/d2/b.txt ] && [ ! -f d1/d2/empty.txt ] && [ ! -f d1/d2/x.txt ] && [ -d d1/d2/dir ] && cat d1/d2/c.txt" "ccc\n" "" ""
+rm -rf d1
+
+# unzip FILE -x FILE...
+testing "FILE... -x FILE..." "unzip -q $FILES/zip/example.zip d1/d2/a.txt d1/d2/b.txt -x d1/d2/a.txt && [ ! -f d1/d2/a.txt ] && [ -f d1/d2/b.txt ] && [ ! -f d1/d2/c.txt ] && [ ! -f d1/d2/empty.txt ] && [ ! -f d1/d2/x.txt ] && [ ! -d d1/d2/dir ] && cat d1/d2/b.txt" "bb\n" "" ""
+rm -rf d1
--
2.20.1.321.g9e740568ce-goog
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net