-
Notifications
You must be signed in to change notification settings - Fork 22
/
test.sh
executable file
·116 lines (104 loc) · 2.1 KB
/
test.sh
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
echo "==== Building rvc ===="
make clean
intercept-build make
CLEAN="$2"
function run_test {
pushd ./riscv-tests/isa
# rm "$1"
# rm "$1.text"
if [ ! -f "$1" ] || [ -n "$CLEAN" ]; then
make "$1"
fi
# riscv64-unknown-elf-objcopy -j .text.init -O binary "$1" "$1.text"
popd
echo "Running: ./rvc -x -e \"./riscv-tests/isa/$1\" -v 1"
./rvc -x -e "./riscv-tests/isa/$1" -v 1
if [ $? -gt 0 ]; then
echo "Test failed!"
exit $?
fi
}
if [ "$1" == "all" ]; then
TESTS="rv32ui-p-add
rv32ui-p-addi
rv32ui-p-and
rv32ui-p-andi
rv32ui-p-auipc
rv32ui-p-beq
rv32ui-p-bge
rv32ui-p-bgeu
rv32ui-p-blt
rv32ui-p-bltu
rv32ui-p-bne
rv32ui-p-fence_i
rv32ui-p-jal
rv32ui-p-jalr
rv32ui-p-lb
rv32ui-p-lbu
rv32ui-p-lh
rv32ui-p-lhu
rv32ui-p-lui
rv32ui-p-lw
rv32ui-p-or
rv32ui-p-ori
rv32ui-p-sb
rv32ui-p-sh
rv32ui-p-simple
rv32ui-p-sll
rv32ui-p-slli
rv32ui-p-slt
rv32ui-p-slti
rv32ui-p-sltiu
rv32ui-p-sltu
rv32ui-p-sra
rv32ui-p-srai
rv32ui-p-srl
rv32ui-p-srli
rv32ui-p-sub
rv32ui-p-sw
rv32ui-p-xor
rv32ui-p-xori
rv32um-p-div
rv32um-p-divu
rv32um-p-mul
rv32um-p-mulh
rv32um-p-mulhsu
rv32um-p-mulhu
rv32um-p-rem
rv32um-p-remu
rv32ua-p-lrsc
rv32ua-p-amoadd_w
rv32ua-p-amoand_w
rv32ua-p-amomaxu_w
rv32ua-p-amomax_w
rv32ua-p-amominu_w
rv32ua-p-amomin_w
rv32ua-p-amoor_w
rv32ua-p-amoswap_w
rv32ua-p-amoxor_w
rv32mi-p-mcsr
rv32mi-p-csr
rv32si-p-csr
rv32si-p-scall"
# excluded tests:
# rv32mi-p-scall, successful, but defined as "success if never returning"
# rv32mi-p-shamt, newer spec says ignoring is OK, so we do that instead
# rv32mi-p-sbreak, breakpoint, I believe from debug spec, no need
# rv32mi-p-illegal, requires virtual machine paging? (TVM)
# rv32mi-p-ma_addr, misaligned address access is ignored (this one passes though?)
# rv32mi-p-ma_fetch, ignored for same reason, fails though
for t in $TESTS; do
if [[ "$t" =~ ^# ]]; then continue; fi
echo
echo "==== TEST: $t ===="
echo
run_test "$t"
done
echo
echo "All tests done!"
elif [ -n "$1" ]; then
run_test "$1"
else
echo "./test.sh (all|rv32ui-p-foo...) [--clean]"
fi