#!/bin/bash # $Header: /CVSROOT/tinolib/old/Makefile-test.sh,v 1.6 2005/04/24 12:55:38 tino Exp $ # # Unit tests # # $Log: Makefile-test.sh,v $ # Revision 1.6 2005/04/24 12:55:38 tino # started GAT support and filetool added # # Revision 1.5 2005/01/26 10:46:41 tino # CFLAGS corrected to use -I- to keep local include path from interfering with system header . # # Revision 1.4 2005/01/25 22:14:51 tino # exception.h now passes include test (but is not usable). See ChangeLog # # Revision 1.3 2005/01/04 13:23:49 tino # see ChangeLog, mainly changes for "make test" # # Revision 1.2 2004/12/19 16:38:13 tino # new unit test version for builtin unit tests, prepare to integrate in tinolib # # Revision 1.1 2004/09/04 20:15:22 tino # started to add unit tests set -e cd "`dirname "$0"`" case "$1" in UNIT_TEST) ;; *) echo "ARG1 not UNIT_TEST" >&2; exit 1;; esac BASE="$1" rm -rf "$BASE" mkdir "$BASE" genit() { cat <>"$1/LOG.out" 2>&1 ret="$?" set -e case "$ret" in 42) echo "TEST $2: ok"; return 0;; 0) echo "TEST $2: fail";; *) echo "TEST $2: returns $ret";; esac sed -n '$s/^/>>>/p' "$1/LOG.out" false } hint() { grep ^\\. "$1" | head -1 } testcc() { TMP="$BASE/UNIT_TEST_$1" rm -rf "$TMP" mkdir "$TMP" cat >"$TMP/$1.c" cat >"$TMP/Makefile" <"$TMP/LOG.out" 2>&1 then [ -z "$3" ] || "$3" "$TMP" "$1" || return 1 rm -rf "$TMP" else echo "$1: $2: `hint "$TMP/LOG.out"`" return 1 fi } ALLUNITTESTS="" ALLINCLUDES="" echo echo "INCLUDE TESTS:" cat >"$BASE/Makefile" <>"$BASE/Makefile" <