File: testlib

package info (click to toggle)
filtergen 0.12.8-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,924 kB
  • sloc: sh: 5,485; ansic: 4,268; yacc: 692; lex: 362; makefile: 165
file content (65 lines) | stat: -rwxr-xr-x 1,052 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
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*- sh -*-
# source this file for a few useful functions that get repeated at the top
# of every test

here=`pwd`
if test $? -ne 0 ; then exit 77 ; fi

work=${TMP_DIR-/tmp}/filtergen-test-$$

pass () {
    set +x
    cd $here
    rm -rf $work
    exit 0
}

fail () {
    set +x
    cd $here
    rm -rf $work
    echo "FAILED testing $TEST"
    exit 1
}

no_result () {
    set +x
    cd $here
    rm -rf $work
    echo "NO RESULT when testing $TEST"
    #exit 77
    exit 1
}

trap no_result 1 2 3 15

# function for comparing files
compare () {
    cmp "$1" "$2" >/dev/null 2>&1
    case "$?" in
	0)
	    ;;
	1)
	    diff -u "$1" "$2"
	    fail
	    ;;
	*)
	    no_result
	    ;;
    esac
}

mkdir $work
if test $? -ne 0 ; then no_result ; fi

# srcdir gets defined by the automake test caller, assume it's not defined
# by the user's environment, so set debug trace on when run manually
test "x$srcdir" = "x" && set -x

# fix testdir
testdir=`pwd`/$testdir

if test -d $testdir/t/data ; then
	echo "testlib error: testdir not in $testdir"
	fail
fi