-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathruntest.sh
executable file
·59 lines (45 loc) · 1.12 KB
/
runtest.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
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage: runtest.sh <test name> <model: rtl/behavioral(default)"
exit 1
fi
DIR=$(dirname $0)
TEST=$1
MODEL=${2:-behavioral}
DRAMCFG=$DIR/dramsim/DDR4_4Gb_x16_2666_2.ini
HEXFILE=$DIR/tests/$TEST.hex
ELFFILE=$DIR/tests/$TEST.elf
LOGFILE=$DIR/tests/$TEST.log
UARTFILE=$DIR/tests/$TEST.out
make -C $DIR/tests || exit $?
make -C $DIR/$MODEL || exit $?
rm -f simtrace
TIMEOUT=100000
mkfifo simtrace
timeout $TIMEOUT $DIR/$MODEL/build/top +dramcfg=$DRAMCFG +memfile=$HEXFILE +tracefile=simtrace +uartfile=$UARTFILE +logfile=$LOGFILE &
SIMPID=$!
timeout $TIMEOUT $DIR/runspike.sh --log-commits --cosim=simtrace $ELFFILE 2>/dev/null &
SPIKEPID=$!
ERROR=0
wait $SIMPID
if [ $? -eq 124 ]; then
echo "ERROR: rtl timed out"
ERROR=1
fi
wait $SPIKEPID; SPIKESTATUS=$?
if [ $SPIKESTATUS -eq 124 ]; then
echo "ERROR: spike timed out"
ERROR=1
elif [ $SPIKESTATUS -ne 0 ]; then
echo "ERROR: spike exited with non-zero status"
ERROR=1
fi
rm -f simtrace
$DIR/checkmem.py $LOGFILE
if [ $? -ne 0 ]; then
ERROR=1
fi
if [ $ERROR -ne 0 ]; then
echo "TEST FAILED"
fi
exit $ERROR