summaryrefslogtreecommitdiffstats
path: root/test
blob: f8fc26ceda43358423cffdb9b82796d762f65e64 (plain) (blame)
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
#!/bin/sh

# Every test file must start with a line formatted as follows:
#   #:<exit code>:<additional makel command line options>

nfails=0
for f in tests/*.mk; do
    header=$(head -n1 "$f")
    exp=$(echo "$header" | cut -d: -f2)
    options=$(echo "$header" | cut -d: -f3)
    ./makel -f$f $options 2>/dev/null 1>/dev/null
    got=$?
    if [ $got -lt $exp ]; then
        echo "$f: defect was not detected (expected $exp, got $got)"
        nfails=$((nfails+1))
    fi
    if [ $got -gt $exp ]; then
        echo "$f: found more serious defects than expected (expected $exp, got $got)"
        nfails=$((nfails+1))
    fi
done
if [ $nfails -gt 0 ]; then
    echo "----------"
    echo "$nfails tests returned different exit codes than expected."
fi