diff options
| author | manuel <manuel@nc8430.lan> | 2009-05-26 14:49:37 +0200 |
|---|---|---|
| committer | manuel <manuel@nc8430.lan> | 2009-05-26 14:49:37 +0200 |
| commit | 1a60d0c2a8eeef3b39ef276f0f3552552a1519b1 (patch) | |
| tree | 038e7ea34e7093f959372885869234b90734331e /ue4/mycpu/test/test.sh | |
| parent | 1b2db0dfe36f134850965276ba62700dba02da4d (diff) | |
| download | ooprog-1a60d0c2a8eeef3b39ef276f0f3552552a1519b1.tar.gz ooprog-1a60d0c2a8eeef3b39ef276f0f3552552a1519b1.tar.bz2 ooprog-1a60d0c2a8eeef3b39ef276f0f3552552a1519b1.zip | |
adding ue4 (copy from ue3)
Diffstat (limited to 'ue4/mycpu/test/test.sh')
| -rwxr-xr-x | ue4/mycpu/test/test.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/ue4/mycpu/test/test.sh b/ue4/mycpu/test/test.sh new file mode 100755 index 0000000..ff1076c --- /dev/null +++ b/ue4/mycpu/test/test.sh | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | binary="./mycpu" | ||
| 4 | tmpfile="test/tmpfile" | ||
| 5 | inputs=( $(ls test/* | grep _program | sort -n) ) | ||
| 6 | |||
| 7 | for input in ${inputs[@]} | ||
| 8 | do | ||
| 9 | echo "Testing $input ..." | ||
| 10 | |||
| 11 | programfile="$input" | ||
| 12 | args="-c $programfile" | ||
| 13 | memoryfile="${input/_program/_memory}" | ||
| 14 | reffile="${input/_program/_output}" | ||
| 15 | if [ -e "$memoryfile" ] | ||
| 16 | then | ||
| 17 | args+=" -m $memoryfile" | ||
| 18 | fi | ||
| 19 | |||
| 20 | if [ ! -e "$reffile" ] | ||
| 21 | then | ||
| 22 | echo " ERROR: reference file $reffile doesn't exist" | ||
| 23 | exit 1 | ||
| 24 | fi | ||
| 25 | |||
| 26 | rm -rf "$tmpfile" | ||
| 27 | echo " Executing $binary $args ..." | ||
| 28 | $binary $args > $tmpfile | ||
| 29 | |||
| 30 | md5_1=$(md5sum < "$reffile") | ||
| 31 | md5_2=$(md5sum < "$tmpfile") | ||
| 32 | if [ "$md5_1" != "$md5_2" ] | ||
| 33 | then | ||
| 34 | echo " ERROR: output and $reffile differ" | ||
| 35 | diff -Naur "$reffile" "$tmpfile" | ||
| 36 | rm -rf "$tmpfile" | ||
| 37 | exit 1 | ||
| 38 | else | ||
| 39 | echo " SUCCESS" | ||
| 40 | fi | ||
| 41 | rm -rf "$tmpfile" | ||
| 42 | done | ||
