From 1a60d0c2a8eeef3b39ef276f0f3552552a1519b1 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 26 May 2009 14:49:37 +0200 Subject: adding ue4 (copy from ue3) --- ue4/mycpu/test/test.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 ue4/mycpu/test/test.sh (limited to 'ue4/mycpu/test/test.sh') 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 @@ +#!/bin/bash + +binary="./mycpu" +tmpfile="test/tmpfile" +inputs=( $(ls test/* | grep _program | sort -n) ) + +for input in ${inputs[@]} +do + echo "Testing $input ..." + + programfile="$input" + args="-c $programfile" + memoryfile="${input/_program/_memory}" + reffile="${input/_program/_output}" + if [ -e "$memoryfile" ] + then + args+=" -m $memoryfile" + fi + + if [ ! -e "$reffile" ] + then + echo " ERROR: reference file $reffile doesn't exist" + exit 1 + fi + + rm -rf "$tmpfile" + echo " Executing $binary $args ..." + $binary $args > $tmpfile + + md5_1=$(md5sum < "$reffile") + md5_2=$(md5sum < "$tmpfile") + if [ "$md5_1" != "$md5_2" ] + then + echo " ERROR: output and $reffile differ" + diff -Naur "$reffile" "$tmpfile" + rm -rf "$tmpfile" + exit 1 + else + echo " SUCCESS" + fi + rm -rf "$tmpfile" +done -- cgit v1.2.3