@ai-ecoverse/wasix-autoconf 0.0.0-stage → 2.72.0-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +338 -0
- package/README.md +2 -2
- package/bin/autoconf +215 -0
- package/bin/autoheader +335 -0
- package/bin/autom4te +1174 -0
- package/bin/autoreconf +937 -0
- package/bin/autoscan +686 -0
- package/bin/autoupdate +1074 -0
- package/bin/ifnames +158 -0
- package/package.json +75 -4
- package/share/autoconf/Autom4te/C4che.pm +263 -0
- package/share/autoconf/Autom4te/ChannelDefs.pm +549 -0
- package/share/autoconf/Autom4te/Channels.pm +856 -0
- package/share/autoconf/Autom4te/Config.pm +43 -0
- package/share/autoconf/Autom4te/Configure_ac.pm +112 -0
- package/share/autoconf/Autom4te/FileUtils.pm +429 -0
- package/share/autoconf/Autom4te/General.pm +413 -0
- package/share/autoconf/Autom4te/Getopt.pm +99 -0
- package/share/autoconf/Autom4te/Request.pm +121 -0
- package/share/autoconf/Autom4te/XFile.pm +304 -0
- package/share/autoconf/INSTALL +368 -0
- package/share/autoconf/autoconf/autoconf.m4 +105 -0
- package/share/autoconf/autoconf/autoconf.m4f +15460 -0
- package/share/autoconf/autoconf/autoheader.m4 +78 -0
- package/share/autoconf/autoconf/autoscan.m4 +51 -0
- package/share/autoconf/autoconf/autotest.m4 +81 -0
- package/share/autoconf/autoconf/autoupdate.m4 +123 -0
- package/share/autoconf/autoconf/c.m4 +2794 -0
- package/share/autoconf/autoconf/erlang.m4 +270 -0
- package/share/autoconf/autoconf/fortran.m4 +1933 -0
- package/share/autoconf/autoconf/functions.m4 +2127 -0
- package/share/autoconf/autoconf/general.m4 +3374 -0
- package/share/autoconf/autoconf/go.m4 +177 -0
- package/share/autoconf/autoconf/headers.m4 +839 -0
- package/share/autoconf/autoconf/lang.m4 +730 -0
- package/share/autoconf/autoconf/libs.m4 +493 -0
- package/share/autoconf/autoconf/oldnames.m4 +92 -0
- package/share/autoconf/autoconf/programs.m4 +1015 -0
- package/share/autoconf/autoconf/specific.m4 +763 -0
- package/share/autoconf/autoconf/status.m4 +1787 -0
- package/share/autoconf/autoconf/trailer.m4 +4 -0
- package/share/autoconf/autoconf/types.m4 +1133 -0
- package/share/autoconf/autom4te.cfg +169 -0
- package/share/autoconf/autoscan/autoscan.list +264 -0
- package/share/autoconf/autotest/autotest.m4 +27 -0
- package/share/autoconf/autotest/autotest.m4f +3915 -0
- package/share/autoconf/autotest/general.m4 +2292 -0
- package/share/autoconf/autotest/specific.m4 +74 -0
- package/share/autoconf/build-aux/config.guess +1807 -0
- package/share/autoconf/build-aux/config.sub +1960 -0
- package/share/autoconf/build-aux/install-sh +541 -0
- package/share/autoconf/m4sugar/foreach.m4 +362 -0
- package/share/autoconf/m4sugar/m4sh.m4 +2217 -0
- package/share/autoconf/m4sugar/m4sh.m4f +2046 -0
- package/share/autoconf/m4sugar/m4sugar.m4 +3307 -0
- package/share/autoconf/m4sugar/m4sugar.m4f +868 -0
- package/share/autoconf/version.m4 +12 -0
|
@@ -0,0 +1,2292 @@
|
|
|
1
|
+
# This file is part of Autoconf. -*- Autoconf -*-
|
|
2
|
+
# M4 macros used in building test suites.
|
|
3
|
+
m4_define([_AT_COPYRIGHT_YEARS], [
|
|
4
|
+
Copyright (C) 2000-2017, 2020-2023 Free Software Foundation, Inc.
|
|
5
|
+
])
|
|
6
|
+
|
|
7
|
+
# This file is part of Autoconf. This program is free
|
|
8
|
+
# software; you can redistribute it and/or modify it under the
|
|
9
|
+
# terms of the GNU General Public License as published by the
|
|
10
|
+
# Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# Under Section 7 of GPL version 3, you are granted additional
|
|
19
|
+
# permissions described in the Autoconf Configure Script Exception,
|
|
20
|
+
# version 3.0, as published by the Free Software Foundation.
|
|
21
|
+
#
|
|
22
|
+
# You should have received a copy of the GNU General Public License
|
|
23
|
+
# and a copy of the Autoconf Configure Script Exception along with
|
|
24
|
+
# this program; see the files COPYINGv3 and COPYING.EXCEPTION
|
|
25
|
+
# respectively. If not, see <https://www.gnu.org/licenses/>.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# _m4_divert(DIVERSION-NAME)
|
|
29
|
+
# --------------------------
|
|
30
|
+
# Convert a diversion name into its number. Otherwise, return
|
|
31
|
+
# DIVERSION-NAME which is supposed to be an actual diversion number.
|
|
32
|
+
# Of course it would be nicer to use m4_case here, instead of zillions
|
|
33
|
+
# of little macros, but it then takes twice longer to run 'autoconf'!
|
|
34
|
+
#
|
|
35
|
+
# From M4sugar:
|
|
36
|
+
# -1. KILL
|
|
37
|
+
# 10000. GROW
|
|
38
|
+
#
|
|
39
|
+
# From M4sh:
|
|
40
|
+
# 0. BINSH
|
|
41
|
+
# 1. HEADER-REVISION
|
|
42
|
+
# 2. HEADER-COMMENT
|
|
43
|
+
# 3. HEADER-COPYRIGHT
|
|
44
|
+
# 4. M4SH-SANITIZE
|
|
45
|
+
# 5. M4SH-INIT
|
|
46
|
+
# 1000. BODY
|
|
47
|
+
#
|
|
48
|
+
# Defined below:
|
|
49
|
+
# - DEFAULTS
|
|
50
|
+
# Overall initialization, value of $at_groups_all.
|
|
51
|
+
# - PARSE_ARGS_BEGIN
|
|
52
|
+
# Setup defaults required for option processing.
|
|
53
|
+
# - PARSE_ARGS
|
|
54
|
+
# Option processing. After AT_INIT, user options can be entered here as
|
|
55
|
+
# cases of a case statement.
|
|
56
|
+
# - PARSE_ARGS_END
|
|
57
|
+
# Finish up the option processing.
|
|
58
|
+
#
|
|
59
|
+
# - HELP
|
|
60
|
+
# Start printing the help message.
|
|
61
|
+
# - HELP_MODES
|
|
62
|
+
# Modes help text. Additional modes can be appended as self-contained
|
|
63
|
+
# cat'd here-docs as generated by AS_HELP_STRING.
|
|
64
|
+
# - HELP_TUNING_BEGIN
|
|
65
|
+
# Tuning help text. This is for Autotest-provided text.
|
|
66
|
+
# - HELP_TUNING
|
|
67
|
+
# Additional tuning options' help text can be appended here as
|
|
68
|
+
# self-contained cat'd here-docs as generated by AS_HELP_STRING.
|
|
69
|
+
# - HELP_OTHER
|
|
70
|
+
# User help can be appended to this as self-contained cat'd here-docs.
|
|
71
|
+
# - HELP_END
|
|
72
|
+
# Finish up the help texts.
|
|
73
|
+
#
|
|
74
|
+
# - VERSION
|
|
75
|
+
# Head of the handling of --version.
|
|
76
|
+
# - VERSION_NOTICES
|
|
77
|
+
# Copyright notices for --version.
|
|
78
|
+
# - VERSION_END
|
|
79
|
+
# Tail of the handling of --version.
|
|
80
|
+
#
|
|
81
|
+
# - BANNERS
|
|
82
|
+
# Output shell initialization for the associative array of banner text.
|
|
83
|
+
# - TESTS_BEGIN
|
|
84
|
+
# Like DEFAULTS but run after argument processing for purposes of
|
|
85
|
+
# optimization. Do anything else that needs to be done to prepare for
|
|
86
|
+
# tests. Sets up verbose and log file descriptors. Sets and logs PATH.
|
|
87
|
+
# - PREPARE_TESTS
|
|
88
|
+
# Declares functions shared among the tests. Perform any user
|
|
89
|
+
# initialization to be shared among all tests.
|
|
90
|
+
# - TESTS
|
|
91
|
+
# The core of the test suite.
|
|
92
|
+
#
|
|
93
|
+
# - TEST_SCRIPT
|
|
94
|
+
# The collector for code for each test, the "normal" diversion, but
|
|
95
|
+
# undiverted into other locations before final output.
|
|
96
|
+
#
|
|
97
|
+
# - TEST_GROUPS
|
|
98
|
+
# Contents of each test group. The tests deliberately occur after the
|
|
99
|
+
# end of the shell script, so that the shell need not spend time parsing
|
|
100
|
+
# commands it will not execute.
|
|
101
|
+
|
|
102
|
+
m4_define([_m4_divert(DEFAULTS)], 100)
|
|
103
|
+
m4_define([_m4_divert(PARSE_ARGS_BEGIN)], 200)
|
|
104
|
+
m4_define([_m4_divert(PARSE_ARGS)], 201)
|
|
105
|
+
m4_define([_m4_divert(PARSE_ARGS_END)], 202)
|
|
106
|
+
m4_define([_m4_divert(HELP)], 300)
|
|
107
|
+
m4_define([_m4_divert(HELP_MODES)], 301)
|
|
108
|
+
m4_define([_m4_divert(HELP_TUNING_BEGIN)], 302)
|
|
109
|
+
m4_define([_m4_divert(HELP_TUNING)], 303)
|
|
110
|
+
m4_define([_m4_divert(HELP_OTHER)], 304)
|
|
111
|
+
m4_define([_m4_divert(HELP_END)], 305)
|
|
112
|
+
m4_define([_m4_divert(VERSION)], 350)
|
|
113
|
+
m4_define([_m4_divert(VERSION_NOTICES)], 351)
|
|
114
|
+
m4_define([_m4_divert(VERSION_END)], 352)
|
|
115
|
+
m4_define([_m4_divert(BANNERS)], 400)
|
|
116
|
+
m4_define([_m4_divert(TESTS_BEGIN)], 401)
|
|
117
|
+
m4_define([_m4_divert(PREPARE_TESTS)], 402)
|
|
118
|
+
m4_define([_m4_divert(TESTS)], 403)
|
|
119
|
+
m4_define([_m4_divert(TEST_SCRIPT)], 450)
|
|
120
|
+
m4_define([_m4_divert(TEST_GROUPS)], 500)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# AT_LINE
|
|
124
|
+
# -------
|
|
125
|
+
# Return the current file sans directory, a colon, and the current
|
|
126
|
+
# line. Be sure to return a _quoted_ file name, so if, for instance,
|
|
127
|
+
# the user is lunatic enough to have a file named 'dnl' (and I, for
|
|
128
|
+
# one, love to be brainless and stubborn sometimes), then we return a
|
|
129
|
+
# quoted name.
|
|
130
|
+
#
|
|
131
|
+
# Gee, we can't use simply
|
|
132
|
+
#
|
|
133
|
+
# m4_bpatsubst(__file__, [^.*/\(.*\)], [[\1]])
|
|
134
|
+
#
|
|
135
|
+
# since then, since 'dnl' doesn't match the pattern, it is returned
|
|
136
|
+
# with once quotation level less, so you lose! And since GNU M4
|
|
137
|
+
# is one of the biggest junk in the whole universe wrt regexp, don't
|
|
138
|
+
# even think about using '?' or '\?'. Bah, '*' will do.
|
|
139
|
+
# Pleeeeeeeease, Gary, provide us with dirname and ERE!
|
|
140
|
+
#
|
|
141
|
+
# M4 recompiles the regular expression for every m4_bpatsubst, but __file__
|
|
142
|
+
# rarely changes. Be fast - only compute the dirname when necessary; for
|
|
143
|
+
# autoconf alone, this shaves off several seconds in building testsuite.
|
|
144
|
+
m4_define([_AT_LINE_file])
|
|
145
|
+
m4_define([_AT_LINE_base])
|
|
146
|
+
m4_define([AT_LINE],
|
|
147
|
+
[m4_if(m4_defn([_AT_LINE_file]), __file__, [],
|
|
148
|
+
[m4_do([m4_define([_AT_LINE_file], __file__)],
|
|
149
|
+
[m4_define([_AT_LINE_base],
|
|
150
|
+
m4_bregexp(/__file__, [/\([^/]*\)$], [[\1]]))])])dnl
|
|
151
|
+
m4_defn([_AT_LINE_base]):__line__])
|
|
152
|
+
|
|
153
|
+
# _AT_LINE_ESCAPED
|
|
154
|
+
# ----------------
|
|
155
|
+
# Same as AT_LINE, but already escaped for the shell.
|
|
156
|
+
m4_define([_AT_LINE_ESCAPED], ["AS_ESCAPE(m4_dquote(AT_LINE))"])
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
# _AT_NORMALIZE_TEST_GROUP_NUMBER(SHELL-VAR)
|
|
160
|
+
# ------------------------------------------
|
|
161
|
+
# Normalize SHELL-VAR so that its value has the same number of digits as
|
|
162
|
+
# all the other test group numbers.
|
|
163
|
+
m4_define([_AT_NORMALIZE_TEST_GROUP_NUMBER],
|
|
164
|
+
[
|
|
165
|
+
eval 'while :; do
|
|
166
|
+
case $$1 in #(
|
|
167
|
+
'"$at_format"'*) break;;
|
|
168
|
+
esac
|
|
169
|
+
$1=0$$1
|
|
170
|
+
done'
|
|
171
|
+
])
|
|
172
|
+
|
|
173
|
+
# _AT_DEFINE_INIT(NAME, [DEFINITION])
|
|
174
|
+
# -----------------------------------
|
|
175
|
+
# Define macro NAME to die if invoked prior to AT_INIT, and to DEFINITION
|
|
176
|
+
# after AT_INIT.
|
|
177
|
+
m4_define([_AT_DEFINE_INIT],
|
|
178
|
+
[m4_define($@)m4_pushdef([$1], [m4_fatal([$1: missing AT_INIT detected])])dnl
|
|
179
|
+
m4_append([_AT_DEFINE_INIT_LIST], [[$1]], [,])])
|
|
180
|
+
|
|
181
|
+
# _AT_DEFINE_SETUP(NAME, [DEFINITION])
|
|
182
|
+
# ------------------------------------
|
|
183
|
+
# Define macro NAME to die if invoked outside AT_SETUP/AT_CLEANUP, and
|
|
184
|
+
# to DEFINITION otherwise.
|
|
185
|
+
m4_define([_AT_DEFINE_SETUP],
|
|
186
|
+
[m4_define([$1], [m4_ifndef([AT_ingroup],
|
|
187
|
+
[m4_fatal([$1: missing AT_SETUP detected])])$2])])
|
|
188
|
+
|
|
189
|
+
# AS_MESSAGE_LOG_FD
|
|
190
|
+
# -----------------
|
|
191
|
+
# File descriptor open on the log file. This needs to be defined
|
|
192
|
+
# unconditionally, so that AT_TESTS_PREPARE code can use it. Usage
|
|
193
|
+
# prior to the point where the log file is opened will crash the
|
|
194
|
+
# testsuite.
|
|
195
|
+
m4_define([AS_MESSAGE_LOG_FD], [5])
|
|
196
|
+
|
|
197
|
+
# AT_JOB_FIFO_{IN,OUT}_FD
|
|
198
|
+
# -----------------
|
|
199
|
+
# Used by the parallel test driver.
|
|
200
|
+
# The parent needs two fds to the same fifo, otherwise, there is a race
|
|
201
|
+
# where the parent can read the fifo before a child opens it for writing
|
|
202
|
+
_AT_DEFINE_INIT([AT_JOB_FIFO_IN_FD], [6])
|
|
203
|
+
_AT_DEFINE_INIT([AT_JOB_FIFO_OUT_FD], [7])
|
|
204
|
+
|
|
205
|
+
# AT_INIT([TESTSUITE-NAME])
|
|
206
|
+
# -------------------------
|
|
207
|
+
# Begin test suite.
|
|
208
|
+
m4_define([AT_INIT],
|
|
209
|
+
[m4_pushdef([AT_INIT], [m4_fatal([$0: invoked multiple times])])]
|
|
210
|
+
[m4_pattern_forbid([^_?AT_])]
|
|
211
|
+
[m4_pattern_allow([^_ATEOF$])]
|
|
212
|
+
[m4_ifndef([AT_PACKAGE_BUGREPORT], [m4_fatal(
|
|
213
|
+
[$1: AT_PACKAGE_BUGREPORT is missing, consider writing package.m4])])]
|
|
214
|
+
[m4_define([AT_TESTSUITE_NAME],
|
|
215
|
+
m4_defn([AT_PACKAGE_STRING])[ test suite]m4_ifval([$1],
|
|
216
|
+
[m4_expand([: $1])]))]
|
|
217
|
+
[m4_define([AT_ordinal], 0)]
|
|
218
|
+
[m4_define([AT_banner_ordinal], 0)]
|
|
219
|
+
[m4_define([AT_help_all], [])]
|
|
220
|
+
[m4_map_args([_m4_popdef], _AT_DEFINE_INIT_LIST)]
|
|
221
|
+
[m4_wrap([_AT_FINISH])]
|
|
222
|
+
[AS_INIT[]]dnl
|
|
223
|
+
dnl We don't use m4sh's BODY diversion, but AS_INIT sticks a banner there.
|
|
224
|
+
dnl This trick removes that banner, since it adds nothing to autotest.
|
|
225
|
+
[m4_cleardivert([BODY])]dnl
|
|
226
|
+
[AS_ME_PREPARE[]]dnl
|
|
227
|
+
[m4_divert_push([DEFAULTS])]dnl
|
|
228
|
+
[AT_COPYRIGHT(m4_defn([_AT_COPYRIGHT_YEARS]), [
|
|
229
|
+
m4_copyright_condense])]
|
|
230
|
+
[AT_COPYRIGHT(
|
|
231
|
+
[This test suite is free software; the Free Software Foundation gives
|
|
232
|
+
unlimited permission to copy, distribute and modify it.], [m4_echo])]
|
|
233
|
+
[AS_PREPARE
|
|
234
|
+
|
|
235
|
+
SHELL=${CONFIG_SHELL-/bin/sh}
|
|
236
|
+
|
|
237
|
+
# How were we run?
|
|
238
|
+
at_cli_args="$[@]"
|
|
239
|
+
|
|
240
|
+
m4_divert_push([BANNERS])dnl
|
|
241
|
+
|
|
242
|
+
# Should we print banners? Yes if more than one test is run.
|
|
243
|
+
case $at_groups in #(
|
|
244
|
+
*$as_nl* )
|
|
245
|
+
at_print_banners=: ;; #(
|
|
246
|
+
* ) at_print_banners=false ;;
|
|
247
|
+
esac
|
|
248
|
+
# Text for banner N, set to a single space once printed.
|
|
249
|
+
m4_divert_pop([BANNERS])dnl back to DEFAULTS
|
|
250
|
+
m4_divert_push([PREPARE_TESTS])dnl
|
|
251
|
+
|
|
252
|
+
m4_text_box([Autotest shell functions.])
|
|
253
|
+
|
|
254
|
+
AS_FUNCTION_DESCRIBE([at_fn_banner], [NUMBER],
|
|
255
|
+
[Output banner NUMBER, provided the testsuite is running multiple groups
|
|
256
|
+
and this particular banner has not yet been printed.])
|
|
257
|
+
at_fn_banner ()
|
|
258
|
+
{
|
|
259
|
+
$at_print_banners || return 0
|
|
260
|
+
eval at_banner_text=\$at_banner_text_$[1]
|
|
261
|
+
test "x$at_banner_text" = "x " && return 0
|
|
262
|
+
eval "at_banner_text_$[1]=\" \""
|
|
263
|
+
if test -z "$at_banner_text"; then
|
|
264
|
+
$at_first || echo
|
|
265
|
+
else
|
|
266
|
+
AS_ECHO(["$as_nl$at_banner_text$as_nl"])
|
|
267
|
+
fi
|
|
268
|
+
} # at_fn_banner
|
|
269
|
+
|
|
270
|
+
AS_FUNCTION_DESCRIBE([at_fn_check_prepare_notrace], [REASON LINE],
|
|
271
|
+
[Perform AT_CHECK preparations for the command at LINE for an
|
|
272
|
+
untraceable command; REASON is the reason for disabling tracing.])
|
|
273
|
+
at_fn_check_prepare_notrace ()
|
|
274
|
+
{
|
|
275
|
+
$at_trace_echo "Not enabling shell tracing (command contains $[1])"
|
|
276
|
+
AS_ECHO(["$[2]"]) >"$at_check_line_file"
|
|
277
|
+
at_check_trace=: at_check_filter=:
|
|
278
|
+
: >"$at_stdout"; : >"$at_stderr"
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
AS_FUNCTION_DESCRIBE([at_fn_check_prepare_trace], [LINE],
|
|
282
|
+
[Perform AT_CHECK preparations for the command at LINE for a traceable
|
|
283
|
+
command.])
|
|
284
|
+
at_fn_check_prepare_trace ()
|
|
285
|
+
{
|
|
286
|
+
AS_ECHO(["$[1]"]) >"$at_check_line_file"
|
|
287
|
+
at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace
|
|
288
|
+
: >"$at_stdout"; : >"$at_stderr"
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
AS_FUNCTION_DESCRIBE([at_fn_check_prepare_dynamic], [COMMAND LINE],
|
|
292
|
+
[Decide if COMMAND at LINE is traceable at runtime, and call the
|
|
293
|
+
appropriate preparation function.])
|
|
294
|
+
at_fn_check_prepare_dynamic ()
|
|
295
|
+
{
|
|
296
|
+
case $[1] in
|
|
297
|
+
*$as_nl*)
|
|
298
|
+
at_fn_check_prepare_notrace 'an embedded newline' "$[2]" ;;
|
|
299
|
+
*)
|
|
300
|
+
at_fn_check_prepare_trace "$[2]" ;;
|
|
301
|
+
esac
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
AS_FUNCTION_DESCRIBE([at_fn_filter_trace], [],
|
|
305
|
+
[Remove the lines in the file "$at_stderr" generated by "set -x" and print
|
|
306
|
+
them to stderr.])
|
|
307
|
+
at_fn_filter_trace ()
|
|
308
|
+
{
|
|
309
|
+
mv "$at_stderr" "$at_stder1"
|
|
310
|
+
grep '^ *+' "$at_stder1" >&2
|
|
311
|
+
grep -v '^ *+' "$at_stder1" >"$at_stderr"
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
AS_FUNCTION_DESCRIBE([at_fn_log_failure], [FILE-LIST],
|
|
315
|
+
[Copy the files in the list on stdout with a "> " prefix, and exit the shell
|
|
316
|
+
with a failure exit code.])
|
|
317
|
+
at_fn_log_failure ()
|
|
318
|
+
{
|
|
319
|
+
for file
|
|
320
|
+
do AS_ECHO(["$file:"]); sed 's/^/> /' "$file"; done
|
|
321
|
+
echo 1 > "$at_status_file"
|
|
322
|
+
exit 1
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
AS_FUNCTION_DESCRIBE([at_fn_check_skip], [EXIT-CODE LINE],
|
|
326
|
+
[Check whether EXIT-CODE is a special exit code (77 or 99), and if so exit
|
|
327
|
+
the test group subshell with that same exit code. Use LINE in any report
|
|
328
|
+
about test failure.])
|
|
329
|
+
at_fn_check_skip ()
|
|
330
|
+
{
|
|
331
|
+
case $[1] in
|
|
332
|
+
99) echo 99 > "$at_status_file"; at_failed=:
|
|
333
|
+
AS_ECHO(["$[2]: hard failure"]); exit 99;;
|
|
334
|
+
77) echo 77 > "$at_status_file"; exit 77;;
|
|
335
|
+
esac
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
AS_FUNCTION_DESCRIBE([at_fn_check_status], [EXPECTED EXIT-CODE LINE],
|
|
339
|
+
[Check whether EXIT-CODE is the EXPECTED exit code, and if so do nothing.
|
|
340
|
+
Otherwise, if it is 77 or 99, exit the test group subshell with that same
|
|
341
|
+
exit code; if it is anything else print an error message referring to LINE,
|
|
342
|
+
and fail the test.])
|
|
343
|
+
at_fn_check_status ()
|
|
344
|
+
{
|
|
345
|
+
dnl This order ensures that we don't 'skip' if we are precisely checking
|
|
346
|
+
dnl $? = 77 or $? = 99.
|
|
347
|
+
case $[2] in
|
|
348
|
+
$[1] ) ;;
|
|
349
|
+
77) echo 77 > "$at_status_file"; exit 77;;
|
|
350
|
+
99) echo 99 > "$at_status_file"; at_failed=:
|
|
351
|
+
AS_ECHO(["$[3]: hard failure"]); exit 99;;
|
|
352
|
+
*) AS_ECHO(["$[3]: exit code was $[2], expected $[1]"])
|
|
353
|
+
at_failed=:;;
|
|
354
|
+
esac
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
AS_FUNCTION_DESCRIBE([at_fn_diff_devnull], [FILE],
|
|
358
|
+
[Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless
|
|
359
|
+
diff invocations.])
|
|
360
|
+
at_fn_diff_devnull ()
|
|
361
|
+
{
|
|
362
|
+
test -s "$[1]" || return 0
|
|
363
|
+
$at_diff "$at_devnull" "$[1]"
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
AS_FUNCTION_DESCRIBE([at_fn_test], [NUMBER],
|
|
367
|
+
[Parse out test NUMBER from the tail of this file.])
|
|
368
|
+
at_fn_test ()
|
|
369
|
+
{
|
|
370
|
+
eval at_sed=\$at_sed$[1]
|
|
371
|
+
sed "$at_sed" "$at_myself" > "$at_test_source"
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
AS_FUNCTION_DESCRIBE([at_fn_create_debugging_script], [],
|
|
375
|
+
[Create the debugging script $at_group_dir/run which will reproduce the
|
|
376
|
+
current test group.])
|
|
377
|
+
at_fn_create_debugging_script ()
|
|
378
|
+
{
|
|
379
|
+
{
|
|
380
|
+
echo "#! /bin/sh" &&
|
|
381
|
+
echo 'test ${ZSH_VERSION+y} dnl
|
|
382
|
+
&& alias -g '\''${1+"$[@]"}'\''='\''"$[@]"'\''' &&
|
|
383
|
+
AS_ECHO(["cd '$at_dir'"]) &&
|
|
384
|
+
AS_ECHO(["exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d ]dnl
|
|
385
|
+
[$at_debug_args $at_group \${1+\"\$[@]\"}"]) &&
|
|
386
|
+
echo 'exit 1'
|
|
387
|
+
} >"$at_group_dir/run" &&
|
|
388
|
+
chmod +x "$at_group_dir/run"
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
m4_text_box([End of autotest shell functions.])
|
|
392
|
+
m4_divert_pop([PREPARE_TESTS])dnl back to DEFAULTS
|
|
393
|
+
|
|
394
|
+
# Not all shells have the 'times' builtin; the subshell is needed to make
|
|
395
|
+
# sure we discard the 'times: not found' message from the shell.
|
|
396
|
+
at_times_p=false
|
|
397
|
+
(times) >/dev/null 2>&1 && at_times_p=:
|
|
398
|
+
|
|
399
|
+
# CLI Arguments to pass to the debugging scripts.
|
|
400
|
+
at_debug_args=
|
|
401
|
+
# -e sets to true
|
|
402
|
+
at_errexit_p=false
|
|
403
|
+
# Shall we be verbose? ':' means no, empty means yes.
|
|
404
|
+
at_verbose=:
|
|
405
|
+
at_quiet=
|
|
406
|
+
# Running several jobs in parallel, 0 means as many as test groups.
|
|
407
|
+
at_jobs=1
|
|
408
|
+
at_traceon=:
|
|
409
|
+
at_trace_echo=:
|
|
410
|
+
at_check_filter_trace=:
|
|
411
|
+
|
|
412
|
+
# Shall we keep the debug scripts? Must be ':' when the suite is
|
|
413
|
+
# run by a debug script, so that the script doesn't remove itself.
|
|
414
|
+
at_debug_p=false
|
|
415
|
+
# Display help message?
|
|
416
|
+
at_help_p=false
|
|
417
|
+
# Display the version message?
|
|
418
|
+
at_version_p=false
|
|
419
|
+
# List test groups?
|
|
420
|
+
at_list_p=false
|
|
421
|
+
# --clean
|
|
422
|
+
at_clean=false
|
|
423
|
+
# Test groups to run
|
|
424
|
+
at_groups=
|
|
425
|
+
# Whether to rerun failed tests.
|
|
426
|
+
at_recheck=
|
|
427
|
+
# Whether a write failure occurred
|
|
428
|
+
at_write_fail=0
|
|
429
|
+
|
|
430
|
+
# The directory we run the suite in. Default to . if no -C option.
|
|
431
|
+
at_dir=`pwd`
|
|
432
|
+
# An absolute reference to this testsuite script.
|
|
433
|
+
dnl m4-double quote, to preserve []
|
|
434
|
+
[case $as_myself in
|
|
435
|
+
[\\/]* | ?:[\\/]* ) at_myself=$as_myself ;;
|
|
436
|
+
* ) at_myself=$at_dir/$as_myself ;;
|
|
437
|
+
esac]
|
|
438
|
+
# Whether -C is in effect.
|
|
439
|
+
at_change_dir=false
|
|
440
|
+
m4_divert_pop([DEFAULTS])dnl
|
|
441
|
+
m4_define([_AT_FINISH],
|
|
442
|
+
[m4_ifdef([AT_ingroup], [m4_fatal([missing AT_CLEANUP detected])])dnl
|
|
443
|
+
m4_divert_text([DEFAULTS],
|
|
444
|
+
[
|
|
445
|
+
# Whether to enable colored test results.
|
|
446
|
+
at_color=m4_ifdef([AT_color], [AT_color], [no])
|
|
447
|
+
# As many question marks as there are digits in the last test group number.
|
|
448
|
+
# Used to normalize the test group numbers so that 'ls' lists them in
|
|
449
|
+
# numerical order.
|
|
450
|
+
at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [?])'
|
|
451
|
+
# Description of all the test groups.
|
|
452
|
+
at_help_all="AS_ESCAPE(m4_dquote(m4_defn([AT_help_all])))"
|
|
453
|
+
# List of the all the test groups.
|
|
454
|
+
at_groups_all=`AS_ECHO(["$at_help_all"]) | sed 's/;.*//'`
|
|
455
|
+
|
|
456
|
+
AS_FUNCTION_DESCRIBE([at_fn_validate_ranges], [NAME...],
|
|
457
|
+
[Validate and normalize the test group number contained in each
|
|
458
|
+
variable NAME. Leading zeroes are treated as decimal.])
|
|
459
|
+
at_fn_validate_ranges ()
|
|
460
|
+
{
|
|
461
|
+
for at_grp
|
|
462
|
+
do
|
|
463
|
+
eval at_value=\$$at_grp
|
|
464
|
+
if test $at_value -lt 1 || test $at_value -gt AT_ordinal; then
|
|
465
|
+
AS_ECHO(["invalid test group: $at_value"]) >&2
|
|
466
|
+
exit 1
|
|
467
|
+
fi
|
|
468
|
+
case $at_value in
|
|
469
|
+
0*) # We want to treat leading 0 as decimal, like expr and test, but
|
|
470
|
+
# AS_VAR_ARITH treats it as octal if it uses $(( )).
|
|
471
|
+
# With XSI shells, ${at_value#${at_value%%[1-9]*}} avoids the
|
|
472
|
+
# expr fork, but it is not worth the effort to determine if the
|
|
473
|
+
# shell supports XSI when the user can just avoid leading 0.
|
|
474
|
+
eval $at_grp='`expr $at_value + 0`' ;;
|
|
475
|
+
esac
|
|
476
|
+
done
|
|
477
|
+
}])])dnl
|
|
478
|
+
m4_divert_push([PARSE_ARGS])dnl
|
|
479
|
+
|
|
480
|
+
at_prev=
|
|
481
|
+
for at_option
|
|
482
|
+
do
|
|
483
|
+
# If the previous option needs an argument, assign it.
|
|
484
|
+
if test -n "$at_prev"; then
|
|
485
|
+
at_option=$at_prev=$at_option
|
|
486
|
+
at_prev=
|
|
487
|
+
fi
|
|
488
|
+
|
|
489
|
+
case $at_option in
|
|
490
|
+
*=?*) at_optarg=`expr "X$at_option" : '[[^=]]*=\(.*\)'` ;;
|
|
491
|
+
*) at_optarg= ;;
|
|
492
|
+
esac
|
|
493
|
+
|
|
494
|
+
case $at_option in
|
|
495
|
+
--help | -h )
|
|
496
|
+
at_help_p=:
|
|
497
|
+
;;
|
|
498
|
+
|
|
499
|
+
--list | -l )
|
|
500
|
+
at_list_p=:
|
|
501
|
+
;;
|
|
502
|
+
|
|
503
|
+
--version | -V )
|
|
504
|
+
at_version_p=:
|
|
505
|
+
;;
|
|
506
|
+
|
|
507
|
+
--clean | -c )
|
|
508
|
+
at_clean=:
|
|
509
|
+
;;
|
|
510
|
+
|
|
511
|
+
--color )
|
|
512
|
+
at_color=always
|
|
513
|
+
;;
|
|
514
|
+
--color=* )
|
|
515
|
+
case $at_optarg in
|
|
516
|
+
no | never | none) at_color=never ;;
|
|
517
|
+
auto | tty | if-tty) at_color=auto ;;
|
|
518
|
+
always | yes | force) at_color=always ;;
|
|
519
|
+
*) at_optname=`echo " $at_option" | sed 's/^ //; s/=.*//'`
|
|
520
|
+
AS_ERROR([unrecognized argument to $at_optname: $at_optarg]) ;;
|
|
521
|
+
esac
|
|
522
|
+
;;
|
|
523
|
+
|
|
524
|
+
--debug | -d )
|
|
525
|
+
at_debug_p=:
|
|
526
|
+
;;
|
|
527
|
+
|
|
528
|
+
--errexit | -e )
|
|
529
|
+
at_debug_p=:
|
|
530
|
+
at_errexit_p=:
|
|
531
|
+
;;
|
|
532
|
+
|
|
533
|
+
--verbose | -v )
|
|
534
|
+
at_verbose=; at_quiet=:
|
|
535
|
+
;;
|
|
536
|
+
|
|
537
|
+
--trace | -x )
|
|
538
|
+
at_traceon='set -x'
|
|
539
|
+
at_trace_echo=echo
|
|
540
|
+
at_check_filter_trace=at_fn_filter_trace
|
|
541
|
+
;;
|
|
542
|
+
|
|
543
|
+
[[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]])
|
|
544
|
+
at_fn_validate_ranges at_option
|
|
545
|
+
AS_VAR_APPEND([at_groups], ["$at_option$as_nl"])
|
|
546
|
+
;;
|
|
547
|
+
|
|
548
|
+
# Ranges
|
|
549
|
+
[[0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-])
|
|
550
|
+
at_range_start=`echo $at_option |tr -d X-`
|
|
551
|
+
at_fn_validate_ranges at_range_start
|
|
552
|
+
at_range=`AS_ECHO(["$at_groups_all"]) | \
|
|
553
|
+
sed -ne '/^'$at_range_start'$/,$p'`
|
|
554
|
+
AS_VAR_APPEND([at_groups], ["$at_range$as_nl"])
|
|
555
|
+
;;
|
|
556
|
+
|
|
557
|
+
[-[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]])
|
|
558
|
+
at_range_end=`echo $at_option |tr -d X-`
|
|
559
|
+
at_fn_validate_ranges at_range_end
|
|
560
|
+
at_range=`AS_ECHO(["$at_groups_all"]) | \
|
|
561
|
+
sed -ne '1,/^'$at_range_end'$/p'`
|
|
562
|
+
AS_VAR_APPEND([at_groups], ["$at_range$as_nl"])
|
|
563
|
+
;;
|
|
564
|
+
|
|
565
|
+
[[0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9]] | \
|
|
566
|
+
[[0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9]] | \
|
|
567
|
+
[[0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9]] | \
|
|
568
|
+
[[0-9][0-9][0-9]-[0-9][0-9][0-9]] | \
|
|
569
|
+
[[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]] | \
|
|
570
|
+
[[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]] )
|
|
571
|
+
at_range_start=`expr $at_option : '\(.*\)-'`
|
|
572
|
+
at_range_end=`expr $at_option : '.*-\(.*\)'`
|
|
573
|
+
if test $at_range_start -gt $at_range_end; then
|
|
574
|
+
at_tmp=$at_range_end
|
|
575
|
+
at_range_end=$at_range_start
|
|
576
|
+
at_range_start=$at_tmp
|
|
577
|
+
fi
|
|
578
|
+
at_fn_validate_ranges at_range_start at_range_end
|
|
579
|
+
at_range=`AS_ECHO(["$at_groups_all"]) | \
|
|
580
|
+
sed -ne '/^'$at_range_start'$/,/^'$at_range_end'$/p'`
|
|
581
|
+
AS_VAR_APPEND([at_groups], ["$at_range$as_nl"])
|
|
582
|
+
;;
|
|
583
|
+
|
|
584
|
+
# Directory selection.
|
|
585
|
+
--directory | -C )
|
|
586
|
+
at_prev=--directory
|
|
587
|
+
;;
|
|
588
|
+
--directory=* )
|
|
589
|
+
at_change_dir=:
|
|
590
|
+
at_dir=$at_optarg
|
|
591
|
+
if test x- = "x$at_dir" ; then
|
|
592
|
+
at_dir=./-
|
|
593
|
+
fi
|
|
594
|
+
;;
|
|
595
|
+
|
|
596
|
+
# Parallel execution.
|
|
597
|
+
--jobs | -j )
|
|
598
|
+
at_jobs=0
|
|
599
|
+
;;
|
|
600
|
+
--jobs=* | -j[[0-9]]* )
|
|
601
|
+
if test -n "$at_optarg"; then
|
|
602
|
+
at_jobs=$at_optarg
|
|
603
|
+
else
|
|
604
|
+
at_jobs=`expr X$at_option : 'X-j\(.*\)'`
|
|
605
|
+
fi
|
|
606
|
+
case $at_jobs in *[[!0-9]]*)
|
|
607
|
+
at_optname=`echo " $at_option" | sed 's/^ //; s/[[0-9=]].*//'`
|
|
608
|
+
AS_ERROR([non-numeric argument to $at_optname: $at_jobs]) ;;
|
|
609
|
+
esac
|
|
610
|
+
;;
|
|
611
|
+
|
|
612
|
+
# Keywords.
|
|
613
|
+
--keywords | -k )
|
|
614
|
+
at_prev=--keywords
|
|
615
|
+
;;
|
|
616
|
+
--keywords=* )
|
|
617
|
+
at_groups_selected=$at_help_all
|
|
618
|
+
at_save_IFS=$IFS
|
|
619
|
+
IFS=,
|
|
620
|
+
set X $at_optarg
|
|
621
|
+
shift
|
|
622
|
+
IFS=$at_save_IFS
|
|
623
|
+
for at_keyword
|
|
624
|
+
do
|
|
625
|
+
at_invert=
|
|
626
|
+
case $at_keyword in
|
|
627
|
+
'!'*)
|
|
628
|
+
at_invert="-v"
|
|
629
|
+
at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'`
|
|
630
|
+
;;
|
|
631
|
+
esac
|
|
632
|
+
# It is on purpose that we match the test group titles too.
|
|
633
|
+
at_groups_selected=`AS_ECHO(["$at_groups_selected"]) |
|
|
634
|
+
grep -i $at_invert ["^[1-9][^;]*;.*[; ]$at_keyword[ ;]"]`
|
|
635
|
+
done
|
|
636
|
+
# Smash the keywords.
|
|
637
|
+
at_groups_selected=`AS_ECHO(["$at_groups_selected"]) | sed 's/;.*//'`
|
|
638
|
+
AS_VAR_APPEND([at_groups], ["$at_groups_selected$as_nl"])
|
|
639
|
+
;;
|
|
640
|
+
--recheck)
|
|
641
|
+
at_recheck=:
|
|
642
|
+
;;
|
|
643
|
+
m4_divert_pop([PARSE_ARGS])dnl
|
|
644
|
+
dnl Process *=* last to allow for user specified --option=* type arguments.
|
|
645
|
+
m4_divert_push([PARSE_ARGS_END])dnl
|
|
646
|
+
|
|
647
|
+
*=*)
|
|
648
|
+
at_envvar=`expr "x$at_option" : 'x\([[^=]]*\)='`
|
|
649
|
+
# Reject names that are not valid shell variable names.
|
|
650
|
+
case $at_envvar in
|
|
651
|
+
'' | [[0-9]]* | *[[!_$as_cr_alnum]]* )
|
|
652
|
+
AS_ERROR([invalid variable name: '$at_envvar']) ;;
|
|
653
|
+
esac
|
|
654
|
+
at_value=`AS_ECHO(["$at_optarg"]) | sed "s/'/'\\\\\\\\''/g"`
|
|
655
|
+
# Export now, but save eval for later and for debug scripts.
|
|
656
|
+
export $at_envvar
|
|
657
|
+
AS_VAR_APPEND([at_debug_args], [" $at_envvar='$at_value'"])
|
|
658
|
+
;;
|
|
659
|
+
|
|
660
|
+
*) AS_ECHO(["$as_me: invalid option: $at_option"]) >&2
|
|
661
|
+
AS_ECHO(["Try '$[0] --help' for more information."]) >&2
|
|
662
|
+
exit 1
|
|
663
|
+
;;
|
|
664
|
+
esac
|
|
665
|
+
done
|
|
666
|
+
|
|
667
|
+
# Verify our last option didn't require an argument
|
|
668
|
+
AS_IF([test -n "$at_prev"], [AS_ERROR(['$at_prev' requires an argument])])
|
|
669
|
+
|
|
670
|
+
# The file containing the suite.
|
|
671
|
+
at_suite_log=$at_dir/$as_me.log
|
|
672
|
+
|
|
673
|
+
# Selected test groups.
|
|
674
|
+
if test -z "$at_groups$at_recheck"; then
|
|
675
|
+
at_groups=$at_groups_all
|
|
676
|
+
else
|
|
677
|
+
if test -n "$at_recheck" && test -r "$at_suite_log"; then
|
|
678
|
+
at_oldfails=`sed -n ['
|
|
679
|
+
/^Failed tests:$/,/^Skipped tests:$/{
|
|
680
|
+
s/^[ ]*\([1-9][0-9]*\):.*/\1/p
|
|
681
|
+
}
|
|
682
|
+
/^Unexpected passes:$/,/^## Detailed failed tests/{
|
|
683
|
+
s/^[ ]*\([1-9][0-9]*\):.*/\1/p
|
|
684
|
+
}
|
|
685
|
+
/^## Detailed failed tests/q
|
|
686
|
+
'] "$at_suite_log"`
|
|
687
|
+
AS_VAR_APPEND([at_groups], ["$at_oldfails$as_nl"])
|
|
688
|
+
fi
|
|
689
|
+
# Sort the tests, removing duplicates.
|
|
690
|
+
at_groups=`AS_ECHO(["$at_groups"]) | sort -nu | sed '/^$/d'`
|
|
691
|
+
fi
|
|
692
|
+
|
|
693
|
+
if test x"$at_color" = xalways \
|
|
694
|
+
|| { test x"$at_color" = xauto && test -t 1; }; then
|
|
695
|
+
at_red=`printf '\033@<:@0;31m'`
|
|
696
|
+
at_grn=`printf '\033@<:@0;32m'`
|
|
697
|
+
at_lgn=`printf '\033@<:@1;32m'`
|
|
698
|
+
at_blu=`printf '\033@<:@1;34m'`
|
|
699
|
+
at_std=`printf '\033@<:@m'`
|
|
700
|
+
else
|
|
701
|
+
at_red= at_grn= at_lgn= at_blu= at_std=
|
|
702
|
+
fi
|
|
703
|
+
m4_divert_pop([PARSE_ARGS_END])dnl
|
|
704
|
+
m4_divert_push([HELP])dnl
|
|
705
|
+
|
|
706
|
+
# Help message.
|
|
707
|
+
if $at_help_p; then
|
|
708
|
+
cat <<_ATEOF || at_write_fail=1
|
|
709
|
+
Usage: $[0] [[OPTION]... [VARIABLE=VALUE]... [TESTS]]
|
|
710
|
+
|
|
711
|
+
Run all the tests, or the selected TESTS, given by numeric ranges, and
|
|
712
|
+
save a detailed log file. Upon failure, create debugging scripts.
|
|
713
|
+
|
|
714
|
+
Do not change environment variables directly. Instead, set them via
|
|
715
|
+
command line arguments. Set 'AUTOTEST_PATH' to select the executables
|
|
716
|
+
to exercise. Each relative directory is expanded as build and source
|
|
717
|
+
directories relative to the top level of this distribution.
|
|
718
|
+
E.g., from within the build directory /tmp/foo-1.0, invoking this:
|
|
719
|
+
|
|
720
|
+
$ $[0] AUTOTEST_PATH=bin
|
|
721
|
+
|
|
722
|
+
is equivalent to the following, assuming the source directory is /src/foo-1.0:
|
|
723
|
+
|
|
724
|
+
PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH $[0]
|
|
725
|
+
_ATEOF
|
|
726
|
+
m4_divert_pop([HELP])dnl
|
|
727
|
+
m4_divert_push([HELP_MODES])dnl
|
|
728
|
+
cat <<_ATEOF || at_write_fail=1
|
|
729
|
+
|
|
730
|
+
Operation modes:
|
|
731
|
+
-h, --help print the help message, then exit
|
|
732
|
+
-V, --version print version number, then exit
|
|
733
|
+
-c, --clean remove all the files this test suite might create and exit
|
|
734
|
+
-l, --list describes all the tests, or the selected TESTS
|
|
735
|
+
_ATEOF
|
|
736
|
+
m4_divert_pop([HELP_MODES])dnl
|
|
737
|
+
m4_wrap([m4_divert_push([HELP_TUNING_BEGIN])dnl
|
|
738
|
+
cat <<_ATEOF || at_write_fail=1
|
|
739
|
+
|
|
740
|
+
dnl extra quoting prevents emacs whitespace mode from putting tabs in output
|
|
741
|
+
Execution tuning:
|
|
742
|
+
-C, --directory=DIR
|
|
743
|
+
[ change to directory DIR before starting]
|
|
744
|
+
--color[[=never|auto|always]]
|
|
745
|
+
[ ]m4_ifdef([AT_color],
|
|
746
|
+
[disable colored test results, or enable even without terminal],
|
|
747
|
+
[enable colored test results on terminal, or always])
|
|
748
|
+
-j, --jobs[[=N]]
|
|
749
|
+
[ Allow N jobs at once; infinite jobs with no arg (default 1)]
|
|
750
|
+
-k, --keywords=KEYWORDS
|
|
751
|
+
[ select the tests matching all the comma-separated KEYWORDS]
|
|
752
|
+
[ multiple '-k' accumulate; prefixed '!' negates a KEYWORD]
|
|
753
|
+
--recheck select all tests that failed or passed unexpectedly last time
|
|
754
|
+
-e, --errexit abort as soon as a test fails; implies --debug
|
|
755
|
+
-v, --verbose force more detailed output
|
|
756
|
+
[ default for debugging scripts]
|
|
757
|
+
-d, --debug inhibit clean up and top-level logging
|
|
758
|
+
[ default for debugging scripts]
|
|
759
|
+
-x, --trace enable tests shell tracing
|
|
760
|
+
_ATEOF
|
|
761
|
+
m4_divert_pop([HELP_TUNING_BEGIN])])dnl
|
|
762
|
+
m4_divert_push([HELP_END])dnl
|
|
763
|
+
cat <<_ATEOF || at_write_fail=1
|
|
764
|
+
|
|
765
|
+
Report bugs to <AT_PACKAGE_BUGREPORT>.dnl
|
|
766
|
+
m4_ifdef([AT_PACKAGE_NAME],
|
|
767
|
+
[m4_ifset([AT_PACKAGE_URL], [
|
|
768
|
+
m4_defn([AT_PACKAGE_NAME]) home page: <AT_PACKAGE_URL>.])dnl
|
|
769
|
+
m4_if(m4_index(m4_defn([AT_PACKAGE_NAME]), [GNU ]), [0], [
|
|
770
|
+
General help using GNU software: <https://www.gnu.org/gethelp/>.])])
|
|
771
|
+
_ATEOF
|
|
772
|
+
exit $at_write_fail
|
|
773
|
+
fi
|
|
774
|
+
|
|
775
|
+
# List of tests.
|
|
776
|
+
if $at_list_p; then
|
|
777
|
+
cat <<_ATEOF || at_write_fail=1
|
|
778
|
+
AT_TESTSUITE_NAME test groups:
|
|
779
|
+
|
|
780
|
+
NUM: FILE-NAME:LINE TEST-GROUP-NAME
|
|
781
|
+
KEYWORDS
|
|
782
|
+
|
|
783
|
+
_ATEOF
|
|
784
|
+
# Pass an empty line as separator between selected groups and help.
|
|
785
|
+
AS_ECHO(["$at_groups$as_nl$as_nl$at_help_all"]) |
|
|
786
|
+
awk 'NF == 1 && FS != ";" {
|
|
787
|
+
selected[[$ 1]] = 1
|
|
788
|
+
next
|
|
789
|
+
}
|
|
790
|
+
/^$/ { FS = ";" }
|
|
791
|
+
NF > 0 {
|
|
792
|
+
if (selected[[$ 1]]) {
|
|
793
|
+
printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3
|
|
794
|
+
if ($ 4) {
|
|
795
|
+
lmax = 79
|
|
796
|
+
indent = " "
|
|
797
|
+
line = indent
|
|
798
|
+
len = length (line)
|
|
799
|
+
n = split ($ 4, a, " ")
|
|
800
|
+
for (i = 1; i <= n; i++) {
|
|
801
|
+
l = length (a[[i]]) + 1
|
|
802
|
+
if (i > 1 && len + l > lmax) {
|
|
803
|
+
print line
|
|
804
|
+
line = indent " " a[[i]]
|
|
805
|
+
len = length (line)
|
|
806
|
+
} else {
|
|
807
|
+
line = line " " a[[i]]
|
|
808
|
+
len += l
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
if (n)
|
|
812
|
+
print line
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}' || at_write_fail=1
|
|
816
|
+
exit $at_write_fail
|
|
817
|
+
fi
|
|
818
|
+
m4_divert_pop([HELP_END])dnl
|
|
819
|
+
m4_divert_push([VERSION])dnl
|
|
820
|
+
if $at_version_p; then
|
|
821
|
+
AS_ECHO(["$as_me (AT_PACKAGE_STRING)"]) &&
|
|
822
|
+
cat <<\_ATEOF || at_write_fail=1
|
|
823
|
+
m4_divert_pop([VERSION])dnl
|
|
824
|
+
m4_divert_push([VERSION_END])dnl
|
|
825
|
+
_ATEOF
|
|
826
|
+
exit $at_write_fail
|
|
827
|
+
fi
|
|
828
|
+
m4_divert_pop([VERSION_END])dnl
|
|
829
|
+
m4_divert_push([TESTS_BEGIN])dnl
|
|
830
|
+
|
|
831
|
+
# Take any -C into account.
|
|
832
|
+
if $at_change_dir ; then
|
|
833
|
+
test x != "x$at_dir" && cd "$at_dir" \
|
|
834
|
+
|| AS_ERROR([unable to change directory])
|
|
835
|
+
at_dir=`pwd`
|
|
836
|
+
fi
|
|
837
|
+
|
|
838
|
+
# Load the config files for any default variable assignments.
|
|
839
|
+
for at_file in atconfig atlocal
|
|
840
|
+
do
|
|
841
|
+
test -r $at_file || continue
|
|
842
|
+
. ./$at_file || AS_ERROR([invalid content: $at_file])
|
|
843
|
+
done
|
|
844
|
+
|
|
845
|
+
# Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix:
|
|
846
|
+
: "${at_top_build_prefix=$at_top_builddir}"
|
|
847
|
+
|
|
848
|
+
# Perform any assignments requested during argument parsing.
|
|
849
|
+
eval "$at_debug_args"
|
|
850
|
+
|
|
851
|
+
# atconfig delivers names relative to the directory the test suite is
|
|
852
|
+
# in, but the groups themselves are run in testsuite-dir/group-dir.
|
|
853
|
+
if test -n "$at_top_srcdir"; then
|
|
854
|
+
builddir=../..
|
|
855
|
+
for at_dir_var in srcdir top_srcdir top_build_prefix
|
|
856
|
+
do
|
|
857
|
+
AS_VAR_COPY([at_val], [at_$at_dir_var])
|
|
858
|
+
case $at_val in
|
|
859
|
+
[[\\/$]]* | ?:[[\\/]]* ) at_prefix= ;;
|
|
860
|
+
*) at_prefix=../../ ;;
|
|
861
|
+
esac
|
|
862
|
+
AS_VAR_SET([$at_dir_var], [$at_prefix$at_val])
|
|
863
|
+
done
|
|
864
|
+
fi
|
|
865
|
+
|
|
866
|
+
m4_text_box([Directory structure.])
|
|
867
|
+
|
|
868
|
+
# This is the set of directories and files used by this script
|
|
869
|
+
# (non-literals are capitalized):
|
|
870
|
+
#
|
|
871
|
+
# TESTSUITE - the testsuite
|
|
872
|
+
# TESTSUITE.log - summarizes the complete testsuite run
|
|
873
|
+
# TESTSUITE.dir/ - created during a run, remains after -d or failed test
|
|
874
|
+
# + at-groups/ - during a run: status of all groups in run
|
|
875
|
+
# | + NNN/ - during a run: meta-data about test group NNN
|
|
876
|
+
# | | + check-line - location (source file and line) of current AT_CHECK
|
|
877
|
+
# | | + status - exit status of current AT_CHECK
|
|
878
|
+
# | | + stdout - stdout of current AT_CHECK
|
|
879
|
+
# | | + stder1 - stderr, including trace
|
|
880
|
+
# | | + stderr - stderr, with trace filtered out
|
|
881
|
+
# | | + test-source - portion of testsuite that defines group
|
|
882
|
+
# | | + times - timestamps for computing duration
|
|
883
|
+
# | | + pass - created if group passed
|
|
884
|
+
# | | + xpass - created if group xpassed
|
|
885
|
+
# | | + fail - created if group failed
|
|
886
|
+
# | | + xfail - created if group xfailed
|
|
887
|
+
# | | + skip - created if group skipped
|
|
888
|
+
# + at-stop - during a run: end the run if this file exists
|
|
889
|
+
# + at-source-lines - during a run: cache of TESTSUITE line numbers for extraction
|
|
890
|
+
# + 0..NNN/ - created for each group NNN, remains after -d or failed test
|
|
891
|
+
# | + TESTSUITE.log - summarizes the group results
|
|
892
|
+
# | + ... - files created during the group
|
|
893
|
+
|
|
894
|
+
# The directory the whole suite works in.
|
|
895
|
+
# Should be absolute to let the user 'cd' at will.
|
|
896
|
+
at_suite_dir=$at_dir/$as_me.dir
|
|
897
|
+
# The file containing the suite ($at_dir might have changed since earlier).
|
|
898
|
+
at_suite_log=$at_dir/$as_me.log
|
|
899
|
+
# The directory containing helper files per test group.
|
|
900
|
+
at_helper_dir=$at_suite_dir/at-groups
|
|
901
|
+
# Stop file: if it exists, do not start new jobs.
|
|
902
|
+
at_stop_file=$at_suite_dir/at-stop
|
|
903
|
+
# The fifo used for the job dispatcher.
|
|
904
|
+
at_job_fifo=$at_suite_dir/at-job-fifo
|
|
905
|
+
|
|
906
|
+
if $at_clean; then
|
|
907
|
+
test -d "$at_suite_dir" &&
|
|
908
|
+
find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
|
|
909
|
+
rm -f -r "$at_suite_dir" "$at_suite_log"
|
|
910
|
+
exit $?
|
|
911
|
+
fi
|
|
912
|
+
|
|
913
|
+
# Don't take risks: use only absolute directories in PATH.
|
|
914
|
+
#
|
|
915
|
+
# For stand-alone test suites (ie. atconfig was not found),
|
|
916
|
+
# AUTOTEST_PATH is relative to '.'.
|
|
917
|
+
#
|
|
918
|
+
# For embedded test suites, AUTOTEST_PATH is relative to the top level
|
|
919
|
+
# of the package. Then expand it into build/src parts, since users
|
|
920
|
+
# may create executables in both places.
|
|
921
|
+
AUTOTEST_PATH=`AS_ECHO(["$AUTOTEST_PATH"]) | sed "s|:|$PATH_SEPARATOR|g"`
|
|
922
|
+
at_path=
|
|
923
|
+
_AS_PATH_WALK([$AUTOTEST_PATH $PATH],
|
|
924
|
+
[test -n "$at_path" && AS_VAR_APPEND([at_path], [$PATH_SEPARATOR])
|
|
925
|
+
case $as_dir in
|
|
926
|
+
[[\\/]]* | ?:[[\\/]]* )
|
|
927
|
+
AS_VAR_APPEND([at_path], ["$as_dir"])
|
|
928
|
+
;;
|
|
929
|
+
* )
|
|
930
|
+
if test -z "$at_top_build_prefix"; then
|
|
931
|
+
# Stand-alone test suite.
|
|
932
|
+
AS_VAR_APPEND([at_path], ["$as_dir"])
|
|
933
|
+
else
|
|
934
|
+
# Embedded test suite.
|
|
935
|
+
AS_VAR_APPEND([at_path], ["$at_top_build_prefix$as_dir$PATH_SEPARATOR"])
|
|
936
|
+
AS_VAR_APPEND([at_path], ["$at_top_srcdir/$as_dir"])
|
|
937
|
+
fi
|
|
938
|
+
;;
|
|
939
|
+
esac])
|
|
940
|
+
|
|
941
|
+
# Now build and simplify PATH.
|
|
942
|
+
#
|
|
943
|
+
# There might be directories that don't exist, but don't redirect
|
|
944
|
+
# builtins' (eg., cd) stderr directly: Ultrix's sh hates that.
|
|
945
|
+
at_new_path=
|
|
946
|
+
_AS_PATH_WALK([$at_path],
|
|
947
|
+
[test -d "$as_dir" || continue
|
|
948
|
+
case $as_dir in
|
|
949
|
+
[[\\/]]* | ?:[[\\/]]* ) ;;
|
|
950
|
+
* ) as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` ;;
|
|
951
|
+
esac
|
|
952
|
+
case $PATH_SEPARATOR$at_new_path$PATH_SEPARATOR in
|
|
953
|
+
*$PATH_SEPARATOR$as_dir$PATH_SEPARATOR*) ;;
|
|
954
|
+
$PATH_SEPARATOR$PATH_SEPARATOR) at_new_path=$as_dir ;;
|
|
955
|
+
*) AS_VAR_APPEND([at_new_path], ["$PATH_SEPARATOR$as_dir"]) ;;
|
|
956
|
+
esac])
|
|
957
|
+
PATH=$at_new_path
|
|
958
|
+
export PATH
|
|
959
|
+
|
|
960
|
+
# Setting up the FDs.
|
|
961
|
+
[#] AS_MESSAGE_LOG_FD is the log file. Not to be overwritten if '-d'.
|
|
962
|
+
if $at_debug_p; then
|
|
963
|
+
at_suite_log=/dev/null
|
|
964
|
+
else
|
|
965
|
+
: >"$at_suite_log"
|
|
966
|
+
fi
|
|
967
|
+
exec AS_MESSAGE_LOG_FD>>"$at_suite_log"
|
|
968
|
+
|
|
969
|
+
# Banners and logs.
|
|
970
|
+
AS_BOX(m4_defn([AT_TESTSUITE_NAME])[.])
|
|
971
|
+
{
|
|
972
|
+
AS_BOX(m4_defn([AT_TESTSUITE_NAME])[.])
|
|
973
|
+
echo
|
|
974
|
+
|
|
975
|
+
AS_ECHO(["$as_me: command line was:"])
|
|
976
|
+
AS_ECHO([" \$ $[0] $at_cli_args"])
|
|
977
|
+
echo
|
|
978
|
+
|
|
979
|
+
# If ChangeLog exists, list a few lines in case it might help determining
|
|
980
|
+
# the exact version.
|
|
981
|
+
if test -n "$at_top_srcdir" && test -f "$at_top_srcdir/ChangeLog"; then
|
|
982
|
+
AS_BOX([ChangeLog.])
|
|
983
|
+
echo
|
|
984
|
+
sed 's/^/| /;10q' "$at_top_srcdir/ChangeLog"
|
|
985
|
+
echo
|
|
986
|
+
fi
|
|
987
|
+
|
|
988
|
+
AS_UNAME
|
|
989
|
+
echo
|
|
990
|
+
|
|
991
|
+
# Contents of the config files.
|
|
992
|
+
for at_file in atconfig atlocal
|
|
993
|
+
do
|
|
994
|
+
test -r $at_file || continue
|
|
995
|
+
AS_ECHO(["$as_me: $at_file:"])
|
|
996
|
+
sed 's/^/| /' $at_file
|
|
997
|
+
echo
|
|
998
|
+
done
|
|
999
|
+
} >&AS_MESSAGE_LOG_FD
|
|
1000
|
+
|
|
1001
|
+
m4_divert_pop([TESTS_BEGIN])dnl
|
|
1002
|
+
m4_divert_push([TESTS])dnl
|
|
1003
|
+
{
|
|
1004
|
+
AS_BOX([Running the tests.])
|
|
1005
|
+
} >&AS_MESSAGE_LOG_FD
|
|
1006
|
+
|
|
1007
|
+
at_start_date=`date`
|
|
1008
|
+
at_start_time=`date +%s 2>/dev/null`
|
|
1009
|
+
AS_ECHO(["$as_me: starting at: $at_start_date"]) >&AS_MESSAGE_LOG_FD
|
|
1010
|
+
|
|
1011
|
+
# Create the master directory if it doesn't already exist.
|
|
1012
|
+
AS_MKDIR_P(["$at_suite_dir"]) ||
|
|
1013
|
+
AS_ERROR([cannot create '$at_suite_dir'])
|
|
1014
|
+
|
|
1015
|
+
# Can we diff with '/dev/null'? DU 5.0 refuses.
|
|
1016
|
+
if diff /dev/null /dev/null >/dev/null 2>&1; then
|
|
1017
|
+
at_devnull=/dev/null
|
|
1018
|
+
else
|
|
1019
|
+
at_devnull=$at_suite_dir/devnull
|
|
1020
|
+
>"$at_devnull"
|
|
1021
|
+
fi
|
|
1022
|
+
|
|
1023
|
+
# Use 'diff -u' when possible.
|
|
1024
|
+
if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff"
|
|
1025
|
+
then
|
|
1026
|
+
at_diff='diff -u'
|
|
1027
|
+
else
|
|
1028
|
+
at_diff=diff
|
|
1029
|
+
fi
|
|
1030
|
+
|
|
1031
|
+
# Get the last needed group.
|
|
1032
|
+
for at_group in : $at_groups; do :; done
|
|
1033
|
+
|
|
1034
|
+
# Extract the start and end lines of each test group at the tail
|
|
1035
|
+
# of this file
|
|
1036
|
+
awk '
|
|
1037
|
+
BEGIN { FS="" }
|
|
1038
|
+
/^@%:@AT_START_/ {
|
|
1039
|
+
start = NR
|
|
1040
|
+
}
|
|
1041
|
+
/^@%:@AT_STOP_/ {
|
|
1042
|
+
test = substr ($ 0, 10)
|
|
1043
|
+
print "at_sed" test "=\"1," start "d;" (NR-1) "q\""
|
|
1044
|
+
if (test == "'"$at_group"'") exit
|
|
1045
|
+
}' "$at_myself" > "$at_suite_dir/at-source-lines" &&
|
|
1046
|
+
. "$at_suite_dir/at-source-lines" ||
|
|
1047
|
+
AS_ERROR([cannot create test line number cache])
|
|
1048
|
+
rm -f "$at_suite_dir/at-source-lines"
|
|
1049
|
+
|
|
1050
|
+
# Set number of jobs for '-j'; avoid more jobs than test groups.
|
|
1051
|
+
set X $at_groups; shift; at_max_jobs=$[@%:@]
|
|
1052
|
+
if test $at_max_jobs -eq 0; then
|
|
1053
|
+
at_jobs=1
|
|
1054
|
+
fi
|
|
1055
|
+
if test $at_jobs -ne 1 &&
|
|
1056
|
+
{ test $at_jobs -eq 0 || test $at_jobs -gt $at_max_jobs; }; then
|
|
1057
|
+
at_jobs=$at_max_jobs
|
|
1058
|
+
fi
|
|
1059
|
+
|
|
1060
|
+
# If parallel mode, don't output banners, don't split summary lines.
|
|
1061
|
+
if test $at_jobs -ne 1; then
|
|
1062
|
+
at_print_banners=false
|
|
1063
|
+
at_quiet=:
|
|
1064
|
+
fi
|
|
1065
|
+
|
|
1066
|
+
# Set up helper dirs.
|
|
1067
|
+
rm -rf "$at_helper_dir" &&
|
|
1068
|
+
mkdir "$at_helper_dir" &&
|
|
1069
|
+
cd "$at_helper_dir" &&
|
|
1070
|
+
{ test -z "$at_groups" || mkdir $at_groups; } ||
|
|
1071
|
+
AS_ERROR([testsuite directory setup failed])
|
|
1072
|
+
|
|
1073
|
+
# Functions for running a test group. We leave the actual
|
|
1074
|
+
# test group execution outside of a shell function in order
|
|
1075
|
+
# to avoid hitting zsh 4.x exit status bugs.
|
|
1076
|
+
|
|
1077
|
+
AS_FUNCTION_DESCRIBE([at_fn_group_prepare], [],
|
|
1078
|
+
[Prepare for running a test group.])
|
|
1079
|
+
at_fn_group_prepare ()
|
|
1080
|
+
{
|
|
1081
|
+
# The directory for additional per-group helper files.
|
|
1082
|
+
at_job_dir=$at_helper_dir/$at_group
|
|
1083
|
+
# The file containing the location of the last AT_CHECK.
|
|
1084
|
+
at_check_line_file=$at_job_dir/check-line
|
|
1085
|
+
# The file containing the exit status of the last command.
|
|
1086
|
+
at_status_file=$at_job_dir/status
|
|
1087
|
+
# The files containing the output of the tested commands.
|
|
1088
|
+
at_stdout=$at_job_dir/stdout
|
|
1089
|
+
at_stder1=$at_job_dir/stder1
|
|
1090
|
+
at_stderr=$at_job_dir/stderr
|
|
1091
|
+
# The file containing the code for a test group.
|
|
1092
|
+
at_test_source=$at_job_dir/test-source
|
|
1093
|
+
# The file containing dates.
|
|
1094
|
+
at_times_file=$at_job_dir/times
|
|
1095
|
+
|
|
1096
|
+
# Be sure to come back to the top test directory.
|
|
1097
|
+
cd "$at_suite_dir"
|
|
1098
|
+
|
|
1099
|
+
# Clearly separate the test groups when verbose.
|
|
1100
|
+
$at_first || $at_verbose echo
|
|
1101
|
+
|
|
1102
|
+
at_group_normalized=$at_group
|
|
1103
|
+
_AT_NORMALIZE_TEST_GROUP_NUMBER(at_group_normalized)
|
|
1104
|
+
|
|
1105
|
+
# Create a fresh directory for the next test group, and enter.
|
|
1106
|
+
# If one already exists, the user may have invoked ./run from
|
|
1107
|
+
# within that directory; we remove the contents, but not the
|
|
1108
|
+
# directory itself, so that we aren't pulling the rug out from
|
|
1109
|
+
# under the shell's notion of the current directory.
|
|
1110
|
+
at_group_dir=$at_suite_dir/$at_group_normalized
|
|
1111
|
+
at_group_log=$at_group_dir/$as_me.log
|
|
1112
|
+
_AS_CLEAN_DIR("$at_group_dir") ||
|
|
1113
|
+
AS_WARN([test directory for $at_group_normalized could not be cleaned])
|
|
1114
|
+
# Be tolerant if the above 'rm' was not able to remove the directory.
|
|
1115
|
+
AS_MKDIR_P(["$at_group_dir"])
|
|
1116
|
+
|
|
1117
|
+
echo 0 > "$at_status_file"
|
|
1118
|
+
|
|
1119
|
+
# In verbose mode, append to the log file *and* show on
|
|
1120
|
+
# the standard output; in quiet mode only write to the log.
|
|
1121
|
+
if test -z "$at_verbose"; then
|
|
1122
|
+
at_tee_pipe='tee -a "$at_group_log"'
|
|
1123
|
+
else
|
|
1124
|
+
at_tee_pipe='cat >> "$at_group_log"'
|
|
1125
|
+
fi
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
AS_FUNCTION_DESCRIBE([at_fn_group_banner], [[ORDINAL LINE DESC PAD [BANNER]]],
|
|
1129
|
+
[Declare the test group ORDINAL, located at LINE with group description
|
|
1130
|
+
DESC, and residing under BANNER. Use PAD to align the status column.])
|
|
1131
|
+
at_fn_group_banner ()
|
|
1132
|
+
{
|
|
1133
|
+
at_setup_line="$[2]"
|
|
1134
|
+
test -n "$[5]" && at_fn_banner $[5]
|
|
1135
|
+
at_desc="$[3]"
|
|
1136
|
+
case $[1] in
|
|
1137
|
+
[[0-9]]) at_desc_line=" $[1]: ";;
|
|
1138
|
+
[[0-9][0-9]]) at_desc_line=" $[1]: " ;;
|
|
1139
|
+
[*]) at_desc_line="$[1]: " ;;
|
|
1140
|
+
esac
|
|
1141
|
+
AS_VAR_APPEND([at_desc_line], ["$[3]$[4]"])
|
|
1142
|
+
$at_quiet AS_ECHO_N(["$at_desc_line"])
|
|
1143
|
+
echo "# -*- compilation -*-" >> "$at_group_log"
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
AS_FUNCTION_DESCRIBE([at_fn_group_postprocess], [],
|
|
1147
|
+
[Perform cleanup after running a test group.])
|
|
1148
|
+
at_fn_group_postprocess ()
|
|
1149
|
+
{
|
|
1150
|
+
# Be sure to come back to the suite directory, in particular
|
|
1151
|
+
# since below we might 'rm' the group directory we are in currently.
|
|
1152
|
+
cd "$at_suite_dir"
|
|
1153
|
+
|
|
1154
|
+
if test ! -f "$at_check_line_file"; then
|
|
1155
|
+
sed "s/^ */$as_me: WARNING: /" <<_ATEOF
|
|
1156
|
+
A failure happened in a test group before any test could be
|
|
1157
|
+
run. This means that test suite is improperly designed. Please
|
|
1158
|
+
report this failure to <AT_PACKAGE_BUGREPORT>.
|
|
1159
|
+
_ATEOF
|
|
1160
|
+
AS_ECHO(["$at_setup_line"]) >"$at_check_line_file"
|
|
1161
|
+
at_status=99
|
|
1162
|
+
fi
|
|
1163
|
+
$at_verbose AS_ECHO_N(["$at_group. $at_setup_line: "])
|
|
1164
|
+
AS_ECHO_N(["$at_group. $at_setup_line: "]) >> "$at_group_log"
|
|
1165
|
+
case $at_xfail:$at_status in
|
|
1166
|
+
yes:0)
|
|
1167
|
+
at_msg="UNEXPECTED PASS"
|
|
1168
|
+
at_res=xpass
|
|
1169
|
+
at_errexit=$at_errexit_p
|
|
1170
|
+
at_color=$at_red
|
|
1171
|
+
;;
|
|
1172
|
+
no:0)
|
|
1173
|
+
at_msg="ok"
|
|
1174
|
+
at_res=pass
|
|
1175
|
+
at_errexit=false
|
|
1176
|
+
at_color=$at_grn
|
|
1177
|
+
;;
|
|
1178
|
+
*:77)
|
|
1179
|
+
at_msg='skipped ('`cat "$at_check_line_file"`')'
|
|
1180
|
+
at_res=skip
|
|
1181
|
+
at_errexit=false
|
|
1182
|
+
at_color=$at_blu
|
|
1183
|
+
;;
|
|
1184
|
+
no:* | *:99)
|
|
1185
|
+
at_msg='FAILED ('`cat "$at_check_line_file"`')'
|
|
1186
|
+
at_res=fail
|
|
1187
|
+
at_errexit=$at_errexit_p
|
|
1188
|
+
at_color=$at_red
|
|
1189
|
+
;;
|
|
1190
|
+
yes:*)
|
|
1191
|
+
at_msg='expected failure ('`cat "$at_check_line_file"`')'
|
|
1192
|
+
at_res=xfail
|
|
1193
|
+
at_errexit=false
|
|
1194
|
+
at_color=$at_lgn
|
|
1195
|
+
;;
|
|
1196
|
+
esac
|
|
1197
|
+
echo "$at_res" > "$at_job_dir/$at_res"
|
|
1198
|
+
# In parallel mode, output the summary line only afterwards.
|
|
1199
|
+
if test $at_jobs -ne 1 && test -n "$at_verbose"; then
|
|
1200
|
+
AS_ECHO(["$at_desc_line $at_color$at_msg$at_std"])
|
|
1201
|
+
else
|
|
1202
|
+
# Make sure there is a separator even with long titles.
|
|
1203
|
+
AS_ECHO([" $at_color$at_msg$at_std"])
|
|
1204
|
+
fi
|
|
1205
|
+
at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg"
|
|
1206
|
+
case $at_status in
|
|
1207
|
+
0|77)
|
|
1208
|
+
# $at_times_file is only available if the group succeeded.
|
|
1209
|
+
# We're not including the group log, so the success message
|
|
1210
|
+
# is written in the global log separately. But we also
|
|
1211
|
+
# write to the group log in case they're using -d.
|
|
1212
|
+
if test -f "$at_times_file"; then
|
|
1213
|
+
at_log_msg="$at_log_msg ("`sed 1d "$at_times_file"`')'
|
|
1214
|
+
rm -f "$at_times_file"
|
|
1215
|
+
fi
|
|
1216
|
+
AS_ECHO(["$at_log_msg"]) >> "$at_group_log"
|
|
1217
|
+
AS_ECHO(["$at_log_msg"]) >&AS_MESSAGE_LOG_FD
|
|
1218
|
+
|
|
1219
|
+
# Cleanup the group directory, unless the user wants the files
|
|
1220
|
+
# or the success was unexpected.
|
|
1221
|
+
if $at_debug_p || test $at_res = xpass; then
|
|
1222
|
+
at_fn_create_debugging_script
|
|
1223
|
+
if test $at_res = xpass && $at_errexit; then
|
|
1224
|
+
echo stop > "$at_stop_file"
|
|
1225
|
+
fi
|
|
1226
|
+
else
|
|
1227
|
+
if test -d "$at_group_dir"; then
|
|
1228
|
+
find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
|
|
1229
|
+
rm -fr "$at_group_dir"
|
|
1230
|
+
fi
|
|
1231
|
+
rm -f "$at_test_source"
|
|
1232
|
+
fi
|
|
1233
|
+
;;
|
|
1234
|
+
*)
|
|
1235
|
+
# Upon failure, include the log into the testsuite's global
|
|
1236
|
+
# log. The failure message is written in the group log. It
|
|
1237
|
+
# is later included in the global log.
|
|
1238
|
+
AS_ECHO(["$at_log_msg"]) >> "$at_group_log"
|
|
1239
|
+
|
|
1240
|
+
# Upon failure, keep the group directory for autopsy, and create
|
|
1241
|
+
# the debugging script. With -e, do not start any further tests.
|
|
1242
|
+
at_fn_create_debugging_script
|
|
1243
|
+
if $at_errexit; then
|
|
1244
|
+
echo stop > "$at_stop_file"
|
|
1245
|
+
fi
|
|
1246
|
+
;;
|
|
1247
|
+
esac
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
m4_text_box([Driver loop.])
|
|
1252
|
+
|
|
1253
|
+
dnl Catching signals correctly:
|
|
1254
|
+
dnl
|
|
1255
|
+
dnl The first idea was: trap the signal, send it to all spawned jobs,
|
|
1256
|
+
dnl then reset the handler and reraise the signal for ourselves.
|
|
1257
|
+
dnl However, before exiting, ksh will then send the signal to all
|
|
1258
|
+
dnl process group members, potentially killing the outer testsuite
|
|
1259
|
+
dnl and/or the 'make' process driving us.
|
|
1260
|
+
dnl So now the strategy is: trap the signal, send it to all spawned jobs,
|
|
1261
|
+
dnl then exit the script with the right status.
|
|
1262
|
+
dnl
|
|
1263
|
+
dnl In order to let the jobs know about the signal, we cannot just send it
|
|
1264
|
+
dnl to the current process group (kill $SIG 0), for the same reason as above.
|
|
1265
|
+
dnl Also, it does not reliably stop the suite to send the signal to the
|
|
1266
|
+
dnl spawned processes, because they might not transport it further
|
|
1267
|
+
dnl (maybe this can be fixed?).
|
|
1268
|
+
dnl
|
|
1269
|
+
dnl So what we do is enable shell job control if available, which causes the
|
|
1270
|
+
dnl shell to start each parallel task as its own shell job, thus as a new
|
|
1271
|
+
dnl process group leader. We then send the signal to all new process groups.
|
|
1272
|
+
|
|
1273
|
+
dnl Do we have job control?
|
|
1274
|
+
if (set -m && set +m && set +b) >/dev/null 2>&1; then
|
|
1275
|
+
set +b
|
|
1276
|
+
at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=-
|
|
1277
|
+
else
|
|
1278
|
+
at_job_control_on=: at_job_control_off=: at_job_group=
|
|
1279
|
+
fi
|
|
1280
|
+
|
|
1281
|
+
for at_signal in 1 2 15; do
|
|
1282
|
+
dnl This signal handler is not suitable for PIPE: it causes writes.
|
|
1283
|
+
dnl The code that was interrupted may have the errexit, monitor, or xtrace
|
|
1284
|
+
dnl flags enabled, so sanitize.
|
|
1285
|
+
trap 'set +x; set +e
|
|
1286
|
+
$at_job_control_off
|
|
1287
|
+
at_signal='"$at_signal"'
|
|
1288
|
+
dnl Safety belt: even with runaway processes, prevent starting new jobs.
|
|
1289
|
+
echo stop > "$at_stop_file"
|
|
1290
|
+
dnl Do not enter this area multiple times, do not kill self prematurely.
|
|
1291
|
+
trap "" $at_signal
|
|
1292
|
+
dnl Gather process group IDs of currently running jobs.
|
|
1293
|
+
at_pgids=
|
|
1294
|
+
for at_pgid in `jobs -p 2>/dev/null`; do
|
|
1295
|
+
at_pgids="$at_pgids $at_job_group$at_pgid"
|
|
1296
|
+
done
|
|
1297
|
+
dnl Ignore 'kill' errors, as some jobs may have finished in the meantime.
|
|
1298
|
+
test -z "$at_pgids" || kill -$at_signal $at_pgids 2>/dev/null
|
|
1299
|
+
dnl wait until all jobs have exited.
|
|
1300
|
+
wait
|
|
1301
|
+
dnl Status output. Do this after waiting for the jobs, for ordered output.
|
|
1302
|
+
dnl Avoid scribbling onto the end of a possibly incomplete line.
|
|
1303
|
+
if test "$at_jobs" -eq 1 || test -z "$at_verbose"; then
|
|
1304
|
+
echo >&2
|
|
1305
|
+
fi
|
|
1306
|
+
at_signame=`kill -l $at_signal 2>&1 || echo $at_signal`
|
|
1307
|
+
set x $at_signame
|
|
1308
|
+
test $# -gt 2 && at_signame=$at_signal
|
|
1309
|
+
AS_WARN([caught signal $at_signame, bailing out])
|
|
1310
|
+
dnl Do not reinstall the default handler here and reraise the signal to
|
|
1311
|
+
dnl let the default handler do its job, see the note about ksh above.
|
|
1312
|
+
dnl trap - $at_signal
|
|
1313
|
+
dnl kill -$at_signal $$
|
|
1314
|
+
dnl Instead, exit with appropriate status.
|
|
1315
|
+
AS_VAR_ARITH([exit_status], [128 + $at_signal])
|
|
1316
|
+
AS_EXIT([$exit_status])' $at_signal
|
|
1317
|
+
done
|
|
1318
|
+
|
|
1319
|
+
rm -f "$at_stop_file"
|
|
1320
|
+
at_first=:
|
|
1321
|
+
|
|
1322
|
+
if test $at_jobs -ne 1 &&
|
|
1323
|
+
rm -f "$at_job_fifo" &&
|
|
1324
|
+
test -n "$at_job_group" &&
|
|
1325
|
+
( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null
|
|
1326
|
+
then
|
|
1327
|
+
# FIFO job dispatcher.
|
|
1328
|
+
|
|
1329
|
+
dnl Since we use job control, we need to propagate TSTP.
|
|
1330
|
+
dnl This handler need not be used for serial execution.
|
|
1331
|
+
dnl Again, we should stop all processes in the job groups, otherwise
|
|
1332
|
+
dnl the stopping will not be effective while one test group is running.
|
|
1333
|
+
dnl Apparently ksh does not honor the TSTP trap.
|
|
1334
|
+
dnl As a safety measure, not use the same variable names as in the
|
|
1335
|
+
dnl termination handlers above, one might get called during execution
|
|
1336
|
+
dnl of the other.
|
|
1337
|
+
trap 'at_pids=
|
|
1338
|
+
for at_pid in `jobs -p`; do
|
|
1339
|
+
at_pids="$at_pids $at_job_group$at_pid"
|
|
1340
|
+
done
|
|
1341
|
+
dnl Send it to all spawned jobs, ignoring those finished meanwhile.
|
|
1342
|
+
if test -n "$at_pids"; then
|
|
1343
|
+
dnl Unfortunately, ksh93 fork-bombs when we send TSTP, so send STOP
|
|
1344
|
+
dnl if this might be ksh (STOP prevents possible TSTP handlers inside
|
|
1345
|
+
dnl AT_CHECKs from running). Then stop ourselves.
|
|
1346
|
+
at_sig=TSTP
|
|
1347
|
+
test ${TMOUT+y} && at_sig=STOP
|
|
1348
|
+
kill -$at_sig $at_pids 2>/dev/null
|
|
1349
|
+
fi
|
|
1350
|
+
kill -STOP $$
|
|
1351
|
+
dnl We got a CONT, so let's go again. Passing this to all processes
|
|
1352
|
+
dnl in the groups is necessary (because we stopped them), but it may
|
|
1353
|
+
dnl cause changed test semantics; e.g., a sleep will be interrupted.
|
|
1354
|
+
test -z "$at_pids" || kill -CONT $at_pids 2>/dev/null' TSTP
|
|
1355
|
+
|
|
1356
|
+
echo
|
|
1357
|
+
# Turn jobs into a list of numbers, starting from 1.
|
|
1358
|
+
at_joblist=`AS_ECHO(["$at_groups"]) | sed -n 1,${at_jobs}p`
|
|
1359
|
+
|
|
1360
|
+
set X $at_joblist
|
|
1361
|
+
shift
|
|
1362
|
+
for at_group in $at_groups; do
|
|
1363
|
+
dnl Enable job control only for spawning the test group:
|
|
1364
|
+
dnl Let the jobs to run in separate process groups, but
|
|
1365
|
+
dnl avoid all the status output by the shell.
|
|
1366
|
+
$at_job_control_on 2>/dev/null
|
|
1367
|
+
(
|
|
1368
|
+
# Start one test group.
|
|
1369
|
+
$at_job_control_off
|
|
1370
|
+
dnl First child must open the fifo to avoid blocking parent; all other
|
|
1371
|
+
dnl children inherit it already opened from the parent.
|
|
1372
|
+
if $at_first; then
|
|
1373
|
+
exec AT_JOB_FIFO_OUT_FD>"$at_job_fifo"
|
|
1374
|
+
else
|
|
1375
|
+
dnl Children do not need parent's copy of fifo.
|
|
1376
|
+
exec AT_JOB_FIFO_IN_FD<&-
|
|
1377
|
+
fi
|
|
1378
|
+
dnl When a child receives PIPE, be sure to write back the token,
|
|
1379
|
+
dnl so the master does not hang waiting for it.
|
|
1380
|
+
dnl errexit and xtrace should not be set in this shell instance,
|
|
1381
|
+
dnl except as debug measures. However, shells such as dash may
|
|
1382
|
+
dnl optimize away the _AT_CHECK subshell, so normalize here.
|
|
1383
|
+
trap 'set +x; set +e
|
|
1384
|
+
dnl Ignore PIPE signals that stem from writing back the token.
|
|
1385
|
+
trap "" PIPE
|
|
1386
|
+
echo stop > "$at_stop_file"
|
|
1387
|
+
echo >&AT_JOB_FIFO_OUT_FD
|
|
1388
|
+
dnl Do not reraise the default PIPE handler.
|
|
1389
|
+
dnl It wreaks havoc with ksh, see above.
|
|
1390
|
+
dnl trap - 13
|
|
1391
|
+
dnl kill -13 $$
|
|
1392
|
+
AS_EXIT([141])' PIPE
|
|
1393
|
+
at_fn_group_prepare
|
|
1394
|
+
if cd "$at_group_dir" &&
|
|
1395
|
+
at_fn_test $at_group &&
|
|
1396
|
+
. "$at_test_source"
|
|
1397
|
+
then :; else
|
|
1398
|
+
AS_WARN([unable to parse test group: $at_group])
|
|
1399
|
+
at_failed=:
|
|
1400
|
+
fi
|
|
1401
|
+
at_fn_group_postprocess
|
|
1402
|
+
echo >&AT_JOB_FIFO_OUT_FD
|
|
1403
|
+
) &
|
|
1404
|
+
$at_job_control_off
|
|
1405
|
+
if $at_first; then
|
|
1406
|
+
at_first=false
|
|
1407
|
+
exec AT_JOB_FIFO_IN_FD<"$at_job_fifo" AT_JOB_FIFO_OUT_FD>"$at_job_fifo"
|
|
1408
|
+
fi
|
|
1409
|
+
shift # Consume one token.
|
|
1410
|
+
if test $[@%:@] -gt 0; then :; else
|
|
1411
|
+
read at_token <&AT_JOB_FIFO_IN_FD || break
|
|
1412
|
+
set x $[*]
|
|
1413
|
+
fi
|
|
1414
|
+
test -f "$at_stop_file" && break
|
|
1415
|
+
done
|
|
1416
|
+
exec AT_JOB_FIFO_OUT_FD>&-
|
|
1417
|
+
# Read back the remaining ($at_jobs - 1) tokens.
|
|
1418
|
+
set X $at_joblist
|
|
1419
|
+
shift
|
|
1420
|
+
if test $[@%:@] -gt 0; then
|
|
1421
|
+
shift
|
|
1422
|
+
for at_job
|
|
1423
|
+
do
|
|
1424
|
+
read at_token
|
|
1425
|
+
done <&AT_JOB_FIFO_IN_FD
|
|
1426
|
+
fi
|
|
1427
|
+
exec AT_JOB_FIFO_IN_FD<&-
|
|
1428
|
+
wait
|
|
1429
|
+
else
|
|
1430
|
+
# Run serially, avoid forks and other potential surprises.
|
|
1431
|
+
for at_group in $at_groups; do
|
|
1432
|
+
at_fn_group_prepare
|
|
1433
|
+
if cd "$at_group_dir" &&
|
|
1434
|
+
at_fn_test $at_group &&
|
|
1435
|
+
. "$at_test_source"; then :; else
|
|
1436
|
+
AS_WARN([unable to parse test group: $at_group])
|
|
1437
|
+
at_failed=:
|
|
1438
|
+
fi
|
|
1439
|
+
at_fn_group_postprocess
|
|
1440
|
+
test -f "$at_stop_file" && break
|
|
1441
|
+
at_first=false
|
|
1442
|
+
done
|
|
1443
|
+
fi
|
|
1444
|
+
|
|
1445
|
+
# Wrap up the test suite with summary statistics.
|
|
1446
|
+
cd "$at_helper_dir"
|
|
1447
|
+
|
|
1448
|
+
# Use ?..???? when the list must remain sorted, the faster * otherwise.
|
|
1449
|
+
at_pass_list=`for f in */pass; do echo $f; done | sed '/\*/d; s,/pass,,'`
|
|
1450
|
+
at_skip_list=`for f in */skip; do echo $f; done | sed '/\*/d; s,/skip,,'`
|
|
1451
|
+
at_xfail_list=`for f in */xfail; do echo $f; done | sed '/\*/d; s,/xfail,,'`
|
|
1452
|
+
at_xpass_list=`for f in ?/xpass ??/xpass ???/xpass ????/xpass; do
|
|
1453
|
+
echo $f; done | sed '/?/d; s,/xpass,,'`
|
|
1454
|
+
at_fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do
|
|
1455
|
+
echo $f; done | sed '/?/d; s,/fail,,'`
|
|
1456
|
+
|
|
1457
|
+
set X $at_pass_list $at_xpass_list $at_xfail_list $at_fail_list $at_skip_list
|
|
1458
|
+
shift; at_group_count=$[@%:@]
|
|
1459
|
+
set X $at_xpass_list; shift; at_xpass_count=$[@%:@]; at_xpass_list=$[*]
|
|
1460
|
+
set X $at_xfail_list; shift; at_xfail_count=$[@%:@]
|
|
1461
|
+
set X $at_fail_list; shift; at_fail_count=$[@%:@]; at_fail_list=$[*]
|
|
1462
|
+
set X $at_skip_list; shift; at_skip_count=$[@%:@]
|
|
1463
|
+
|
|
1464
|
+
AS_VAR_ARITH([at_run_count], [$at_group_count - $at_skip_count])
|
|
1465
|
+
AS_VAR_ARITH([at_unexpected_count], [$at_xpass_count + $at_fail_count])
|
|
1466
|
+
AS_VAR_ARITH([at_total_fail_count], [$at_xfail_count + $at_fail_count])
|
|
1467
|
+
|
|
1468
|
+
# Back to the top directory.
|
|
1469
|
+
cd "$at_dir"
|
|
1470
|
+
rm -rf "$at_helper_dir"
|
|
1471
|
+
|
|
1472
|
+
# Compute the duration of the suite.
|
|
1473
|
+
at_stop_date=`date`
|
|
1474
|
+
at_stop_time=`date +%s 2>/dev/null`
|
|
1475
|
+
AS_ECHO(["$as_me: ending at: $at_stop_date"]) >&AS_MESSAGE_LOG_FD
|
|
1476
|
+
case $at_start_time,$at_stop_time in
|
|
1477
|
+
[[0-9]*,[0-9]*])
|
|
1478
|
+
AS_VAR_ARITH([at_duration_s], [$at_stop_time - $at_start_time])
|
|
1479
|
+
AS_VAR_ARITH([at_duration_m], [$at_duration_s / 60])
|
|
1480
|
+
AS_VAR_ARITH([at_duration_h], [$at_duration_m / 60])
|
|
1481
|
+
AS_VAR_ARITH([at_duration_s], [$at_duration_s % 60])
|
|
1482
|
+
AS_VAR_ARITH([at_duration_m], [$at_duration_m % 60])
|
|
1483
|
+
at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
|
|
1484
|
+
AS_ECHO(["$as_me: test suite duration: $at_duration"]) >&AS_MESSAGE_LOG_FD
|
|
1485
|
+
;;
|
|
1486
|
+
esac
|
|
1487
|
+
|
|
1488
|
+
echo
|
|
1489
|
+
AS_BOX([Test results.])
|
|
1490
|
+
echo
|
|
1491
|
+
{
|
|
1492
|
+
echo
|
|
1493
|
+
AS_BOX([Test results.])
|
|
1494
|
+
echo
|
|
1495
|
+
} >&AS_MESSAGE_LOG_FD
|
|
1496
|
+
|
|
1497
|
+
dnl
|
|
1498
|
+
dnl FIXME: this code is as far from i18n-cleanness as man
|
|
1499
|
+
dnl could imagine...
|
|
1500
|
+
dnl
|
|
1501
|
+
if test $at_run_count = 1; then
|
|
1502
|
+
at_result="1 test"
|
|
1503
|
+
at_were=was
|
|
1504
|
+
else
|
|
1505
|
+
at_result="$at_run_count tests"
|
|
1506
|
+
at_were=were
|
|
1507
|
+
fi
|
|
1508
|
+
if $at_errexit_p && test $at_unexpected_count != 0; then
|
|
1509
|
+
if test $at_xpass_count = 1; then
|
|
1510
|
+
at_result="$at_result $at_were run, one passed"
|
|
1511
|
+
else
|
|
1512
|
+
at_result="$at_result $at_were run, one failed"
|
|
1513
|
+
fi
|
|
1514
|
+
at_result="$at_result unexpectedly and inhibited subsequent tests."
|
|
1515
|
+
at_color=$at_red
|
|
1516
|
+
else
|
|
1517
|
+
# Don't you just love exponential explosion of the number of cases?
|
|
1518
|
+
at_color=$at_red
|
|
1519
|
+
case $at_xpass_count:$at_fail_count:$at_xfail_count in
|
|
1520
|
+
# So far, so good.
|
|
1521
|
+
0:0:0) at_result="$at_result $at_were successful." at_color=$at_grn ;;
|
|
1522
|
+
0:0:*) at_result="$at_result behaved as expected." at_color=$at_lgn ;;
|
|
1523
|
+
|
|
1524
|
+
# Some unexpected failures
|
|
1525
|
+
0:*:0) at_result="$at_result $at_were run,
|
|
1526
|
+
$at_fail_count failed unexpectedly." ;;
|
|
1527
|
+
|
|
1528
|
+
# Some failures, both expected and unexpected
|
|
1529
|
+
0:*:1) at_result="$at_result $at_were run,
|
|
1530
|
+
$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
|
|
1531
|
+
0:*:*) at_result="$at_result $at_were run,
|
|
1532
|
+
$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
|
|
1533
|
+
|
|
1534
|
+
# No unexpected failures, but some xpasses
|
|
1535
|
+
*:0:*) at_result="$at_result $at_were run,
|
|
1536
|
+
$at_xpass_count passed unexpectedly." ;;
|
|
1537
|
+
|
|
1538
|
+
# No expected failures, but failures and xpasses
|
|
1539
|
+
*:1:0) at_result="$at_result $at_were run,
|
|
1540
|
+
$at_unexpected_count did not behave as expected dnl
|
|
1541
|
+
($at_fail_count unexpected failure)." ;;
|
|
1542
|
+
*:*:0) at_result="$at_result $at_were run,
|
|
1543
|
+
$at_unexpected_count did not behave as expected dnl
|
|
1544
|
+
($at_fail_count unexpected failures)." ;;
|
|
1545
|
+
|
|
1546
|
+
# All of them.
|
|
1547
|
+
*:*:1) at_result="$at_result $at_were run,
|
|
1548
|
+
$at_xpass_count passed unexpectedly,
|
|
1549
|
+
$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
|
|
1550
|
+
*:*:*) at_result="$at_result $at_were run,
|
|
1551
|
+
$at_xpass_count passed unexpectedly,
|
|
1552
|
+
$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
|
|
1553
|
+
esac
|
|
1554
|
+
|
|
1555
|
+
if test $at_skip_count = 0 && test $at_run_count -gt 1; then
|
|
1556
|
+
at_result="All $at_result"
|
|
1557
|
+
fi
|
|
1558
|
+
fi
|
|
1559
|
+
|
|
1560
|
+
# Now put skips in the mix.
|
|
1561
|
+
case $at_skip_count in
|
|
1562
|
+
0) ;;
|
|
1563
|
+
1) at_result="$at_result
|
|
1564
|
+
1 test was skipped." ;;
|
|
1565
|
+
*) at_result="$at_result
|
|
1566
|
+
$at_skip_count tests were skipped." ;;
|
|
1567
|
+
esac
|
|
1568
|
+
|
|
1569
|
+
if test $at_unexpected_count = 0; then
|
|
1570
|
+
echo "$at_color$at_result$at_std"
|
|
1571
|
+
echo "$at_result" >&AS_MESSAGE_LOG_FD
|
|
1572
|
+
else
|
|
1573
|
+
echo "${at_color}ERROR: $at_result$at_std" >&2
|
|
1574
|
+
echo "ERROR: $at_result" >&AS_MESSAGE_LOG_FD
|
|
1575
|
+
{
|
|
1576
|
+
echo
|
|
1577
|
+
AS_BOX([Summary of the failures.])
|
|
1578
|
+
|
|
1579
|
+
# Summary of failed and skipped tests.
|
|
1580
|
+
if test $at_fail_count != 0; then
|
|
1581
|
+
echo "Failed tests:"
|
|
1582
|
+
$SHELL "$at_myself" $at_fail_list --list
|
|
1583
|
+
echo
|
|
1584
|
+
fi
|
|
1585
|
+
if test $at_skip_count != 0; then
|
|
1586
|
+
echo "Skipped tests:"
|
|
1587
|
+
$SHELL "$at_myself" $at_skip_list --list
|
|
1588
|
+
echo
|
|
1589
|
+
fi
|
|
1590
|
+
if test $at_xpass_count != 0; then
|
|
1591
|
+
echo "Unexpected passes:"
|
|
1592
|
+
$SHELL "$at_myself" $at_xpass_list --list
|
|
1593
|
+
echo
|
|
1594
|
+
fi
|
|
1595
|
+
if test $at_fail_count != 0; then
|
|
1596
|
+
AS_BOX([Detailed failed tests.])
|
|
1597
|
+
echo
|
|
1598
|
+
for at_group in $at_fail_list
|
|
1599
|
+
do
|
|
1600
|
+
at_group_normalized=$at_group
|
|
1601
|
+
_AT_NORMALIZE_TEST_GROUP_NUMBER(at_group_normalized)
|
|
1602
|
+
cat "$at_suite_dir/$at_group_normalized/$as_me.log"
|
|
1603
|
+
echo
|
|
1604
|
+
done
|
|
1605
|
+
echo
|
|
1606
|
+
fi
|
|
1607
|
+
if test -n "$at_top_srcdir"; then
|
|
1608
|
+
AS_BOX([${at_top_build_prefix}config.log])
|
|
1609
|
+
sed 's/^/| /' ${at_top_build_prefix}config.log
|
|
1610
|
+
echo
|
|
1611
|
+
fi
|
|
1612
|
+
} >&AS_MESSAGE_LOG_FD
|
|
1613
|
+
|
|
1614
|
+
AS_BOX([$as_me.log was created.])
|
|
1615
|
+
|
|
1616
|
+
echo
|
|
1617
|
+
if $at_debug_p; then
|
|
1618
|
+
at_msg='per-test log files'
|
|
1619
|
+
else
|
|
1620
|
+
at_msg="'${at_testdir+${at_testdir}/}$as_me.log'"
|
|
1621
|
+
fi
|
|
1622
|
+
at_msg1a=${at_xpass_list:+', '}
|
|
1623
|
+
at_msg1=$at_fail_list${at_fail_list:+" failed$at_msg1a"}
|
|
1624
|
+
at_msg2=$at_xpass_list${at_xpass_list:+" passed unexpectedly"}
|
|
1625
|
+
|
|
1626
|
+
AS_ECHO(["Please send $at_msg and all information you think might help:
|
|
1627
|
+
|
|
1628
|
+
To: <AT_PACKAGE_BUGREPORT>
|
|
1629
|
+
Subject: @<:@AT_PACKAGE_STRING@:>@ $as_me: dnl
|
|
1630
|
+
$at_msg1$at_msg2
|
|
1631
|
+
|
|
1632
|
+
You may investigate any problem if you feel able to do so, in which
|
|
1633
|
+
case the test suite provides a good starting point. Its output may
|
|
1634
|
+
be found below '${at_testdir+${at_testdir}/}$as_me.dir'.
|
|
1635
|
+
"])
|
|
1636
|
+
exit 1
|
|
1637
|
+
fi
|
|
1638
|
+
|
|
1639
|
+
exit 0
|
|
1640
|
+
|
|
1641
|
+
m4_text_box([Actual tests.])
|
|
1642
|
+
m4_divert_pop([TESTS])dnl
|
|
1643
|
+
dnl End of AT_INIT: divert to KILL, only test groups are to be
|
|
1644
|
+
dnl output, the rest is ignored. Current diversion is BODY, inherited
|
|
1645
|
+
dnl from M4sh.
|
|
1646
|
+
m4_divert([KILL])
|
|
1647
|
+
])# AT_INIT
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
# _AT_ARG_OPTION(OPTIONS,HELP-TEXT,[ARGS],[ACTION-IF-GIVEN],
|
|
1651
|
+
# [ACTION-IF-NOT-GIVEN])
|
|
1652
|
+
# ----------------------------------------------------------
|
|
1653
|
+
# Internal implementation of AT_ARG_OPTION & AT_ARG_OPTION_ARG
|
|
1654
|
+
m4_defun([_AT_ARG_OPTION],
|
|
1655
|
+
[m4_divert_once([HELP_OTHER],
|
|
1656
|
+
[cat <<_ATEOF || at_write_fail=1
|
|
1657
|
+
|
|
1658
|
+
Other options:
|
|
1659
|
+
_ATEOF
|
|
1660
|
+
])dnl m4_divert_once HELP_OTHER
|
|
1661
|
+
m4_divert_text([HELP_OTHER],
|
|
1662
|
+
[cat <<_ATEOF || at_write_fail=1
|
|
1663
|
+
$2
|
|
1664
|
+
_ATEOF])dnl
|
|
1665
|
+
dnl Turn our options into our desired strings
|
|
1666
|
+
m4_ifdef([AT_first_option],[m4_undefine([AT_first_option])])dnl
|
|
1667
|
+
m4_ifdef([AT_case],[m4_undefine([AT_case])])dnl
|
|
1668
|
+
m4_ifdef([AT_case_no],[m4_undefine([AT_case_no])])dnl
|
|
1669
|
+
m4_ifdef([AT_case_arg],[m4_undefine([AT_case_arg])])dnl
|
|
1670
|
+
m4_foreach([AT_option], m4_split(m4_normalize([$1]),[[ \|]+]),
|
|
1671
|
+
[m4_define_default([AT_first_option],AT_option)dnl
|
|
1672
|
+
m4_define_default([AT_first_option_tr],
|
|
1673
|
+
[m4_bpatsubst(m4_defn([AT_first_option]), -, [_])])dnl
|
|
1674
|
+
m4_append([AT_case],m4_if(m4_len(AT_option),1,[],[-])[-]AT_option, [ | ])dnl
|
|
1675
|
+
m4_append([AT_case_no],[--no-]AT_option, [ | ])dnl
|
|
1676
|
+
m4_append([AT_case_arg],
|
|
1677
|
+
m4_if(m4_len(AT_option),1,[],[-])[-]AT_option[=*], [ | ])dnl
|
|
1678
|
+
])dnl m4_foreach AT_option
|
|
1679
|
+
dnl keep track so we or the user may process ACTION-IF-NOT-GIVEN
|
|
1680
|
+
m4_divert_once([PARSE_ARGS_BEGIN],
|
|
1681
|
+
[
|
|
1682
|
+
##
|
|
1683
|
+
## Set up package specific options.
|
|
1684
|
+
##
|
|
1685
|
+
])dnl
|
|
1686
|
+
m4_divert_text([PARSE_ARGS_BEGIN],
|
|
1687
|
+
[dnl Provide a default value for options without arguments.
|
|
1688
|
+
m4_ifvaln([$3],,[at_arg_[]AT_first_option_tr=false])dnl
|
|
1689
|
+
at_arg_given_[]AT_first_option_tr=false
|
|
1690
|
+
])dnl m4_divert_text DEFAULTS
|
|
1691
|
+
m4_divert_text([PARSE_ARGS],
|
|
1692
|
+
[dnl Parse the options and args when necessary.
|
|
1693
|
+
m4_ifvaln([$3],
|
|
1694
|
+
[ AT_case )
|
|
1695
|
+
at_prev=--AT_first_option_tr
|
|
1696
|
+
;;
|
|
1697
|
+
AT_case_arg )
|
|
1698
|
+
at_arg_[]AT_first_option_tr=$at_optarg
|
|
1699
|
+
at_arg_given_[]AT_first_option_tr=:
|
|
1700
|
+
$4
|
|
1701
|
+
;;],
|
|
1702
|
+
[ AT_case )
|
|
1703
|
+
at_optarg=:
|
|
1704
|
+
at_arg_[]AT_first_option_tr=:
|
|
1705
|
+
at_arg_given_[]AT_first_option_tr=:
|
|
1706
|
+
m4_ifval([$4],[$4])[]dnl
|
|
1707
|
+
;;
|
|
1708
|
+
AT_case_no )
|
|
1709
|
+
at_optarg=false
|
|
1710
|
+
at_arg_[]AT_first_option_tr=false
|
|
1711
|
+
at_arg_given_[]AT_first_option_tr=:
|
|
1712
|
+
m4_ifval([$4],[$4])[]dnl
|
|
1713
|
+
;;])dnl m4_ifvaln $3
|
|
1714
|
+
])dnl m4_divert_text PARSE_ARGS
|
|
1715
|
+
m4_ifvaln([$5],
|
|
1716
|
+
[m4_divert_once([PARSE_ARGS_END],
|
|
1717
|
+
[
|
|
1718
|
+
##
|
|
1719
|
+
## Process package specific options when _not_ supplied.
|
|
1720
|
+
##])dnl m4_divert_once PARSE_ARGS_END
|
|
1721
|
+
m4_divert_text([PARSE_ARGS_END],
|
|
1722
|
+
[
|
|
1723
|
+
AS_IF([$at_arg_given_[]AT_first_option_tr],,[$5])dnl
|
|
1724
|
+
])dnl m4_divert_text PARSE_ARGS_END
|
|
1725
|
+
])dnl m4_ifvaln $5
|
|
1726
|
+
])dnl _AT_ARG_OPTION
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
# AT_ARG_OPTION(OPTIONS,HELP-TEXT,[ACTION-IF-GIVEN],[ACTION-IF-NOT-GIVEN])
|
|
1730
|
+
# ------------------------------------------------------------------------
|
|
1731
|
+
# Accept a list of space-separated OPTIONS, all aliases of the first one.
|
|
1732
|
+
# Add HELP-TEXT to the HELP_OTHER diversion.
|
|
1733
|
+
#
|
|
1734
|
+
# Leading dashes should not be passed in OPTIONS. Users will be required
|
|
1735
|
+
# to pass '--' before long options and '-' before single character options.
|
|
1736
|
+
#
|
|
1737
|
+
# $at_arg_OPTION will be set to ':' if this option is received, 'false' if
|
|
1738
|
+
# if --no-OPTION is received, and 'false' by default.
|
|
1739
|
+
#
|
|
1740
|
+
# Run ACTION-IF-GIVEN each time an option in OPTIONS is encountered; here,
|
|
1741
|
+
# $at_optarg will be set to ':' or 'false' as appropriate. $at_optarg is
|
|
1742
|
+
# actually just a copy of $at_arg_OPTION.
|
|
1743
|
+
#
|
|
1744
|
+
# ACTION-IF-NOT-GIVEN will be run once after option parsing is complete and
|
|
1745
|
+
# if no option from OPTIONS was used.
|
|
1746
|
+
m4_defun([AT_ARG_OPTION],[_AT_ARG_OPTION([$1],[$2],,[$3],[$4])])
|
|
1747
|
+
|
|
1748
|
+
|
|
1749
|
+
# AT_ARG_OPTION_ARG(OPTIONS,HELP-TEXT,[ACTION-IF-GIVEN],[ACTION-IF-NOT-GIVEN])
|
|
1750
|
+
# ----------------------------------------------------------------------------
|
|
1751
|
+
# Accept a set of space-separated OPTIONS with arguments, all aliases of the
|
|
1752
|
+
# first one. Add HELP-TEXT to the HELP_OTHER diversion.
|
|
1753
|
+
#
|
|
1754
|
+
# Leading dashes should not be passed in OPTIONS. Users will be required
|
|
1755
|
+
# to pass '--' before long options and '-' before single character options.
|
|
1756
|
+
#
|
|
1757
|
+
# By default, any argument to these options will be assigned to the shell
|
|
1758
|
+
# variable $at_arg_OPTION, where OPTION is the first option in OPTIONS with
|
|
1759
|
+
# any '-' characters replaced with '_'.
|
|
1760
|
+
#
|
|
1761
|
+
# Run ACTION-IF-GIVEN each time an option in OPTIONS is encountered; here,
|
|
1762
|
+
# $at_optarg will be set to the option argument. $at_optarg is actually just
|
|
1763
|
+
# a copy of $at_arg_OPTION.
|
|
1764
|
+
#
|
|
1765
|
+
# ACTION-IF-NOT-GIVEN will be run once after option parsing is complete
|
|
1766
|
+
# and if no option from OPTIONS was used.
|
|
1767
|
+
m4_defun([AT_ARG_OPTION_ARG],[_AT_ARG_OPTION([$1],[$2],1,[$3],[$4])])
|
|
1768
|
+
|
|
1769
|
+
|
|
1770
|
+
# AT_TESTED(PROGRAMS)
|
|
1771
|
+
# -------------------
|
|
1772
|
+
# Specify the list of programs exercised by the test suite. Their
|
|
1773
|
+
# versions are logged, and in the case of embedded test suite, they
|
|
1774
|
+
# must correspond to the version of the package. PATH should be
|
|
1775
|
+
# already preset so the proper executable will be selected.
|
|
1776
|
+
m4_defun([AT_TESTED],
|
|
1777
|
+
[m4_require([_AT_TESTED])]dnl
|
|
1778
|
+
[m4_foreach_w([AT_test], [$1],
|
|
1779
|
+
[m4_append_uniq([AT_tested], "m4_defn([AT_test])", [ ])])])
|
|
1780
|
+
|
|
1781
|
+
m4_defun([_AT_TESTED],
|
|
1782
|
+
[m4_wrap([m4_divert_text([DEFAULTS],
|
|
1783
|
+
[# List of the tested programs.
|
|
1784
|
+
at_tested='m4_translit(m4_dquote(m4_defn([AT_tested])), [ ], m4_newline)'
|
|
1785
|
+
])]dnl
|
|
1786
|
+
[m4_divert_text([PREPARE_TESTS],
|
|
1787
|
+
[{
|
|
1788
|
+
AS_BOX([Tested programs.])
|
|
1789
|
+
echo
|
|
1790
|
+
} >&AS_MESSAGE_LOG_FD
|
|
1791
|
+
|
|
1792
|
+
# Report what programs are being tested.
|
|
1793
|
+
for at_program in : `eval echo $at_tested`
|
|
1794
|
+
do
|
|
1795
|
+
AS_CASE([$at_program],
|
|
1796
|
+
[:], [continue],
|
|
1797
|
+
[[[\\/]* | ?:[\\/]*]], [at_program_=$at_program],
|
|
1798
|
+
[_AS_PATH_WALK([$PATH], [test -f "$as_dir$at_program" && break])
|
|
1799
|
+
at_program_=$as_dir$at_program])
|
|
1800
|
+
|
|
1801
|
+
if test -f "$at_program_"; then
|
|
1802
|
+
{
|
|
1803
|
+
AS_ECHO(["$at_srcdir/AT_LINE: $at_program_ --version"])
|
|
1804
|
+
"$at_program_" --version </dev/null
|
|
1805
|
+
echo
|
|
1806
|
+
} >&AS_MESSAGE_LOG_FD 2>&1
|
|
1807
|
+
else
|
|
1808
|
+
AS_ERROR([cannot find $at_program])
|
|
1809
|
+
fi
|
|
1810
|
+
done
|
|
1811
|
+
])])])
|
|
1812
|
+
|
|
1813
|
+
|
|
1814
|
+
# AT_PREPARE_TESTS(SHELL-CODE)
|
|
1815
|
+
# ----------------------------
|
|
1816
|
+
# Execute @var{shell-code} in the main testsuite process,
|
|
1817
|
+
# after initializing the test suite and processing command-line options,
|
|
1818
|
+
# but before running any tests.
|
|
1819
|
+
m4_define([AT_PREPARE_TESTS],
|
|
1820
|
+
[m4_divert_once([PREPARE_TESTS],
|
|
1821
|
+
[m4_text_box([Prepare for this testsuite.])
|
|
1822
|
+
])]dnl
|
|
1823
|
+
[m4_divert_text([PREPARE_TESTS], [$1])])
|
|
1824
|
+
|
|
1825
|
+
|
|
1826
|
+
# AT_PREPARE_EACH_TEST([SHELL-CODE])
|
|
1827
|
+
# ----------------------------------
|
|
1828
|
+
# Execute @var{shell-code} in each test group's subshell,
|
|
1829
|
+
# at the point of the AT_SETUP that starts each test group.
|
|
1830
|
+
m4_define([AT_PREPARE_EACH_TEST],
|
|
1831
|
+
[m4_append([AT_prepare_each_test], [$1], [
|
|
1832
|
+
])])
|
|
1833
|
+
|
|
1834
|
+
|
|
1835
|
+
# AT_TEST_HELPER_FN(NAME, ARGS, DESCRIPTION, CODE)
|
|
1836
|
+
# ------------------------------------------------
|
|
1837
|
+
# Define a shell function that will be available to the code for each test
|
|
1838
|
+
# group. Its name will be ath_fn_NAME, and its body will be CODE.
|
|
1839
|
+
#
|
|
1840
|
+
# Implementation note: you might think this would use AT_PREPARE_EACH_TEST,
|
|
1841
|
+
# but shell functions defined in AT_PREPARE_TESTS *are* (currently) available
|
|
1842
|
+
# to test group subshells, and this way the code is only emitted once, not
|
|
1843
|
+
# once for each test group.
|
|
1844
|
+
m4_define([AT_TEST_HELPER_FN],
|
|
1845
|
+
[AS_LITERAL_WORD_IF([$1], [],
|
|
1846
|
+
[m4_fatal([invalid shell function name "$1"])])]dnl
|
|
1847
|
+
[m4_ifdef([ATH_fn_$1_defined],
|
|
1848
|
+
[m4_fatal([helper function "$1" defined twice])])]dnl
|
|
1849
|
+
[m4_define([ATH_fn_$1_defined])]dnl
|
|
1850
|
+
[AT_PREPARE_TESTS([
|
|
1851
|
+
AS_FUNCTION_DESCRIBE([ath_fn_$1], [$2], [$3])
|
|
1852
|
+
ath_fn_$1 ()
|
|
1853
|
+
{
|
|
1854
|
+
$4
|
|
1855
|
+
}
|
|
1856
|
+
])])
|
|
1857
|
+
|
|
1858
|
+
|
|
1859
|
+
# AT_COPYRIGHT(TEXT, [FILTER = m4_newline])
|
|
1860
|
+
# -----------------------------------------
|
|
1861
|
+
# Emit TEXT, a copyright notice, in the top of the test suite and in
|
|
1862
|
+
# --version output. Macros in TEXT are evaluated once. Process
|
|
1863
|
+
# the --version output through FILTER (m4_newline, m4_do, and
|
|
1864
|
+
# m4_copyright_condense are common filters).
|
|
1865
|
+
m4_define([AT_COPYRIGHT],
|
|
1866
|
+
[AS_COPYRIGHT([$1])[]]dnl
|
|
1867
|
+
[m4_divert_text([VERSION_NOTICES],
|
|
1868
|
+
[m4_default([$2], [m4_newline])([$1])])])# AT_COPYRIGHT
|
|
1869
|
+
|
|
1870
|
+
|
|
1871
|
+
# AT_COLOR_TESTS
|
|
1872
|
+
# --------------
|
|
1873
|
+
# Enable colored test results if standard error is connected to a terminal.
|
|
1874
|
+
m4_define([AT_COLOR_TESTS],
|
|
1875
|
+
[m4_define([AT_color], [auto])])
|
|
1876
|
+
|
|
1877
|
+
# AT_SETUP(DESCRIPTION)
|
|
1878
|
+
# ---------------------
|
|
1879
|
+
# Start a group of related tests, all to be executed in the same subshell.
|
|
1880
|
+
# The group is testing what DESCRIPTION says.
|
|
1881
|
+
_AT_DEFINE_INIT([AT_SETUP],
|
|
1882
|
+
[m4_ifdef([AT_ingroup], [m4_fatal([$0: nested AT_SETUP detected])],
|
|
1883
|
+
[m4_define([AT_ingroup], [AS_ECHO(["$at_setup_line"]) >"$at_check_line_file"
|
|
1884
|
+
])])
|
|
1885
|
+
m4_ifdef([AT_keywords], [m4_undefine([AT_keywords])])
|
|
1886
|
+
m4_define([AT_capture_files], [])
|
|
1887
|
+
m4_define([AT_line], AT_LINE)
|
|
1888
|
+
m4_define([AT_xfail], [at_xfail=no])
|
|
1889
|
+
m4_define([AT_description], m4_expand([$1]))
|
|
1890
|
+
m4_define([AT_ordinal], m4_incr(AT_ordinal))
|
|
1891
|
+
m4_divert_push([TEST_GROUPS])dnl
|
|
1892
|
+
[#AT_START_]AT_ordinal
|
|
1893
|
+
at_fn_group_banner AT_ordinal 'm4_defn([AT_line])' \
|
|
1894
|
+
"AS_ESCAPE(m4_dquote(m4_defn([AT_description])))" m4_format(["%*s"],
|
|
1895
|
+
m4_max(0, m4_eval(47 - m4_qlen(m4_defn([AT_description])))), [])m4_if(
|
|
1896
|
+
AT_banner_ordinal, [0], [], [ AT_banner_ordinal])
|
|
1897
|
+
m4_ifset([AT_prepare_each_test], [AT_prepare_each_test
|
|
1898
|
+
])dnl
|
|
1899
|
+
m4_divert_push([TEST_SCRIPT])dnl
|
|
1900
|
+
])
|
|
1901
|
+
|
|
1902
|
+
|
|
1903
|
+
# AT_FAIL_IF(SHELL-EXPRESSION)
|
|
1904
|
+
# ----------------------------
|
|
1905
|
+
# Make the test die with hard failure if SHELL-EXPRESSION evaluates to
|
|
1906
|
+
# true (exitcode = 0).
|
|
1907
|
+
_AT_DEFINE_SETUP([AT_FAIL_IF],
|
|
1908
|
+
[dnl
|
|
1909
|
+
dnl Try to limit the amount of conditionals that we emit.
|
|
1910
|
+
m4_case([$1],
|
|
1911
|
+
[], [],
|
|
1912
|
+
[false], [],
|
|
1913
|
+
[:], [_AT_CHECK_EXIT([], [99])],
|
|
1914
|
+
[true], [_AT_CHECK_EXIT([], [99])],
|
|
1915
|
+
[_AT_CHECK_EXIT([$1], [99])])])
|
|
1916
|
+
|
|
1917
|
+
|
|
1918
|
+
# AT_SKIP_IF(SHELL-EXPRESSION)
|
|
1919
|
+
# ----------------------------
|
|
1920
|
+
# Skip the rest of the group if SHELL-EXPRESSION evaluates to true
|
|
1921
|
+
# (exitcode = 0).
|
|
1922
|
+
_AT_DEFINE_SETUP([AT_SKIP_IF],
|
|
1923
|
+
[dnl
|
|
1924
|
+
dnl Try to limit the amount of conditionals that we emit.
|
|
1925
|
+
m4_case([$1],
|
|
1926
|
+
[], [],
|
|
1927
|
+
[false], [],
|
|
1928
|
+
[:], [_AT_CHECK_EXIT([], [77])],
|
|
1929
|
+
[true], [_AT_CHECK_EXIT([], [77])],
|
|
1930
|
+
[_AT_CHECK_EXIT([$1], [77])])])
|
|
1931
|
+
|
|
1932
|
+
|
|
1933
|
+
# AT_XFAIL_IF(SHELL-EXPRESSION)
|
|
1934
|
+
# -----------------------------
|
|
1935
|
+
# Set up the test to be expected to fail if SHELL-EXPRESSION evaluates to
|
|
1936
|
+
# true (exitcode = 0).
|
|
1937
|
+
_AT_DEFINE_SETUP([AT_XFAIL_IF],
|
|
1938
|
+
[dnl
|
|
1939
|
+
dnl Try to limit the amount of conditionals that we emit.
|
|
1940
|
+
m4_case([$1],
|
|
1941
|
+
[], [],
|
|
1942
|
+
[false], [],
|
|
1943
|
+
[:], [m4_define([AT_xfail], [at_xfail=yes])],
|
|
1944
|
+
[true], [m4_define([AT_xfail], [at_xfail=yes])],
|
|
1945
|
+
[m4_append([AT_xfail], [
|
|
1946
|
+
$1 && at_xfail=yes])])])
|
|
1947
|
+
|
|
1948
|
+
|
|
1949
|
+
# AT_KEYWORDS(KEYWORDS)
|
|
1950
|
+
# ---------------------
|
|
1951
|
+
# Declare a list of keywords associated to the current test group.
|
|
1952
|
+
# Since the -k option is case-insensitive, the list is stored in lower case
|
|
1953
|
+
# to avoid duplicates that differ only by case.
|
|
1954
|
+
_AT_DEFINE_SETUP([AT_KEYWORDS],
|
|
1955
|
+
[m4_append_uniq_w([AT_keywords], m4_tolower(_m4_expand([$1
|
|
1956
|
+
])))])
|
|
1957
|
+
|
|
1958
|
+
|
|
1959
|
+
# AT_CAPTURE_FILE(FILE)
|
|
1960
|
+
# ---------------------
|
|
1961
|
+
# If the current test group does not behave as expected, save the contents of
|
|
1962
|
+
# FILE in the test suite log.
|
|
1963
|
+
_AT_DEFINE_SETUP([AT_CAPTURE_FILE],
|
|
1964
|
+
[m4_append_uniq([AT_capture_files], ["$1"], [ \
|
|
1965
|
+
])])
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
# AT_CLEANUP
|
|
1969
|
+
# ----------
|
|
1970
|
+
# Complete a group of related tests.
|
|
1971
|
+
_AT_DEFINE_INIT([AT_CLEANUP],
|
|
1972
|
+
[m4_ifdef([AT_ingroup], [AT_ingroup[]_m4_undefine([AT_ingroup])],
|
|
1973
|
+
[m4_fatal([$0: missing AT_SETUP detected])])dnl
|
|
1974
|
+
m4_append([AT_help_all],
|
|
1975
|
+
m4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);dnl
|
|
1976
|
+
m4_ifdef([AT_keywords], [m4_defn([AT_keywords])]);
|
|
1977
|
+
)dnl
|
|
1978
|
+
m4_divert_pop([TEST_SCRIPT])dnl Back to TEST_GROUPS
|
|
1979
|
+
AT_xfail
|
|
1980
|
+
(
|
|
1981
|
+
AS_ECHO(["AT_ordinal. $at_setup_line: testing $at_desc ..."])
|
|
1982
|
+
$at_traceon
|
|
1983
|
+
m4_undivert([TEST_SCRIPT])dnl Insert the code here
|
|
1984
|
+
set +x
|
|
1985
|
+
$at_times_p && times >"$at_times_file"
|
|
1986
|
+
) AS_MESSAGE_LOG_FD>&1 2>&1 AT_JOB_FIFO_OUT_FD>&- | eval $at_tee_pipe
|
|
1987
|
+
read at_status <"$at_status_file"
|
|
1988
|
+
[#AT_STOP_]AT_ordinal
|
|
1989
|
+
m4_divert_pop([TEST_GROUPS])dnl Back to KILL.
|
|
1990
|
+
])# AT_CLEANUP
|
|
1991
|
+
|
|
1992
|
+
|
|
1993
|
+
# AT_BANNER([TEXT])
|
|
1994
|
+
# -----------------
|
|
1995
|
+
# Start a category of related test groups. If multiple groups are executed,
|
|
1996
|
+
# output TEXT as a banner without any shell expansion, prior to any test
|
|
1997
|
+
# from the category. If TEXT is empty, no banner is printed.
|
|
1998
|
+
_AT_DEFINE_INIT([AT_BANNER],
|
|
1999
|
+
[m4_ifdef([AT_ingroup], [m4_fatal([$0: nested AT_SETUP detected])])dnl
|
|
2000
|
+
m4_define([AT_banner_ordinal], m4_incr(AT_banner_ordinal))
|
|
2001
|
+
m4_divert_text([BANNERS],
|
|
2002
|
+
[@%:@ Banner AT_banner_ordinal. AT_LINE
|
|
2003
|
+
@%:@ Category starts at test group m4_incr(AT_ordinal).
|
|
2004
|
+
at_banner_text_[]AT_banner_ordinal="AS_ESCAPE([$1])"])dnl
|
|
2005
|
+
])# AT_BANNER
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
# AT_DATA_UNQUOTED(FILE, CONTENTS)
|
|
2009
|
+
# -----------------------
|
|
2010
|
+
# Initialize an input data FILE with given CONTENTS, which should be
|
|
2011
|
+
# empty or end with a newline.
|
|
2012
|
+
# This macro is not robust to active symbols in CONTENTS *on purpose*.
|
|
2013
|
+
# If you don't want CONTENTS to be evaluated, quote it twice.
|
|
2014
|
+
# In addition, it does not quote shell variables. For example, it
|
|
2015
|
+
# can be used to generate data files containing a carriage return.
|
|
2016
|
+
_AT_DEFINE_SETUP([AT_DATA_UNQUOTED],
|
|
2017
|
+
[m4_if([$2], [], [: >$1],
|
|
2018
|
+
[$2], [[]], [: >$1],
|
|
2019
|
+
[cat >$1 <<_ATEOF
|
|
2020
|
+
$2[]_ATEOF
|
|
2021
|
+
])])
|
|
2022
|
+
|
|
2023
|
+
|
|
2024
|
+
# AT_DATA(FILE, CONTENTS)
|
|
2025
|
+
# -----------------------
|
|
2026
|
+
# Initialize an input data FILE with given CONTENTS, which should be
|
|
2027
|
+
# empty or end with a newline.
|
|
2028
|
+
# This macro is not robust to active symbols in CONTENTS *on purpose*.
|
|
2029
|
+
# If you don't want CONTENTS to be evaluated, quote it twice.
|
|
2030
|
+
_AT_DEFINE_SETUP([AT_DATA],
|
|
2031
|
+
[m4_if([$2], [], [: >$1],
|
|
2032
|
+
[$2], [[]], [: >$1],
|
|
2033
|
+
[cat >$1 <<'_ATEOF'
|
|
2034
|
+
$2[]_ATEOF
|
|
2035
|
+
])])
|
|
2036
|
+
|
|
2037
|
+
|
|
2038
|
+
# AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR,
|
|
2039
|
+
# [RUN-IF-FAIL], [RUN-IF-PASS])
|
|
2040
|
+
# ------------------------------------------------
|
|
2041
|
+
# Execute a test by performing given shell COMMANDS. These commands
|
|
2042
|
+
# should normally exit with STATUS, while producing expected STDOUT and
|
|
2043
|
+
# STDERR contents. Shell metacharacters in STDOUT and STDERR are
|
|
2044
|
+
# _not_ processed by the shell, but are treated as string literals.
|
|
2045
|
+
#
|
|
2046
|
+
# STATUS, STDOUT, and STDERR are not checked if equal to 'ignore'.
|
|
2047
|
+
#
|
|
2048
|
+
# If STDOUT is 'expout', then stdout is compared to the content of the file
|
|
2049
|
+
# 'expout'. Likewise for STDERR and 'experr'.
|
|
2050
|
+
#
|
|
2051
|
+
# If STDOUT is 'stdout', then the stdout is left in the file 'stdout',
|
|
2052
|
+
# likewise for STDERR and 'stderr'. Don't do this:
|
|
2053
|
+
#
|
|
2054
|
+
# AT_CHECK([command >out])
|
|
2055
|
+
# # Some checks on 'out'
|
|
2056
|
+
#
|
|
2057
|
+
# do this instead:
|
|
2058
|
+
#
|
|
2059
|
+
# AT_CHECK([command], [], [stdout])
|
|
2060
|
+
# # Some checks on 'stdout'
|
|
2061
|
+
#
|
|
2062
|
+
# You might wonder why you can't just use 'ignore', then directly use stdout
|
|
2063
|
+
# and stderr left by the test suite:
|
|
2064
|
+
#
|
|
2065
|
+
# AT_CHECK([command], [], [ignore])
|
|
2066
|
+
# AT_CHECK([check stdout])
|
|
2067
|
+
#
|
|
2068
|
+
# If the test suite always captured data in the file 'stdout', then the
|
|
2069
|
+
# second command would be trying to read and write from the same file, with
|
|
2070
|
+
# undefined behavior. Therefore, the test suite actually captures data in
|
|
2071
|
+
# an internal file of a different name, and only creates 'stdout' when
|
|
2072
|
+
# explicitly requested.
|
|
2073
|
+
#
|
|
2074
|
+
# Any line of stderr starting with leading blanks and a '+' are filtered
|
|
2075
|
+
# out, since most shells when tracing include subshell traces in stderr.
|
|
2076
|
+
# This may cause spurious failures when the test suite is run with '-x'.
|
|
2077
|
+
#
|
|
2078
|
+
_AT_DEFINE_SETUP([AT_CHECK],
|
|
2079
|
+
[_AT_CHECK(m4_expand([$1]), [$2], AS_ESCAPE(m4_dquote(m4_expand([$3]))),
|
|
2080
|
+
AS_ESCAPE(m4_dquote(m4_expand([$4]))), [$5], [$6])])
|
|
2081
|
+
|
|
2082
|
+
# AT_CHECK_UNQUOTED(COMMANDS, [STATUS = 0], STDOUT, STDERR,
|
|
2083
|
+
# [RUN-IF-FAIL], [RUN-IF-PASS])
|
|
2084
|
+
# ---------------------------------------------------------
|
|
2085
|
+
# Like AT_CHECK, but do not AS_ESCAPE shell metacharacters in the STDOUT
|
|
2086
|
+
# and STDERR arguments before running the comparison.
|
|
2087
|
+
_AT_DEFINE_SETUP([AT_CHECK_UNQUOTED],
|
|
2088
|
+
[_AT_CHECK(m4_expand([$1]), [$2], AS_ESCAPE(m4_dquote(m4_expand([$3])), [""]),
|
|
2089
|
+
AS_ESCAPE(m4_dquote(m4_expand([$4])), [""]), [$5], [$6])])
|
|
2090
|
+
|
|
2091
|
+
# AT_CHECK_NOESCAPE(COMMANDS, [STATUS = 0], STDOUT, STDERR,
|
|
2092
|
+
# [RUN-IF-FAIL], [RUN-IF-PASS])
|
|
2093
|
+
# ---------------------------------------------------------
|
|
2094
|
+
# Obsolete spelling of AT_CHECK_UNQUOTED.
|
|
2095
|
+
m4_define([AT_CHECK_NOESCAPE],
|
|
2096
|
+
[m4_warn([obsolete], [consider using AT_CHECK_UNQUOTED instead of $0])]dnl
|
|
2097
|
+
[_AT_CHECK(m4_expand([$1]), [$2], m4_expand([$3]),
|
|
2098
|
+
m4_expand([$4]), [$5], [$6])])
|
|
2099
|
+
|
|
2100
|
+
|
|
2101
|
+
# _AT_DECIDE_TRACEABLE(COMMANDS)
|
|
2102
|
+
# ------------------------------
|
|
2103
|
+
# Worker for _AT_CHECK that expands to shell code. If COMMANDS are safe to
|
|
2104
|
+
# trace with 'set -x', the shell code will evaluate to true. Otherwise,
|
|
2105
|
+
# the shell code will print a message stating an aspect of COMMANDS that makes
|
|
2106
|
+
# tracing them unsafe, and evaluate to false.
|
|
2107
|
+
#
|
|
2108
|
+
# Tracing COMMANDS is not safe if they contain a command that spans multiple
|
|
2109
|
+
# lines. When the test suite user passes '-x' or '--trace', the test suite
|
|
2110
|
+
# precedes every command with a 'set -x'. Since most tests expect a specific
|
|
2111
|
+
# stderr, if only to confirm that it is empty, the test suite filters ^+ from
|
|
2112
|
+
# the captured stderr before comparing with the expected stderr. If a command
|
|
2113
|
+
# spans multiple lines, so will its trace, but a '+' only prefixes the first
|
|
2114
|
+
# line of that trace:
|
|
2115
|
+
#
|
|
2116
|
+
# $ echo 'foo
|
|
2117
|
+
# bar'
|
|
2118
|
+
# => stdout
|
|
2119
|
+
# foo
|
|
2120
|
+
# bar
|
|
2121
|
+
# => stderr
|
|
2122
|
+
# + foo
|
|
2123
|
+
# bar
|
|
2124
|
+
#
|
|
2125
|
+
# In a subset of cases, one could filter such extended shell traces from
|
|
2126
|
+
# stderr. Since test commands spanning several lines are rare, I chose
|
|
2127
|
+
# instead to simply not trace COMMANDS that could yield multiple trace lines.
|
|
2128
|
+
# Distinguishing such COMMANDS became the task at hand.
|
|
2129
|
+
#
|
|
2130
|
+
# These features may cause a shell command to span multiple lines:
|
|
2131
|
+
#
|
|
2132
|
+
# (a) A quoted literal newline.
|
|
2133
|
+
# Example:
|
|
2134
|
+
# echo foo'
|
|
2135
|
+
# 'bar
|
|
2136
|
+
# M4 is a hostile language for the job of parsing COMMANDS to determine whether
|
|
2137
|
+
# each literal newline is quoted, so we simply disable tracing for all COMMANDS
|
|
2138
|
+
# that bear literal newlines.
|
|
2139
|
+
#
|
|
2140
|
+
# (b) A command substitution not subject to word splitting.
|
|
2141
|
+
# Example:
|
|
2142
|
+
# var=$(printf 'foo\nbar')
|
|
2143
|
+
# Example:
|
|
2144
|
+
# echo "`printf 'foo\\nbar`"
|
|
2145
|
+
# One cannot know in general the number of lines a command substitution will
|
|
2146
|
+
# yield without executing the substituted command. As such, we disable tracing
|
|
2147
|
+
# for all COMMANDS containing these constructs.
|
|
2148
|
+
#
|
|
2149
|
+
# (c) A parameter expansion not subject to word splitting.
|
|
2150
|
+
# Example:
|
|
2151
|
+
# var=foo'
|
|
2152
|
+
# 'bar
|
|
2153
|
+
# echo "$var"
|
|
2154
|
+
# Parameter expansions appear in COMMANDS with much greater frequency than do
|
|
2155
|
+
# newlines and command substitutions, so disabling tracing for all such
|
|
2156
|
+
# COMMANDS would much more substantially devalue 'testsuite -x'. To determine
|
|
2157
|
+
# which parameter expansions yield multiple lines, we escape all '`', '"',
|
|
2158
|
+
# and '\' in a copy of COMMANDS and expand that string within double quotes
|
|
2159
|
+
# at runtime. If the result of that expansion contains multiple lines, the
|
|
2160
|
+
# test suite disables tracing for the command in question.
|
|
2161
|
+
#
|
|
2162
|
+
# This method leads the test suite to expand some parameters that the shell
|
|
2163
|
+
# itself will never expand due to single-quotes or backslash escapes. This is
|
|
2164
|
+
# not a problem for '$foo' expansions, which will simply yield the empty string
|
|
2165
|
+
# or some unrelated value. A '${...}' expansion could actually form invalid
|
|
2166
|
+
# shell code, however; consider '${=foo}'. Therefore, we disable tracing for
|
|
2167
|
+
# all COMMANDS containing '${...}'. This affects few COMMANDS.
|
|
2168
|
+
#
|
|
2169
|
+
# This macro falls in a very hot path; the Autoconf test suite expands it 1640
|
|
2170
|
+
# times as of this writing. To give a sense of the impact of the heuristics I
|
|
2171
|
+
# just described, the test suite preemptively disables tracing for 31 of those,
|
|
2172
|
+
# and 268 contain parameter expansions that require runtime evaluation. The
|
|
2173
|
+
# balance are always safe to trace.
|
|
2174
|
+
m4_define([_AT_DECIDE_TRACEABLE],
|
|
2175
|
+
dnl Utility macro.
|
|
2176
|
+
dnl
|
|
2177
|
+
dnl Examine COMMANDS for a reason to never trace COMMANDS.
|
|
2178
|
+
[m4_pushdef([at_reason],
|
|
2179
|
+
m4_cond([m4_eval(m4_index([$1], [`]) >= 0)], [1],
|
|
2180
|
+
[[a `...` command substitution]],
|
|
2181
|
+
[m4_eval(m4_index([$1], [$(]) >= 0)], [1],
|
|
2182
|
+
[[a $(...) command substitution]],
|
|
2183
|
+
[m4_eval(m4_index([$1], [${]) >= 0)], [1],
|
|
2184
|
+
[[a ${...} parameter expansion]],
|
|
2185
|
+
[m4_eval(m4_index([$1], m4_newline) >= 0)], [1],
|
|
2186
|
+
[[an embedded newline]],
|
|
2187
|
+
[m4_eval(m4_bregexp([$1], [[^|]|[^|]]) >= 0)], [1],
|
|
2188
|
+
[[a shell pipeline]],
|
|
2189
|
+
[]))]dnl No reason.
|
|
2190
|
+
[m4_if(m4_index(_m4_defn([at_reason]), [a]), [0],]dnl
|
|
2191
|
+
dnl We know at build time that tracing COMMANDS is never safe.
|
|
2192
|
+
[[at_fn_check_prepare_notrace '_m4_defn([at_reason])'],
|
|
2193
|
+
m4_index([$1], [$]), [-1],]dnl
|
|
2194
|
+
dnl We know at build time that tracing COMMANDS is always safe.
|
|
2195
|
+
[[at_fn_check_prepare_trace],]dnl
|
|
2196
|
+
dnl COMMANDS may contain parameter expansions; expand them at runtime.
|
|
2197
|
+
[[at_fn_check_prepare_dynamic "AS_ESCAPE([[$1]], [`\"])"])[]]dnl
|
|
2198
|
+
[_m4_popdef([at_reason])])
|
|
2199
|
+
|
|
2200
|
+
|
|
2201
|
+
# AT_DIFF_STDERR/AT_DIFF_STDOUT
|
|
2202
|
+
# -----------------------------
|
|
2203
|
+
# These are subroutines of AT_CHECK. Using indirect dispatch is a tad
|
|
2204
|
+
# faster than using m4_case, and these are called very frequently.
|
|
2205
|
+
m4_define([AT_DIFF_STDERR(stderr)],
|
|
2206
|
+
[echo stderr:; tee stderr <"$at_stderr"])
|
|
2207
|
+
m4_define([AT_DIFF_STDERR(stderr-nolog)],
|
|
2208
|
+
[echo stderr captured; cp "$at_stderr" stderr])
|
|
2209
|
+
m4_define([AT_DIFF_STDERR(ignore)],
|
|
2210
|
+
[echo stderr:; cat "$at_stderr"])
|
|
2211
|
+
m4_define([AT_DIFF_STDERR(ignore-nolog)])
|
|
2212
|
+
m4_define([AT_DIFF_STDERR(experr)],
|
|
2213
|
+
[$at_diff experr "$at_stderr" || at_failed=:])
|
|
2214
|
+
m4_define([AT_DIFF_STDERR()],
|
|
2215
|
+
[at_fn_diff_devnull "$at_stderr" || at_failed=:])
|
|
2216
|
+
|
|
2217
|
+
m4_define([AT_DIFF_STDOUT(stdout)],
|
|
2218
|
+
[echo stdout:; tee stdout <"$at_stdout"])
|
|
2219
|
+
m4_define([AT_DIFF_STDOUT(stdout-nolog)],
|
|
2220
|
+
[echo stdout captured; cp "$at_stdout" stdout])
|
|
2221
|
+
m4_define([AT_DIFF_STDOUT(ignore)],
|
|
2222
|
+
[echo stdout:; cat "$at_stdout"])
|
|
2223
|
+
m4_define([AT_DIFF_STDOUT(ignore-nolog)])
|
|
2224
|
+
m4_define([AT_DIFF_STDOUT(expout)],
|
|
2225
|
+
[$at_diff expout "$at_stdout" || at_failed=:])
|
|
2226
|
+
m4_define([AT_DIFF_STDOUT()],
|
|
2227
|
+
[at_fn_diff_devnull "$at_stdout" || at_failed=:])
|
|
2228
|
+
|
|
2229
|
+
# _AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR,
|
|
2230
|
+
# [RUN-IF-FAIL], [RUN-IF-PASS])
|
|
2231
|
+
# -------------------------------------------------
|
|
2232
|
+
# Worker for AT_CHECK and AT_CHECK_UNQUOTED, with COMMANDS, STDOUT, and
|
|
2233
|
+
# STDERR pre-expanded.
|
|
2234
|
+
#
|
|
2235
|
+
# Implementation Details
|
|
2236
|
+
# ----------------------
|
|
2237
|
+
# Ideally, we would like to run
|
|
2238
|
+
#
|
|
2239
|
+
# ( $at_traceon; COMMANDS >at-stdout 2> at-stderr )
|
|
2240
|
+
#
|
|
2241
|
+
# but we must group COMMANDS as it is not limited to a single command, and
|
|
2242
|
+
# then the shells will save the traces in at-stderr. So we have to filter
|
|
2243
|
+
# them out when checking stderr, and we must send them into the test suite's
|
|
2244
|
+
# stderr to honor -x properly. Since only the first line of the trace of a
|
|
2245
|
+
# multiline command starts with a '+', and I know of no straightforward way to
|
|
2246
|
+
# filter out the unadorned trace lines, we disable shell tracing entirely for
|
|
2247
|
+
# commands that could span multiple lines.
|
|
2248
|
+
#
|
|
2249
|
+
# Limiting COMMANDS to a single command is not good either, since then
|
|
2250
|
+
# the user herself would use {} or (), and then we face the same problem.
|
|
2251
|
+
#
|
|
2252
|
+
# But then, there is no point in running
|
|
2253
|
+
#
|
|
2254
|
+
# ( $at_traceon { $1 ; } >at-stdout 2>at-stder1 )
|
|
2255
|
+
#
|
|
2256
|
+
# instead of the simpler
|
|
2257
|
+
#
|
|
2258
|
+
# ( $at_traceon; $1 ) >at-stdout 2>at-stder1
|
|
2259
|
+
#
|
|
2260
|
+
# Note that we truncate and append to the output files, to avoid losing
|
|
2261
|
+
# output from multiple concurrent processes, e.g., an inner testsuite
|
|
2262
|
+
# with parallel jobs.
|
|
2263
|
+
m4_define([_AT_CHECK],
|
|
2264
|
+
[m4_define([AT_ingroup])]dnl
|
|
2265
|
+
[{ set +x
|
|
2266
|
+
AS_ECHO(["$at_srcdir/AT_LINE: AS_ESCAPE([[$1]])"])
|
|
2267
|
+
_AT_DECIDE_TRACEABLE([$1]) _AT_LINE_ESCAPED
|
|
2268
|
+
( $at_check_trace; [$1]
|
|
2269
|
+
) >>"$at_stdout" 2>>"$at_stderr" AS_MESSAGE_LOG_FD>&-
|
|
2270
|
+
at_status=$? at_failed=false
|
|
2271
|
+
$at_check_filter
|
|
2272
|
+
m4_ifdef([AT_DIFF_STDERR($4)], [m4_indir([AT_DIFF_STDERR($4)])],
|
|
2273
|
+
[echo >>"$at_stderr"; AS_ECHO([["$4"]]) | \
|
|
2274
|
+
$at_diff - "$at_stderr" || at_failed=:])
|
|
2275
|
+
m4_ifdef([AT_DIFF_STDOUT($3)], [m4_indir([AT_DIFF_STDOUT($3)])],
|
|
2276
|
+
[echo >>"$at_stdout"; AS_ECHO([["$3"]]) | \
|
|
2277
|
+
$at_diff - "$at_stdout" || at_failed=:])
|
|
2278
|
+
m4_if([$2], [ignore], [at_fn_check_skip],
|
|
2279
|
+
[at_fn_check_status m4_default([$2], [0])]) $at_status "$at_srcdir/AT_LINE"
|
|
2280
|
+
m4_ifvaln([$5$6], [AS_IF($at_failed, [$5], [$6])])]dnl
|
|
2281
|
+
[$at_failed && at_fn_log_failure AT_capture_files
|
|
2282
|
+
$at_traceon; }
|
|
2283
|
+
])# _AT_CHECK
|
|
2284
|
+
|
|
2285
|
+
# _AT_CHECK_EXIT(COMMANDS, [EXIT-STATUS-IF-PASS])
|
|
2286
|
+
# -----------------------------------------------
|
|
2287
|
+
# Minimal version of _AT_CHECK for AT_SKIP_IF and AT_FAIL_IF.
|
|
2288
|
+
m4_define([_AT_CHECK_EXIT],
|
|
2289
|
+
[m4_define([AT_ingroup])]dnl
|
|
2290
|
+
[AS_ECHO(_AT_LINE_ESCAPED) >"$at_check_line_file"
|
|
2291
|
+
m4_ifval([$1], [($1) \
|
|
2292
|
+
&& ])at_fn_check_skip $2 "$at_srcdir/AT_LINE"])# _AT_CHECK_EXIT
|