qse/ase/test/awk/regress.sh

64 lines
891 B
Bash
Raw Normal View History

2006-11-19 07:28:33 +00:00
#!/bin/sh
2006-11-19 07:45:46 +00:00
init()
{
for script in emp-???.awk
do
output=`echo $script | sed 's/\.awk$/.out/g'`
./awk $script emp-en.data > "$output"
done
}
test()
{
pid=$$
for script in emp-???.awk
do
output=`echo $script | sed 's/\.awk$/.out/g'`
./awk $script emp-en.data > "$output.$pid"
2006-11-19 09:28:55 +00:00
diff -y $output "$output.$pid"
2006-11-19 07:45:46 +00:00
if [ $? -ne 0 ]
then
echo "###################################"
echo "PROBLEM(S) DETECTED IN $script.".
echo "###################################"
rm -f "$output.$pid"
break
fi
2006-11-19 07:28:33 +00:00
rm -f "$output.$pid"
2006-11-19 07:45:46 +00:00
done
}
#--------#
# main #
#--------#
2006-11-19 09:28:55 +00:00
if [ ! -x ./awk ]
then
echo "Error: cannot locate a relevant awk interpreter"
exit 1;
fi
2006-11-19 07:45:46 +00:00
if [ $# -ne 1 ]
then
echo "Usage: $0 init"
echo " $0 test"
exit 1
fi
if [ "$1" = "init" ]
then
init
elif [ "$1" = "test" ]
then
test
else
echo "Usage: $0 init"
echo " $0 test"
exit 1
fi
2006-11-19 07:28:33 +00:00