File: everything

package info (click to toggle)
purity-off 0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 240 kB
  • sloc: sh: 42; makefile: 2
file content (55 lines) | stat: -rw-r--r-- 1,071 bytes parent folder | download
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
53
54
55
#!/bin/sh -e

if [ -z "$AUTOPKGTEST_TMP" ]; then
  AUTOPKGTEST_TMP=$(mktemp -d)  
  trap "rm -rf $AUTOPKGTEST_TMP" 0
fi
cd $AUTOPKGTEST_TMP

t() {
  local name="$1"
  local file="/usr/share/games/purity/$name"
  local rc=''

  if [ ! -e "$file" ]; then
    echo "FAILURE: $file is missing!" >&2
    exit 1
  fi

  perl -e 'print "y" x 100000' \
    | purity -a -l "$file" > output

  if [ "$rc" ]; then
    echo "FAILURE: purity failed for all 'yes' on $name!" >&2
    exit $rc
  fi

  if ! egrep -q "purity .+ 0\.00%" output; then
    cat output
    echo
    echo "FAILURE: unexpected purity output for all 'yes' on $name!" >&2
    exit 1
  fi

  perl -e 'print "n" x 100000' \
    | purity -a -l "$file" > output

  if [ "$rc" ]; then
    echo "FAILURE: purity failed for all 'no' on $name!" >&2
    exit $rc
  fi

  if ! egrep -q "purity .+ 100\.00%" output; then
    cat output
    echo
    echo "FAILURE: unexpected purity output for all 'no' on $name!" >&2
    exit 1
  fi

  echo "OK: $name"
}

for name in 100 1500 400 500 dabney new100 pt100; do
  t $name
done