File: run_dump.sh

package info (click to toggle)
python-rarfile 4.2-3~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports-sloppy
  • size: 2,312 kB
  • sloc: python: 4,180; makefile: 186; sh: 59; awk: 14
file content (52 lines) | stat: -rwxr-xr-x 979 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/sh

PYTHON="$1"
tag="$2"

test -n "$tag" || { echo "usage: $0 PY TAG"; exit 1; }

PYTHONIOENCODING=utf8; export PYTHONIOENCODING
#PYTHONUTF8=1; export PYTHONUTF8

mkdir -p tmp
diffs="tmp/output.$tag.diffs"
rm -f "$diffs"

quiet=""
quiet="1"

vprintf=printf
vecho=echo

if test -n "$quiet"; then
  echo "[$tag] testing structure dump"
  vprintf=true
  vecho=true
fi

result=0
for f in test/files/*.rar; do
  $vprintf "%s -> %-30s .. " "$tag" "$f"
  "$PYTHON" dumprar.py -v -ppassword "$f" > "$f.$tag"
  if diff -uw "$f.exp" "$f.$tag" > /dev/null; then
    $vecho "ok"
    rm -f "$f.$tag"
  else
    $vecho "FAIL"
    errmsg="FAILED"
    case "$f" in
        *-hpsw.rar) errmsg="failed-nocrypto";;
        *) result=1;;
    esac
    if test -n "$quiet"; then
      printf "[%s] %-30s .. ${errmsg}\n" "$tag" "$f"
    fi
    echo "#### $py ####" >> "$diffs"
    diff -uw "$f.exp" "$f.$tag" >> "$diffs"
  fi
done

test "$result" = "0" || echo "Diffs: ${diffs}"

exit $result