-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_test
executable file
·39 lines (32 loc) · 944 Bytes
/
run_test
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
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
benchmark_name=$(echo $script_dir | rev | cut -d "/" -f 3 | rev)
project_name=$(echo $script_dir | rev | cut -d "/" -f 2 | rev)
bug_id=$(echo $script_dir | rev | cut -d "/" -f 1 | rev)
dir_name=/experiment/$benchmark_name/$project_name/$bug_id
subject_name=$(echo $bug_id | cut -d "-" -f 2)
problem_name=$(echo $bug_id | cut -d "-" -f 1)
dir_test=$dir_name/base/test
TEST_ID=$1
EXIT_CODE=1
if [ -z "$TEST_ID" ];
then
echo "requires a test case id"
exit 255
fi
TEST_CASE=$dir_test/in.${problem_name}.${TEST_ID}.txt
TEST_OUTPUT=$dir_test/out.${problem_name}.${TEST_ID}.txt
if [ -f "$TEST_CASE" ]; then
cd $dir_test
diff -u ${TEST_OUTPUT} <( timeout -k 5s 10s ${dir_name}/${subject_name} < $TEST_CASE )
EXIT_CODE=$?
else
echo "unknown test case"
exit 255
fi
if [[ EXIT_CODE -eq 0 ]]
then
echo "PASS"
else
echo "FAIL"
fi;
exit $EXIT_CODE