-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·40 lines (31 loc) · 1.04 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
#!/bin/sh
echo "\nBuilding project..."
make clean > /dev/null
make > /dev/null
echo "Compiling test files..."
find ./test_data -name "*.demo"|while read fname; do
./demo $fname > /dev/null
done
echo "Running simulator..."
find ./test_data -name "*.i" | while read test_name; do
ref_name="${test_name/test_data/ref_data}"
test_result=$(./simulator/sim $test_name)
ref_result=$(./simulator/sim $ref_name)
test_result="${test_result//Executed [0-9]* instructions and [0-9]* operations in [0-9]* cycles./}"
ref_result="${ref_result//Executed [0-9]* instructions and [0-9]* operations in [0-9]* cycles./}"
if [ "$test_result" = "$ref_result" ]; then
echo "Success: $test_name"
else
echo "Failed: $test_name"
echo $test_result
echo $ref_result
fi;
done
echo "\nCleaning up repository..."
find ./test_data -name "*.i" | while read test_name; do
rm $test_name > /dev/null
done
find ./test_data -name "*.sl" | while read test_name; do
rm $test_name > /dev/null
done
echo "\nTests completed.\n"