File: testsuite

package info (click to toggle)
pmccabe 2.8-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 876 kB
  • sloc: ansic: 3,084; cpp: 1,080; sh: 401; makefile: 42
file content (87 lines) | stat: -rwxr-xr-x 1,119 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh

PMCCABE=${PMCCABE:-../pmccabe}

testlist='
	test000
	test001
	test002
	test003
	test004
	test005
	test006/*.H
	test007
	test008
	test009
	test010
	test011
	test012
	test013
	test014
	test015
	test016
	test017
	test018
	test019
	test020
	test021
	test022
	test023
	test024
	test025
	test026
	test027'

testlist=`echo $testlist`

error=0

# record the command and output
# save stderr separately to prevent buffering/interlace ordering problems
run_pmccabe()
{
    echo "RUN: pmccabe $@"
    $PMCCABE "$@" 2>.tmp
    rc=$?
    if [ "$rc" != 0 ]
    then
	echo "FAIL: exit code $rc when running $PMCCABE $@" >&2
	error=$rc
    fi
    cat .tmp
    rm .tmp
}

TEST1()
{
    f=$1
    shift

    (
	run_pmccabe -X -vt $*
	run_pmccabe -X -vnt $*
	run_pmccabe -x -vt $*
    ) > $f.out

    if [ -f $f.ref -a -z "$REFERENCE" ]
    then
	if ! cmp $f.ref $f.out
        then
	    error=2
	    echo "FAIL: self-test $f failed" >&2
	    diff $f.ref $f.out
	fi
    else
	echo "Creating new REFERENCE file $f.ref"
	mv $f.out $f.ref
    fi
}

TEST1 testlist $testlist

for n in $testlist
do
    TEST1 $n $n
done

exit $error