# $HeadURL$ $LastChangedRevision$ ######################################################################## # # Public functions # ######################################################################## adetestsupport_debug() { [ ${TEST_VERBOSELEVEL:-2} -lt $1 ] || echo "$PROGNAME: DEBUG[$1]: $2" >/dev/tty } adetestsupport_warning() { echo "$PROGNAME: WARNING: $1" >&2 } adetestsupport_error() { echo "$PROGNAME: ERROR: $1" >&2; exit 1 } adetestsupport_internal() { echo "$PROGNAME: INTERNAL ERROR: $1" >&2; exit 1 } adetestsupport_invert_rc() { local RC QUIET QUIET=false [ "X$1" != X-q -a "X$1" != X--quiet ] || { QUIET=true; shift; } $QUIET || adetestsupport_warning "expect the next command to fail ..." RC=0 eval "{ $1; } || RC=\$?" [ $RC != 0 ] } adetestsupport_set_rc() { return $1 } ######################################################################## # # Module-private functions # ######################################################################## # BEWARE: keep aligned with almost identical function in miniade.sh! _adetestsupport_replace_function() { local OLD_FNCREF NEW_FNCREF [ $# = 2 ] || _adetestsupport_internal "_adetestsupport_replace_function: bad argument count ($#)" OLD_FNCREF=$1 NEW_FNCREF=$2 eval "$OLD_FNCREF() { adetestsupport_warning \"$OLD_FNCREF() is obsolete; switch to $NEW_FNCREF()\" $NEW_FNCREF \"\$@\" }" } ######################################################################## # # Actual code # ######################################################################## _adetestsupport_replace_function debug adetestsupport_debug _adetestsupport_replace_function warning adetestsupport_warning _adetestsupport_replace_function error adetestsupport_error _adetestsupport_replace_function internal adetestsupport_internal _adetestsupport_replace_function invert_rc adetestsupport_invert_rc _adetestsupport_replace_function set_rc adetestsupport_set_rc