File: runtest.sh

package info (click to toggle)
tinyssh 20250501-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,388 kB
  • sloc: ansic: 20,245; sh: 1,582; python: 1,449; makefile: 913
file content (30 lines) | stat: -rw-r--r-- 455 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
#!/bin/sh

LANG=C
export LANG

[ x"$1" = x ] && exit 100
script="$1"
[ x"$2" = x ] && exit 100
outfile="$2"
[ x"$3" = x ] && exit 100
expfile="$3"

# run test
sh "${script}" > "${outfile}"

# compare
if ! cmp "${expfile}" "${outfile}"; then
  echo "${script} FAILED"
  if [ x"`which diff`" != x ]; then
    # print diff
    diff -u "${expfile}" "${outfile}"
  else
    # print output file
    cat "${outfile}"
  fi
  exit 1
fi

echo "${script} OK"
exit 0