Last active
May 21, 2017 02:09
-
-
Save dongkwan-kim/0e79d1c15b14a72384faa59e2d25f74a to your computer and use it in GitHub Desktop.
test-repeat shell script for pintos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# make sure there's ./testresult directory | |
# For individual test: $ bash test.sh testdir/testname | |
# For whole test: $ bash test.sh | |
test_all() { | |
for i in $(seq 1 10) | |
do | |
make clean > testresult/dummy.txt | |
make > testresult/dummy.txt | |
echo "$i start" | |
make grade > testresult/$i.txt | |
grep -r "Total" ./testresult/$i.txt | grep -r "100.0%/100.0%" | |
grep -r "Total" ./testresult/$i.txt | grep -rv "100.0%/100.0%" | |
done | |
echo "" | |
echo "== Perfect Score Grade List ==" | |
grep -r "Total" ./testresult/* | grep -r "100.0%/100.0%" | |
echo "== Not Perfect Score Grade List ==" | |
grep -r "Total" ./testresult/* | grep -rv "100.0%/100.0%" | |
echo "== Summary ==" | |
echo "success" | |
grep -r "Total" ./testresult/* | grep -r "100.0%/100.0%" | wc -l | |
echo "fail" | |
grep -r "Total" ./testresult/* | grep -rv "100.0%/100.0%" | wc -l | |
} | |
test_individual() { | |
for i in $(seq 1 100) | |
do | |
make clean > testresult/dummy.txt | |
echo "$i start" | |
make build/tests/$1.result > testresult/$i.txt | |
grep -r "pass tests" ./testresult/$i.txt | |
grep -r "FAIL tests" ./testresult/$i.txt | |
done | |
echo "" | |
echo "== Perfect Score Grade List ==" | |
grep -r "pass tests" ./testresult/* | |
echo "== Not Perfect Score Grade List ==" | |
grep -r "FAIL tests" ./testresult/* | |
echo "== Summary ==" | |
echo "success" | |
grep -r "pass tests" ./testresult/* | wc -l | |
echo "fail" | |
grep -r "FAIL tests" ./testresult/* | wc -l | |
} | |
rm -rf testresult | |
mkdir testresult | |
if [ $# = 0 ]; then | |
test_all | |
elif [ $# = 1 ]; then | |
test_individual $1 | |
else | |
echo "For individual test: $ bash test.sh testdir/testname" | |
echo "For whole test: $ bash test.sh" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment