Root/test/Common

Source at commit bc27b094af74a7c6f8b71ceaa63d1ba80d067cbb created 9 years 4 months ago.
By werner, With a little help from m8cutils and abyss, we now have regression tests for the topological sort. "make test" or "make tests" invokes the regression tests, "make valgrind" runs them under valgrind's watchful eyes.
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 -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_fail()
31{
32    echo -n "$1: " 1>&2
33    shift
34    cat >_in
35    $VALGRIND ../fped -T _in "$@" >_out 2>&1 && {
36    echo FAILED "($SCRIPT)" 1>&2
37    cat _out
38    rm -f _in _out
39    exit 1
40    }
41    rm -f _in
42}
43
44
45expect()
46{
47    diff -u - "$@" _out >_diff || {
48    echo FAILED "($SCRIPT)" 1>&2
49    cat _diff 1>&2
50    rm -f _out _diff
51    exit 1
52    }
53    echo PASSED 1>&2
54    rm -f _out _diff
55    passed=`expr ${passed:-0} + 1`
56}
57

Archive Download this file

Branches:
master



interactive