2010-04-27 00:30:21 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Common - Elements shared by all regression tests for fped
|
|
|
|
#
|
|
|
|
# Written 2010 by Werner Almesberger
|
|
|
|
# Copyright 2010 Werner Almesberger
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
fped()
|
|
|
|
{
|
|
|
|
echo -n "$1: " 1>&2
|
|
|
|
shift
|
|
|
|
cat >_in
|
2010-04-27 02:11:22 +03:00
|
|
|
$VALGRIND ${FPED:-../fped} -T _in "$@" >_out 2>&1 || {
|
2010-04-27 00:30:21 +03:00
|
|
|
echo FAILED "($SCRIPT)" 1>&2
|
|
|
|
cat _out
|
|
|
|
rm -f _in _out
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
rm -f _in
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-27 02:11:22 +03:00
|
|
|
fped_dump()
|
|
|
|
{
|
|
|
|
fped "$@" -T
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-27 00:30:21 +03:00
|
|
|
fped_fail()
|
|
|
|
{
|
|
|
|
echo -n "$1: " 1>&2
|
|
|
|
shift
|
|
|
|
cat >_in
|
2010-04-27 02:11:22 +03:00
|
|
|
$VALGRIND ${FPED:-../fped} -T _in "$@" >_out 2>&1 && {
|
2010-04-27 00:30:21 +03:00
|
|
|
echo FAILED "($SCRIPT)" 1>&2
|
|
|
|
cat _out
|
|
|
|
rm -f _in _out
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
rm -f _in
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expect()
|
|
|
|
{
|
|
|
|
diff -u - "$@" _out >_diff || {
|
|
|
|
echo FAILED "($SCRIPT)" 1>&2
|
|
|
|
cat _diff 1>&2
|
|
|
|
rm -f _out _diff
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
echo PASSED 1>&2
|
|
|
|
rm -f _out _diff
|
|
|
|
passed=`expr ${passed:-0} + 1`
|
|
|
|
}
|
2010-04-27 02:11:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
if [ ! -z "$CWD_PREFIX" -a ! -z "$FPED" -a "$FPED" = "${FPED#/}" ]; then
|
|
|
|
FPED="$CWD_PREFIX/$FPED"
|
|
|
|
fi
|