Author: sebor
Date: Fri Aug 18 15:49:19 2006
New Revision: 432763
URL: http://svn.apache.org/viewvc?rev=432763&view=rev
Log:
2006-08-18 Andrew Black <[EMAIL PROTECTED]>
* run_locale_utils.sh (test_locale): Remove redundant calls to rm.
(signal_cleanup): Add exit handler for cleaning up tempdir.
(main): Set EXIT trap before calling test_locale, remove redundant
rm call.
Modified:
incubator/stdcxx/trunk/etc/config/run_locale_utils.sh
Modified: incubator/stdcxx/trunk/etc/config/run_locale_utils.sh
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/run_locale_utils.sh?rev=432763&r1=432762&r2=432763&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/run_locale_utils.sh (original)
+++ incubator/stdcxx/trunk/etc/config/run_locale_utils.sh Fri Aug 18 15:49:19
2006
@@ -293,17 +293,16 @@
echo "ERROR: $2/out.2 $2/out.3 differ." > $dbgout
failedassertions=`expr $failedassertions + 1`
fi
+}
- # and remove database
- [ -d $2/$3 ] && rm -rf $2/$3
-
- # remove dump files
- [ -f $2/out.1 ] && rm $2/out.1
- [ -f $2/out.2 ] && rm $2/out.2
- [ -f $2/out.3 ] && rm $2/out.3
-
- # and finally remove the tmp directory
- [ -d $2 ] && rm -rf $2
+#
+# Cleanup handler
+#
+
+signal_cleanup ()
+{
+ echo "Cleaning up " $tmpdir > $dbgout
+ rm -rf $tmpdir
}
##############################################################################
@@ -328,6 +327,10 @@
out="/dev/stdout"
dbgout="/dev/null"
+## Temporary (working) directory
+[ -z "$TMP" ] && TMP="/tmp";
+tmpdir=$TMP/locale.$$
+
## Get the options from the command line
while getopts ":sfdb:i:l:O:L:M:C:D:" opt_name; do
case $opt_name in
@@ -359,9 +362,7 @@
elif [ "$chk_func" = "yes" ]; then
- ## set the temp dir
- [ -z "$TMP" ] && TMP="/tmp";
- tmpdir=$TMP/locale.$$
+ ## create the temp dir
mkdir $tmpdir
if [ $? -ne 0 ]; then
echo "$0: Unable to create $tmpdir, aborting" >&2
@@ -378,10 +379,11 @@
echo "export RWSTD_LOCALE_ROOT" >$dbgout
export RWSTD_LOCALE_ROOT
+ # set our cleanup on exit trap
+ trap signal_cleanup EXIT
+
# test only one locale
test_locale $nlsdir $tmpdir $locale_db;
-
- rm -rf $tmpdir
else
## Invocation is wrong
echo "$0: Usage : " >&2