File: helpers.sh

package info (click to toggle)
python-spython 0.3.13-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 736 kB
  • sloc: python: 3,299; sh: 61; makefile: 28
file content (25 lines) | stat: -rw-r--r-- 555 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
runTest() {

    # The first argument is the code we should get
    ERROR="${1:-}"
    shift
    OUTPUT=${1:-}
    shift

    "$@" > "${OUTPUT}" 2>&1
    RETVAL="$?"

    if [ "$ERROR" = "0" -a "$RETVAL" != "0" ]; then
        echo "$@ (retval=$RETVAL) ERROR"
        cat ${OUTPUT}
        echo "Output in ${OUTPUT}"
        exit 1
    elif [ "$ERROR" != "0" -a "$RETVAL" = "0" ]; then
        echo "$@ (retval=$RETVAL) ERROR"
        echo "Output in ${OUTPUT}"
        cat ${OUTPUT}
        exit 1
    else
        echo "$@ (retval=$RETVAL) OK"
    fi
}