diff options
| -rwxr-xr-x | tests/setup.sh | 2 | ||||
| -rwxr-xr-x | tests/t0107-snapshot.sh | 42 |
2 files changed, 43 insertions, 1 deletions
diff --git a/tests/setup.sh b/tests/setup.sh index 69e47e6..334cca6 100755 --- a/tests/setup.sh +++ b/tests/setup.sh | |||
| @@ -104,7 +104,7 @@ virtual-root=/ | |||
| 104 | cache-root=$PWD/cache | 104 | cache-root=$PWD/cache |
| 105 | 105 | ||
| 106 | cache-size=1021 | 106 | cache-size=1021 |
| 107 | snapshots=tar.gz tar.bz tar.lz zip | 107 | snapshots=tar.gz tar.bz tar.lz tar.xz zip |
| 108 | enable-log-filecount=1 | 108 | enable-log-filecount=1 |
| 109 | enable-log-linecount=1 | 109 | enable-log-linecount=1 |
| 110 | summary-log=5 | 110 | summary-log=5 |
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh index a845ad9..84995d1 100755 --- a/tests/t0107-snapshot.sh +++ b/tests/t0107-snapshot.sh | |||
| @@ -80,6 +80,48 @@ test_expect_success LZIP 'verify untarred file-5' ' | |||
| 80 | test_line_count = 1 master/file-5 | 80 | test_line_count = 1 master/file-5 |
| 81 | ' | 81 | ' |
| 82 | 82 | ||
| 83 | if test -n "$(which xz 2>/dev/null)"; then | ||
| 84 | test_set_prereq XZ | ||
| 85 | else | ||
| 86 | say 'Skipping XZ validation tests: xz not found' | ||
| 87 | fi | ||
| 88 | |||
| 89 | test_expect_success XZ 'get foo/snapshot/master.tar.xz' ' | ||
| 90 | cgit_url "foo/snapshot/master.tar.xz" >tmp | ||
| 91 | ' | ||
| 92 | |||
| 93 | test_expect_success XZ 'check html headers' ' | ||
| 94 | head -n 1 tmp | | ||
| 95 | grep "Content-Type: application/x-xz" && | ||
| 96 | |||
| 97 | head -n 2 tmp | | ||
| 98 | grep "Content-Disposition: inline; filename=.master.tar.xz." | ||
| 99 | ' | ||
| 100 | |||
| 101 | test_expect_success XZ 'strip off the header lines' ' | ||
| 102 | strip_headers <tmp >master.tar.xz | ||
| 103 | ' | ||
| 104 | |||
| 105 | test_expect_success XZ 'verify xz format' ' | ||
| 106 | xz --test master.tar.xz && | ||
| 107 | cp master.tar.xz /tmp/. | ||
| 108 | ' | ||
| 109 | |||
| 110 | test_expect_success XZ 'untar' ' | ||
| 111 | rm -rf master && | ||
| 112 | tar --xz -xf master.tar.xz | ||
| 113 | ' | ||
| 114 | |||
| 115 | test_expect_success XZ 'count files' ' | ||
| 116 | ls master/ >output && | ||
| 117 | test_line_count = 5 output | ||
| 118 | ' | ||
| 119 | |||
| 120 | test_expect_success XZ 'verify untarred file-5' ' | ||
| 121 | grep "^5$" master/file-5 && | ||
| 122 | test_line_count = 1 master/file-5 | ||
| 123 | ' | ||
| 124 | |||
| 83 | test_expect_success 'get foo/snapshot/master.zip' ' | 125 | test_expect_success 'get foo/snapshot/master.zip' ' |
| 84 | cgit_url "foo/snapshot/master.zip" >tmp | 126 | cgit_url "foo/snapshot/master.zip" >tmp |
| 85 | ' | 127 | ' |
