forked from CS429-S2022/CI-Lab-Student
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver.sh
More file actions
executable file
·45 lines (39 loc) · 1.01 KB
/
Copy pathdriver.sh
File metadata and controls
executable file
·45 lines (39 loc) · 1.01 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
#!/bin/bash
# C S 429 EEL interpreter
#
# driver.sh - Testing script for the EEL interpreter.
#
# Copyright (c) 2021. S. Chatterjee, X. Shen, T. Byrd. All rights reserved.
# May not be used, modified, or copied without permission.
set -e
TESTFILE=$1
if [ ! -f "$TESTFILE" ]; then
echo "$TESTFILE does not exist"
exit 1
fi
./ci -i $TESTFILE -o _output1
./ci_reference -i $1 -o _output2
if [ ! -f _output1 ]; then
echo "ci failed to create the output file"
exit 1
fi
if [ ! -f _output2 ]; then
echo "ci_reference failed to create the output file"
exit 1
fi
DIFFS=$(sdiff -l _output1 _output2 | cat -n | grep -v -e '($' | cut -d$'\t' -f 1)
if [ "$DIFFS" ]
then
echo "failed testcases:"
echo -e "id | expression | output | gold"
for line in $DIFFS
do
EXP=$(sed -n "${line}p" $TESTFILE)
OUTPUT=$(sed -n "${line}p" _output1)
GOLD=$(sed -n "${line}p" _output2)
echo -e "$line | $EXP | $OUTPUT | $GOLD"
done
else
echo "all testcases passed"
fi
rm -f _output1 _output2