Some docstring fixes.
[rarfile.git] / test / run_dump.sh
blobbf97f77606737cf2ecf89f2661297932561e4216
1 #! /bin/sh
3 PYTHON="$1"
4 tag="$2"
6 test -n "$tag" || { echo "usage: $0 PY TAG"; exit 1; }
8 PYTHONIOENCODING=utf8; export PYTHONIOENCODING
9 #PYTHONUTF8=1; export PYTHONUTF8
11 mkdir -p tmp
12 diffs="tmp/output.$tag.diffs"
13 rm -f "$diffs"
15 quiet=""
16 quiet="1"
18 vprintf=printf
19 vecho=echo
21 if test -n "$quiet"; then
22 echo "[$tag] testing structure dump"
23 vprintf=true
24 vecho=true
27 result=0
28 for f in test/files/*.rar; do
29 $vprintf "%s -> %-30s .. " "$tag" "$f"
30 "$PYTHON" dumprar.py -v -ppassword "$f" > "$f.$tag"
31 if diff -uw "$f.exp" "$f.$tag" > /dev/null; then
32 $vecho "ok"
33 rm -f "$f.$tag"
34 else
35 $vecho "FAIL"
36 errmsg="FAILED"
37 case "$f" in
38 *-hpsw.rar) errmsg="failed-nocrypto";;
39 *) result=1;;
40 esac
41 if test -n "$quiet"; then
42 printf "[%s] %-30s .. ${errmsg}\n" "$tag" "$f"
44 echo "#### $py ####" >> "$diffs"
45 diff -uw "$f.exp" "$f.$tag" >> "$diffs"
47 done
49 test "$result" = "0" || echo "Diffs: ${diffs}"
51 exit $result