Root/test/Common

Source at commit 8a1a3103964533b0d517a29312ddeabdab1d6271 created 5 years 10 days ago.
By Werner Almesberger, inst.c (find_point_vec): correct indentation
1#!/bin/sh
2#
3# Common - Elements shared by all regression tests for fped
4#
5# Written 2010, 2011 by Werner Almesberger
6# Copyright 2010, 2011 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 -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
74expect_sed()
75{
76    sed "$1" <_out >_tmp || exit 1
77    mv _tmp _out
78    shift
79    expect "$@"
80}
81
82
83if [ ! -z "$CWD_PREFIX" -a ! -z "$FPED" -a "$FPED" = "${FPED#/}" ]; then
84    FPED="$CWD_PREFIX/$FPED"
85fi
86

Archive Download this file

Branches:
master



interactive