[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
39-at-cleanup-files.patch
From: |
DEMAILLE Akim |
Subject: |
39-at-cleanup-files.patch |
Date: |
Mon, 20 Nov 2000 10:18:27 +0100 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* tests/atgeneral.m4 (AT_CLEAN_FILE_IFELSE, AT_CLEANUP_FILE)
(AT_CLEANUP_FILES): New macros.
(AT_SETUP, AT_CHECK, AT_CLEANUP): Use them.
(AT_CHECK): Fix a use of at_verbose.
* tests/atspecific.m4 (AT_CHECK_AUTOCONF, AT_CHECK_AUTOHEADER)
(AT_CHECK_CONFIGURE): New macros.
Index: m4sugar.m4
--- m4sugar.m4 Sat, 18 Nov 2000 16:20:09 +0100 akim (ace/b/27_libm4.m4 1.36 644)
+++ m4sugar.m4 Sat, 18 Nov 2000 18:05:24 +0100 akim (ace/b/27_libm4.m4 1.36 644)
@@ -1323,7 +1323,7 @@ m4_define([m4_strip],
# => active
m4_define([m4_append],
[m4_define([$1],
-ifdef([$1], [m4_defn([$1])])[$2])])
+ ifdef([$1], [m4_defn([$1])])[$2])])
# m4_list_append(MACRO-NAME, STRING)
@@ -1331,7 +1331,7 @@ m4_define([m4_append],
# Same as `m4_append', but each element is separated by `, '.
m4_define([m4_list_append],
[m4_define([$1],
-ifdef([$1], [m4_defn([$1]), ])[$2])])
+ ifdef([$1], [m4_defn([$1]), ])[$2])])
# m4_foreach_quoted(VARIABLE, LIST, EXPRESSION)
Index: tests/atgeneral.m4
--- tests/atgeneral.m4 Sat, 18 Nov 2000 18:00:27 +0100 akim
(ace/b/19_atgeneral. 1.29 644)
+++ tests/atgeneral.m4 Sat, 18 Nov 2000 19:15:49 +0100 akim
(ace/b/19_atgeneral. 1.29 644)
@@ -248,9 +248,7 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und
# The group is testing what DESCRIPTION says.
AT_DEFINE([AT_SETUP],
[AT_DEFINE([AT_ordinal], m4_eval(AT_ordinal + 1))
-m4_pushdef([AT_data_files], )
-m4_pushdef([AT_data_expout], )
-m4_pushdef([AT_data_experr], )
+m4_pushdef([AT_data_files], [stdout stderr ])
m4_divert_pop()dnl
AT_ordinal )
dnl Here will be inserted the `rm' corresponding to AT_CLEANUP.
@@ -268,25 +266,48 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und
])
+# AT_CLEANUP_FILE_IFELSE(FILE, IF-REGISTERED, IF-NOT-REGISTERED)
+# --------------------------------------------------------------
+AT_DEFINE([AT_CLEANUP_FILE_IFELSE],
+[ifelse(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [\([\[\]*.]\)], [\\\1])),
+ -1,
+ [$3], [$2])])
+
+
+# AT_CLEANUP_FILE(FILE)
+# ---------------------
+# Register FILE for AT_CLEANUP.
+AT_DEFINE([AT_CLEANUP_FILE],
+[AT_CLEANUP_FILE_IFELSE([$1], [],
+ [m4_append([AT_data_files], [$1 ])])])
+
+
+# AT_CLEANUP_FILES(FILES)
+# -----------------------
+# Declare a list of FILES to clean.
+AT_DEFINE([AT_CLEANUP_FILES],
+[m4_foreach([AT_File], m4_quote(m4_patsubst([$1], [ *], [,])),
+ [AT_CLEANUP_FILE(AT_File)])])
+
+
# AT_CLEANUP(FILES)
# -----------------
# Complete a group of related tests, recursively remove those FILES
# created within the test. There is no need to list stdout, stderr,
# nor files created with AT_DATA.
AT_DEFINE([AT_CLEANUP],
-[ $at_traceoff
+[AT_CLEANUP_FILES([$1])dnl
+ $at_traceoff
)
at_status=$?
at_test_count=`expr 1 + $at_test_count`
if $at_stop_on_error && test -n "$at_failed_list"; then :; else
- rm ifelse([AT_data_files$1], , [-f], [-rf[]AT_data_files[]ifelse($1, , ,
[ $1])]) stdout stderr[]AT_data_expout[]AT_data_experr
+ rm -rf AT_data_files
fi
;;
m4_divert(1)[]dnl
- rm ifelse([AT_data_files$1], , [-f], [-rf[]AT_data_files[]ifelse($1, , , [
$1])]) stdout stderr[]AT_data_expout[]AT_data_experr
+ rm -rf AT_data_files
m4_undivert(2)[]dnl
-m4_popdef([AT_data_experr])dnl
-m4_popdef([AT_data_expout])dnl
m4_popdef([AT_data_files])dnl
m4_divert_push([KILL])dnl
])# AT_CLEANUP
@@ -299,7 +320,7 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und
# This macro is not robust to active symbols in CONTENTS *on purpose*.
# If you don't want CONTENT to be evaluated, quote it twice.
AT_DEFINE([AT_DATA],
-[AT_DEFINE([AT_data_files], AT_data_files[ ]$1)
+[AT_CLEANUP_FILES([$1])dnl
cat >$1 <<'_ATEOF'
$2[]_ATEOF
])
@@ -339,17 +360,17 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und
dnl Restore stdout to fd1 and stderr to fd2.
exec 1>&5 2>&6
dnl If not verbose, neutralize the output of diff.
- test $at_verbose = echo && exec 1>/dev/null 2>/dev/null
+ test $at_verbose = : && exec 1>/dev/null 2>/dev/null
at_failed=false;
m4_case([$4],
ignore, [$at_verbose = echo && cat stderr;:],
- experr, [AT_DEFINE([AT_data_experr], [ experr])dnl
+ experr, [AT_CLEANUP_FILE([experr])dnl
$at_diff experr stderr || at_failed=:],
[], [$at_diff empty stderr || at_failed=:],
[echo $at_n "m4_patsubst([$4], [\([\"`$]\)], \\\1)$at_c" | $at_diff
- stderr || at_failed=:])
m4_case([$3],
ignore, [test $at_verbose = echo && cat stdout;:],
- expout, [AT_DEFINE([AT_data_expout], [ expout])dnl
+ expout, [AT_CLEANUP_FILES([expout])dnl
$at_diff expout stdout || at_failed=:],
[], [$at_diff empty stdout || at_failed=:],
[echo $at_n "m4_patsubst([$3], [\([\"`$]\)], \\\1)$at_c" | $at_diff
- stdout || at_failed=:])
Index: tests/atspecific.m4
--- tests/atspecific.m4 Sat, 18 Nov 2000 18:02:51 +0100 akim
(ace/b/24_atspecific 1.22 664)
+++ tests/atspecific.m4 Sat, 18 Nov 2000 18:59:50 +0100 akim
(ace/b/24_atspecific 1.22 664)
@@ -25,6 +25,30 @@
## ---------------------------------------- ##
+# AT_CHECK_AUTOCONF
+# -----------------
+AT_DEFINE([AT_CHECK_AUTOCONF],
+[AT_CLEANUP_FILES(configure)dnl
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])])
+
+
+# AT_CHECK_AUTOHEADER
+# -------------------
+AT_DEFINE([AT_CHECK_AUTOHEADER],
+[AT_CLEANUP_FILES(config.hin)dnl
+AT_CHECK([autoheader --autoconf-dir .. -l $at_srcdir], 0, [], [])])
+
+
+# AT_CHECK_CONFIGURE
+# -------------------
+AT_DEFINE([AT_CHECK_CONFIGURE],
+[AT_CLEANUP_FILE_IFELSE([config.hin],
+ [AT_CLEANUP_FILE(config.h)])dnl
+AT_CLEANUP_FILES(config.log config.status config.cache)dnl
+AT_CHECK([top_srcdir=$top_srcdir ./configure], 0, ignore, [])
+test $at_verbose = echo && echo "--- config.log" && cat config.log])
+
+
# _AT_CHECK_AC_MACRO(AC-BODY, PRE-TESTS)
# --------------------------------------
# Create a minimalist configure.in running the macro named
@@ -34,6 +58,7 @@
# `config.guess' etc.).
AT_DEFINE([_AT_CHECK_AC_MACRO],
[dnl Produce the configure.in
+AT_CLEANUP_FILES(env-after state*)dnl
AT_DATA([configure.in],
[AC_INIT
AC_CONFIG_AUX_DIR($top_srcdir)
@@ -44,11 +69,9 @@
AC_OUTPUT
])
$2
-rm -f state*
-AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
-AT_CHECK([autoheader --autoconf-dir .. -l $at_srcdir], 0, [], [])
-AT_CHECK([top_srcdir=$top_srcdir ./configure], 0, ignore, [])
-test $at_verbose = echo && echo "--- config.log" && cat config.log
+AT_CHECK_AUTOCONF
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
dnl Some tests might exit prematurely when they find a problem, in
dnl which case `env-after' is probably missing. Don't check it then.
@@ -58,7 +81,6 @@
cp -f state-ls.before expout
AT_CHECK([cat state-ls.after], 0, expout)
fi
-rm -f state*
])# _AT_CHECK_AC_MACRO
@@ -74,7 +96,7 @@
_AT_CHECK_AC_MACRO([ifelse([$2],,[$1], [$2])])
$3
-AT_CLEANUP(configure config.status config.log config.cache config.hin config.h
env-after)dnl
+AT_CLEANUP()dnl
])# AT_CHECK_MACRO
@@ -93,7 +115,7 @@
[], [autoupdate: `configure.in' is updated
])])
-AT_CLEANUP(configure config.status config.log config.cache config.hin config.h
env-after)dnl
+AT_CLEANUP()dnl
])# AT_CHECK_UPDATE
Index: tests/base.at
--- tests/base.at Sat, 18 Nov 2000 15:36:51 +0100 akim (ace/b/29_base.m4 1.13
644)
+++ tests/base.at Sat, 18 Nov 2000 18:55:01 +0100 akim (ace/b/29_base.m4 1.13
644)
@@ -43,7 +43,7 @@ AC_DEFUN([TEST3],
AS_EXIT(0)
]])
-AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK_AUTOCONF
AT_CHECK([./configure], 0)
AT_CLEANUP(configure)
Index: tests/m4sh.at
--- tests/m4sh.at Sat, 18 Nov 2000 15:03:42 +0100 akim (ace/b/44_m4sh.at 1.5
644)
+++ tests/m4sh.at Sat, 18 Nov 2000 18:55:01 +0100 akim (ace/b/44_m4sh.at 1.5
644)
@@ -49,7 +49,7 @@
AS_EXIT(0)
]])
-AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK_AUTOCONF
AT_CHECK([./configure], 0)
AT_CLEANUP(configure)
@@ -79,7 +79,7 @@
AS_EXIT(0)
]])
-AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK_AUTOCONF
AT_CHECK([./configure], 0)
AT_CLEANUP(configure 1 a)
@@ -108,7 +108,7 @@
esac
]])
-AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK_AUTOCONF
AT_CHECK([./configure], 0)
AT_CLEANUP(configure)
Index: tests/semantics.at
--- tests/semantics.at Sat, 18 Nov 2000 12:03:30 +0100 akim
(ace/b/25_semantics. 1.24 644)
+++ tests/semantics.at Sat, 18 Nov 2000 18:56:50 +0100 akim
(ace/b/25_semantics. 1.24 644)
@@ -272,10 +272,10 @@
AS_EXIT(0)
]])
-AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
-AT_CHECK([./configure], 0, ignore)
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
-AT_CLEANUP(path config.log config.cache configure)
+AT_CLEANUP(path)
# ------------------------------ #
@@ -312,10 +312,10 @@
AS_EXIT(0)
]])
-AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
-AT_CHECK([./configure], 0, ignore)
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
-AT_CLEANUP(path config.log config.cache configure)
+AT_CLEANUP(path)
@@ -369,7 +369,7 @@
#define HAVE_STDIO_H 1
])
-AT_CLEANUP(configure config.status config.log config.cache config.hin config.h
env-after)dnl
+AT_CLEANUP()dnl
# Non-strict preprocessors work if they produce no warnings.
@@ -399,4 +399,4 @@
#define HAVE_STDIO_H 1
])
-AT_CLEANUP(configure config.status config.log config.cache config.hin config.h
env-after)dnl
+AT_CLEANUP()dnl
Index: tests/tools.at
--- tests/tools.at Sat, 18 Nov 2000 12:03:30 +0100 akim (ace/b/30_tools.m4 1.23
644)
+++ tests/tools.at Sat, 18 Nov 2000 18:55:01 +0100 akim (ace/b/30_tools.m4 1.23
644)
@@ -211,7 +211,7 @@
[autoupdate: `configure.in' is updated
])
AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0)
-AT_CHECK([./configure], 0, ignore)
+AT_CHECK_CONFIGURE
AT_CHECK([cat src1], 0, [dst1
])
AT_CHECK([cat src2], 0, [dst2
Index: tests/torture.at
--- tests/torture.at Sat, 18 Nov 2000 15:36:51 +0100 akim (ace/b/26_torture.m4
1.18 644)
+++ tests/torture.at Sat, 18 Nov 2000 18:55:01 +0100 akim (ace/b/26_torture.m4
1.18 644)
@@ -33,7 +33,7 @@
AC_OUTPUT
]])
-AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK_AUTOCONF
# Create a header
AT_CHECK([./configure what_to_test=header], 0, ignore)
@@ -71,7 +71,7 @@
AC_OUTPUT
]])
-AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK_AUTOCONF
AT_CHECK([./configure], 1, ignore,
[[config.status: error: cannot find input file `nonexistent.in'
]])
@@ -101,7 +101,7 @@
AC_OUTPUT
]])
-AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK_AUTOCONF
AT_CHECK([./configure one=one --enable-two=two --with-three=three |
sed -n -e 's/^result=//p'], 0,
@@ -170,7 +170,7 @@
]])
AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0)
-AT_CHECK([./configure], 0, ignore)
+AT_CHECK_CONFIGURE
AT_DATA(expout,
[[/* config.h. Generated automatically by configure. */
@@ -261,9 +261,9 @@ m4_define]([AC_DEFUBST_VALUE], Big_Value
AC_OUTPUT
])
-AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
-AT_CHECK([../autoheader --autoconf-dir .. -l $at_srcdir], 0, [], [])
-AT_CHECK([./configure], 0, ignore)
+AT_CHECK_AUTOCONF
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
# Checking that AC_DEFINE worked properly.
AT_DATA(expout,
- 39-at-cleanup-files.patch,
DEMAILLE Akim <=