From 6ef9257c54da55f7e98143a05b9718396e6bc469 Mon Sep 17 00:00:00 2001 From: okir Date: Thu, 8 Jan 2004 10:50:52 +0000 Subject: [PATCH] - fixed placement of "function atexit" wrt shell exit trap handler git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1719 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/tests/regression/functions | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/tests/regression/functions b/src/tests/regression/functions index b6e723da..5ee8e554 100755 --- a/src/tests/regression/functions +++ b/src/tests/regression/functions @@ -23,9 +23,6 @@ if [ -z "$__p15init__" ]; then exit 1 done - mkdir -p $p15temp - trap atexit 0 1 2 13 15 - # Eat any arguments given on the command line while [ $# -ne 0 ]; do case $1 in @@ -68,28 +65,31 @@ if [ -z "$__p15init__" ]; then __black= fi + test_failed=false + + function atexit { + + if ! $test_failed; then + test "$p15temp" && rm -rf $p15temp + msg <<-EOF + ::: + ::: ${__green}Test set completed successfully${__black} + ::: +EOF + fi + } + + mkdir -p $p15temp + trap atexit 0 1 2 13 15 + # Redirect output to log file, but keep copies of # stdout/stderr descriptors on fd 3 and 4 exec 3>&1 4>&2 >$p15log 2>&1 - - test_failed=false fi # Clobber log file cp /dev/null $p15log -function atexit { - - if ! $test_failed; then - test "$p15temp" && rm -rf $p15temp - msg <<-EOF - ::: - ::: ${__green}Test set completed successfully${__black} - ::: -EOF - fi -} - function msg { if [ $# -eq 0 ]; then