1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#
# Common code for checking map init by OS description
#
mkdir -p out || exit 99
name=$( basename "$0" )
resultfile="out/${name}.result"
expectfile="$srcdir/$name.expect"
symfile="$srcdir/$name.sym"
datafile="$srcdir/$name.data"
cfgfile="out/${name}.cfg"
optspec=
old_IFS="$IFS"
IFS=$'\n'
optspec="${opts[*]}"
IFS="$old_IFS"
symspec=
test -f "$symfile" && symspec="SYM=$symfile"
dataspec=
test -f "$datafile" && dataspec="DATA=$datafile"
test -n "$data_as" && dataspec="data_as=$data_as
$dataspec"
cat >"$cfgfile" <<EOF
$optspec
$symspec
$dataspec
EOF
echo -n "Checking... "
./xlat-os "$cfgfile" >"$resultfile"
rc=$?
if [ $rc -gt 1 ]; then
echo ERROR
exit $rc
elif [ $rc -ne 0 ]; then
echo FAILED
exit $rc
elif ! diff "$expectfile" "$resultfile"; then
echo FAILED
echo "Result does not match" >&2
exit 1
else
echo OK
fi
exit 0
|