Elliott Hughes | f276140 | 2019-11-15 15:07:00 -0800 | [diff] [blame] | 1 | # zipinfo tests. |
| 2 | |
| 3 | # Note: since "master key", Android uses libziparchive for all zip file |
| 4 | # handling, and that scans the whole central directory immediately. Not only |
| 5 | # lookups by name but also iteration is implemented using the resulting hash |
| 6 | # table, meaning that any test that makes assumptions about iteration order |
| 7 | # will fail on Android. |
| 8 | |
| 9 | name: zipinfo -1 |
| 10 | command: zipinfo -1 $FILES/example.zip | sort |
| 11 | expected-stdout: |
| 12 | d1/ |
| 13 | d1/d2/a.txt |
| 14 | d1/d2/b.txt |
| 15 | d1/d2/c.txt |
| 16 | d1/d2/dir/ |
| 17 | d1/d2/empty.txt |
| 18 | d1/d2/x.txt |
| 19 | --- |
| 20 | |
| 21 | name: zipinfo header |
| 22 | command: zipinfo $FILES/example.zip | head -2 |
| 23 | expected-stdout: |
| 24 | Archive: $FILES/example.zip |
| 25 | Zip file size: 1082 bytes, number of entries: 7 |
| 26 | --- |
| 27 | |
| 28 | name: zipinfo footer |
| 29 | command: zipinfo $FILES/example.zip | tail -1 |
| 30 | expected-stdout: |
| 31 | 7 files, 1033 bytes uncompressed, 20 bytes compressed: 98.1% |
| 32 | --- |
| 33 | |
| 34 | name: zipinfo directory |
| 35 | # The RI doesn't use ISO dates. |
| 36 | command: zipinfo $FILES/example.zip d1/ | sed s/17-Jun-/2017-06-/ |
| 37 | expected-stdout: |
| 38 | drwxr-x--- 3.0 unx 0 bx stor 2017-06-04 08:40 d1/ |
| 39 | --- |
| 40 | |
| 41 | name: zipinfo stored |
| 42 | # The RI doesn't use ISO dates. |
| 43 | command: zipinfo $FILES/example.zip d1/d2/empty.txt | sed s/17-Jun-/2017-06-/ |
| 44 | expected-stdout: |
| 45 | -rw-r----- 3.0 unx 0 bx stor 2017-06-04 08:43 d1/d2/empty.txt |
| 46 | --- |
| 47 | |
| 48 | name: zipinfo deflated |
| 49 | # The RI doesn't use ISO dates. |
| 50 | command: zipinfo $FILES/example.zip d1/d2/x.txt | sed s/17-Jun-/2017-06-/ |
| 51 | expected-stdout: |
| 52 | -rw-r----- 3.0 unx 1024 tx defN 2017-06-04 08:45 d1/d2/x.txt |
| 53 | --- |