1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-22 13:14:04 +02:00
fped/test/Common
werner 39fef16d1c Got rid of the requirement to have a "package" directive. Fixed a grammar error
found in the process. Also taught the regression test system a new trick: the
path to "fped" can be passed in the environment variable FPED. E.g.,
FPED=fped.r5943 make test

- fped.c (usage, main): duplicating the -T option produces a dump to stdout
  before exiting (like %dump would)
- test/Common: new command fped_dump to invoked fped with a second -T option
- test/Common: if the environment variable FPED is set, use its content to
  invoke fped (default is ../fped)
- test/Common: if the environment variable CWD_PREFIX is set, prepend it to
  $FPED if the latter is a relative path 
- Makefile (test, tests): set CWD_PREFIX to .., so that the path given in FPED
  is valid at the point of invocation
- fpd.y: revised grammar to make "package" optional
- fpd.y: measurements were syntactically allowed inside non-root frame
  (test/structure)
- test/structure: test various combinations of the grammatical file structure
- test/tsort: removed all the now unnecessary "package" directives



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5944 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-26 23:11:22 +00:00

68 lines
1.1 KiB
Bash
Executable File

#!/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
$VALGRIND ${FPED:-../fped} -T _in "$@" >_out 2>&1 || {
echo FAILED "($SCRIPT)" 1>&2
cat _out
rm -f _in _out
exit 1
}
rm -f _in
}
fped_dump()
{
fped "$@" -T
}
fped_fail()
{
echo -n "$1: " 1>&2
shift
cat >_in
$VALGRIND ${FPED:-../fped} -T _in "$@" >_out 2>&1 && {
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`
}
if [ ! -z "$CWD_PREFIX" -a ! -z "$FPED" -a "$FPED" = "${FPED#/}" ]; then
FPED="$CWD_PREFIX/$FPED"
fi