Root/test/Common

Source at commit c9af8cd0fe183d31d1bc7079cb8e7deec3bbe74d created 13 years 9 months ago.
By werner, 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.)
1#!/bin/sh
2#
3# Common - Elements shared by all regression tests for fped
4#
5# Written 2010 by Werner Almesberger
6# Copyright 2010 Werner Almesberger
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13
14
15fped()
16{
17    echo -n "$1: " 1>&2
18    shift
19    cat >_in
20    $VALGRIND ${FPED:-../fped} -T _in "$@" >_out 2>&1 || {
21    echo FAILED "($SCRIPT)" 1>&2
22    cat _out
23    rm -f _in _out
24    exit 1
25    }
26    rm -f _in
27}
28
29
30fped_dump()
31{
32    fped "$@" -T
33}
34
35
36fped_fail()
37{
38    echo -n "$1: " 1>&2
39    shift
40    cat >_in
41    $VALGRIND ${FPED:-../fped} -T _in "$@" >_out 2>&1 && {
42    echo FAILED "($SCRIPT)" 1>&2
43    cat _out
44    rm -f _in _out
45    exit 1
46    }
47    rm -f _in
48}
49
50
51expect()
52{
53    diff -u - "$@" _out >_diff || {
54    echo FAILED "($SCRIPT)" 1>&2
55    cat _diff 1>&2
56    rm -f _out _diff
57    exit 1
58    }
59    echo PASSED 1>&2
60    rm -f _out _diff
61    passed=`expr ${passed:-0} + 1`
62}
63
64
65expect_grep()
66{
67    grep "$1" <_out >_tmp || exit 1
68    mv _tmp _out
69    shift
70    expect "$@"
71}
72
73
74if [ ! -z "$CWD_PREFIX" -a ! -z "$FPED" -a "$FPED" = "${FPED#/}" ]; then
75    FPED="$CWD_PREFIX/$FPED"
76fi
77

Archive Download this file

Branches:
master



interactive