-
Notifications
You must be signed in to change notification settings - Fork 0
/
runTests.sh
executable file
·124 lines (112 loc) · 2.88 KB
/
runTests.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
117
118
119
120
121
122
123
124
#!/usr/bin/env bash
# This script accepts a path to the rv32ui test directory included
# in the RISC-V Test Suite and runs a subset of the tests contained
# therein.
source common.sh
result=0
parallel=0
skip=0
xlen=64
options=$(getopt --options="hvcfmdx:p:so" --longoptions="help,noprint,verbose,parallel,haskell-sim,coq-sim,debug,xlen:,path:,skip,prof" -- "$@")
[ $? == 0 ] || error "Invalid command line. The command line includes one or more invalid command line parameters."
eval set -- "$options"
while true
do
case "$1" in
-h | --help)
cat <<- EOF
Usage: ./runTests.sh [OPTIONS] PATH
This script accepts a path, PATH, to the rv32ui test directory
included in the RISC-V Test Suite https://github.com/riscv/
riscv-tools) and runs a subset of these tests contained therein.
If all of these selected tests complete successfully, this
script returns 0.
Arguments:
--path location
Path to the directory where all the tests are located.
--xlen 32|64
Specifies whether we are running 32-bit or 64-bit tests.
Default 64.
Options:
-h|--help
Displays this message.
-v|--verbose
Enables verbose output.
--debug
Uses default values in place of random values (useful for when debugging against verilog)
-f|--prof
Profiling
Example
./runTests.sh --verbose riscv-tests/build/isa/rv32ui-p-simple
Generates the RISC-V processor simulator.
Authors
Murali Vijayaraghavan
Larry Lee
Evan Marzion
EOF
exit 0;;
-v|--verbose)
verboseflag="-v"
shift;;
-c|--parallel)
parallel=1
parallel_word="--parallel"
shift;;
-o|--prof)
prof="--prof"
shift;;
-f|--haskell-sim)
haskell="--haskell-sim"
shift;;
-m|--coq-sim)
haskell="--coq-sim"
shift;;
-x|--xlen)
xlen=$2
shift 2;;
-p|--path)
path=$2
shift 2;;
-d|--debug)
debug="--debug"
shift;;
--noprint)
noprint="--noprint"
shift;;
-s|--skip)
skip=1
shift;;
--)
shift
break;;
esac
done
shift $((OPTIND - 1))
[[ -z "$path" ]] && error "Invalid command line. The PATH argument is missing."
if [[ $skip == 0 ]]
then
notice "Generating model".
execute "./doGenerate.sh $parallel_word $prof $verboseflag $haskell --xlen $xlen"
fi
notice "Running tests in $path."
files=$(./blackList.sh $path $xlen)
#set -- $files
#files=$1
if [[ $parallel == 0 ]]
then
for file in $files
do
((file $file | (grep -iq elf && ./runElf.sh --xlen $xlen $prof $noprint $verboseflag $haskell --path $file)) || (file $file | grep -viq elf));
result=$(( $? | $result ));
done
else
printf "$files" | parallel --bar -P 32 -j32 "(file {} | (grep -iq elf && ./runElf.sh --xlen $xlen $prof $noprint $verboseflag $haskell $debug --path {})) || (file {} | grep -viq elf)"
result=$?
fi
if [[ $result == 0 ]]
then
notice "All the tests that ran passed."
else
error "The test suite failed."
fi
exit $result