mario@108: #!/bin/bash
mario@108: 
mario@108: # assume no error to start with...
mario@108: error=0
mario@108: 
mario@108: for ff in `ls *.test`
mario@108: do
mario@108:   for id in `cat $ff | grep "^#" | sed "s/#[^ ]*//g"`
mario@108:   do
mario@108: 	sed s/XXXX/$id/g $ff > $ff"_"$id.iec
mario@108: 	if `../../../iec2iec $ff"_"$id.iec -I ../../../lib > $ff"_"$id.out 2>$ff"_"$id.err`
msousa@258: 	#if `../../../iec2c $ff"_"$id.iec -I ../../../lib > $ff"_"$id.out 2>$ff"_"$id.err`
mario@108: 		# TODO before deciding test is success [OK]
mario@108: 		#       - test whether xxx.out has size <> 0
mario@108: 		#       - test whether xxx.err has size == 0
mario@108: 		#       - (?) test whether xxx.out2 is identical to xxx.out
mario@108: 		#       - (?) test whether xxx.err2 has size == 0
mario@108: 		#       - perhaps produce a [WARN] instead of [ERROR] in cases of (?)
mario@108: 	  then echo "[ O K ]   " $ff "->" $id
mario@108: 	  else echo "[ERROR]   " $ff "->" $id; error=1
mario@108: 	fi
mario@108: #	../../../iec2iec $ff"_"$id.out -I ../../../lib > $ff"_"$id.out2 2>$ff"_"$id.err2
mario@108:   done
mario@108: done
mario@108: 
mario@108: echo
mario@108: if `test $error = 1`
mario@108:   then echo "FAILURE -> At least one of the tests failed!"
mario@108:   else echo "SUCCESS -> All tests passed!"
mario@108: fi