1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-12-23 16:31:08 +02:00
fped/test/Common

86 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/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`
}
The mechanism for selecting points for measurements reaches its limits when using frames to encapsulate building blocks, e.g., like macros or functions in a programming language. Since measurements only know about the frame containing a vector but not the frames containing that frame, invocations of this frame from different places can only be distinguished within the min/next/max scheme. (See the example in README.) To eliminate this limitation, one needs a way to tell fped to consider a point only if it has been instantiated through a certain path, e.g., by requiring some other frames to be visited in its instantiation. This increases the number of distinct points available for measurements. The mechanism chosen is to qualify a measurement point with frames that lead to it. This list of outer frames does not have to include all frames. Without qualifying, the old behaviour results. Note that this doesn't cover all possible ways in which a point can appear in different roles. Multiple frame references can also result from repeating the same frame reference in the same parent frame. The current qualification mechanism does not allow such paths to be distinguished. However, one can always introduce intermediate frames for this purpose. Furthermore, repetitions create multiple instances of a point, although in what should be considered the same role. - fpd.l: make scanner support free-format a little better by switching back to keyword mode after frame braces. This way, one can write a simple frame in a single line, which is useful for regression tests. - fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the result of a measurement - fpd.y, README: measurements can now be labeled. Note that, due to limitations of the grammar, the first measurement cannot be labeled. - error.h, error.c (yywarn): new function for non-fatal diagnostics that always get reported to standard error - bitset.h, bitset.c: functions to manipulate variable-size bit sets - meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers for points used in measurements - dump.c (print_meas_base, print_meas): dump qualifiers - delete.c (delete_references, test/del_frame): delete measurements that reference a frame being deleted in their qualifiers - obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we have an index into the bit vector of visited frames - meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs, generate_frame, instantiate): record the set of frames visited for each sample - meas.c (meas_post): only treat two instances of a point as equivalent if the set of frames visited of one of them is a superset of set of the other. In this case, keep the union of the two sets. - meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max), test/meas_qual: instantiate_meas_pkg only select points for which all frames in the qualification have been visited - gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change - inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame, inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to avoid clash with curr_frame in fpd.y - inst.h, inst.c (find_meas_hint): make global - test/structure, test/del_vec, test/del_frame: fped now warns if a measurement is in an unlinked frame. Changed regressions tests to avoid this warning. - test/Common: new function expect_grep to compare only part of the output git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
expect_grep()
{
grep "$1" <_out >_tmp || exit 1
mv _tmp _out
shift
expect "$@"
}
expect_sed()
{
sed "$1" <_out >_tmp || exit 1
mv _tmp _out
shift
expect "$@"
}
if [ ! -z "$CWD_PREFIX" -a ! -z "$FPED" -a "$FPED" = "${FPED#/}" ]; then
FPED="$CWD_PREFIX/$FPED"
fi