nelhage / bemu

A just-in-time compiler for MIT 6.004's "Beta" processor.

This URL has Read+Write access

bemu / run-tests.sh
100755 63 lines (55 sloc) 1.679 kb
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
#!/bin/bash
BEMU=./bemu
OPTIONS=""
NONDET=0 # Set for tests that are nondeterministic
FAIL=
 
run_one() {
    file="$1"
 
    bt_run=$($BEMU -o "$OPTIONS" -d "tests/$file.bin" 2>&1)
    err="$?"
    if [ -z "$FAIL" -a "$err" -ne 0 ]; then
echo "[$file] FAIL: return code $err" >&2
        echo "$bt_run";
        exit 1;
    fi
em_run=$($BEMU -o "$OPTIONS" -de "tests/$file.bin" 2>&1)
 
    shift
while [ $# -gt 0 ]; do
expect="$1"
        shift
if ! echo "$bt_run" | grep -qF "$expect"; then
echo "[$file] FAIL: Expecting: '$expect'" >&2
            echo "$bt_run";
            exit 1;
        fi
done
 
if [ -z "$NONDET" -a "$bt_run" != "$em_run" ]; then
echo "[$file] FAIL: BT and emulation mismatch" >&2
        echo "[BT result]"
        echo "$bt_run"
        echo "[Emulation result]"
        echo "$em_run"
        exit 1;
    fi
 
echo "[$file] OK"
}
 
run_one sancheck "[00] 800003b8 [01] 00000718 [02] 00000718 [03] 00000718"
OPTIONS=clock
run_one litmus 'All tests PASSED!'
OPTIONS=
run_one bench1 "[00] 00000001 [01] 00000367 [02] 00000001 [03] 00000367"
run_one bench2 "[80000048] Done" "[00] 00000001 [01] 00000000 [02] 00000000 [03] 00000000"
run_one bench3 "[80000c38] Done" "[28] 80000c3c [29] 00000000 [30] 00000000 [31] 00000000"
run_one bench4 "[00] 991727a0 [01] 5096a491 [02] 00000000 [03] 00000000"
run_one supervisor "[00] ffffabcd"
run_one align "[00] ffffabcd"
run_one qsort "[00] 00001111"
run_one jmptab "[00] 00000007" "Hello."
NONDET=1
FAIL=1
run_one trap "Illegal memory reference"
 
ulimit -t 2
OPTIONS="clock"
NONDET=
FAIL=
run_one timer "[00] ffffabcd"