gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnu-arch-users] RFC: test framework exit handler


From: Robin Farine
Subject: [Gnu-arch-users] RFC: test framework exit handler
Date: 20 Oct 2003 11:59:03 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

A replacement for the commented out trap "test_fail" ERR might go like
this:

In test-framework, the exit handler handles a possible error case by
calling "test_failure", then it calls $test_cleanup if this variable
has a non-empty value, i.e. contains the name of the test case's
cleanup function.

test_exit_handler ()
{
        ret=$?
        test $ret -eq 0 || test_failure
        if test -n "$test_cleanup"; then
                $test_cleanup
        fi
        exit $ret
}

trap "test_exit_handler" 0


Do you think that this is (1) useful and (2) portable across the class
of Bourne Shells?

-- 
rnf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]