📄 general.m4
字号:
$SHELL $[0] $at_skip_list --list echo fi if test $at_xpass_count != 0; then echo "Unexpected passes:" $SHELL $[0] $at_xpass_list --list echo fi if test $at_fail_count != 0; then AS_BOX([Detailed failed tests.]) echo for at_group in $at_fail_list do # Normalize the test group number. at_group_normalized=`expr "00000$at_group" : ".*\($at_format\)"` # Create a fresh directory for the next test group, and enter. at_group_dir=$at_suite_dir/$at_group_normalized at_group_log=$at_group_dir/$as_me.log cat $at_group_log echo done echo fi if test -n "$at_top_srcdir"; then AS_BOX([$at_top_builddir/config.log]) sed 's/^/| /' $at_top_builddir/config.log echo fi } >&AS_MESSAGE_LOG_FD AS_BOX([$as_me.log was created.]) echo echo "Please send \`$as_me.log' and all information you think might help:" echo echo " To: <AT_PACKAGE_BUGREPORT>" echo " Subject: @<:@AT_PACKAGE_STRING@:>@ $as_me:dnl$at_fail_list${at_fail_list:+ failed${at_xpass_list:+,}}dnl$at_xpass_list${at_xpass_list:+ passed unexpectedly}" echo if test $at_debug_p = false; then echo echo 'You may investigate any problem if you feel able to do so, in which' echo 'case the test suite provides a good starting point.' echo fi exit 1fiexit 0m4_divert_pop([TESTS_END])dnldnl End of AT_INIT: divert to KILL, only test groups are to bednl output, the rest is ignored. Current diversion is BODY, inheriteddnl from M4sh.m4_divert_push([KILL])m4_wrap([m4_divert_pop([KILL])[]])])# AT_INIT# _AT_ARG_OPTION(OPTIONS,HELP-TEXT,[ARGS],[ACTION-IF-GIVEN],# [ACTION-IF-NOT-GIVEN])# ---------------------------------------------------------------------------# Internal implementation of AT_ARG_OPTION & AT_ARG_OPTION_ARGm4_defun([_AT_ARG_OPTION],[m4_divert_once([HELP_OTHER],[cat <<_ATEOFOther options:_ATEOF])dnl m4_divert_once HELP_OTHERm4_divert_text([HELP_OTHER],[cat <<_ATEOF$2_ATEOF])dnldnl Turn our options into our desired stringsm4_ifdef([AT_first_option],[m4_undefine([AT_first_option])])dnlm4_ifdef([AT_case],[m4_undefine([AT_case])])dnlm4_ifdef([AT_case_no],[m4_undefine([AT_case_no])])dnlm4_ifdef([AT_case_arg],[m4_undefine([AT_case_arg])])dnlm4_foreach([AT_option], m4_split(m4_normalize([$1]),[[ \|]+]),[m4_define_default([AT_first_option],AT_option)dnlm4_append([AT_case],m4_if(m4_len(AT_option),1,[],[-])[-]AT_option, [ | ])dnlm4_append([AT_case_no],[--no]AT_option, [ | ])dnlm4_append([AT_case_arg],m4_if(m4_len(AT_option),1,[],[-])[-]AT_option[=*], [ | ])dnl])dnl m4_foreach AT_optiondnl keep track so we or the user may process ACTION-IF-NOT-GIVENm4_divert_once([PARSE_ARGS_BEGIN],[#### Set up package specific options.##])dnlm4_divert_text([PARSE_ARGS_BEGIN],[dnl Provide a default value for options without arguments.m4_ifvaln([$3],,[at_arg_[]m4_bpatsubst([AT_first_option], -, _)=false])dnlat_arg_given_[]m4_bpatsubst([AT_first_option], -, _)=false])dnl m4_divert_text DEFAULTSm4_ifval([$3],[m4_divert_once([PARSE_ARGS_END],[#### Verify our last option didn't require an argument##AS_IF([test -n "$at_prev"],[AS_ERROR([`$at_prev' requires an argument.])])])])m4_divert_text([PARSE_ARGS],[dnl Parse the options and args when necessary.m4_ifvaln([$3],[ AT_case ) at_prev=--m4_bpatsubst([AT_first_option], -, _) ;; AT_case_arg ) at_arg_[]m4_bpatsubst([AT_first_option], -, _)=$at_optarg at_arg_given_[]m4_bpatsubst([AT_first_option], -, _)=: $4 ;;],[ AT_case ) at_optarg=: at_arg_[]m4_bpatsubst([AT_first_option], -, _)=: at_arg_given_[]m4_bpatsubst([AT_first_option], -, _)=: m4_ifval([$4],[$4])dnl ;; AT_case_no ) at_optarg=false at_arg_[]m4_bpatsubst([AT_first_option], -, _)=false at_arg_given_[]m4_bpatsubst([AT_first_option], -, _)=: m4_ifval([$4],[$4])dnl ;;])dnl m4_ifvaln $3])dnl m4_divert_text PARSE_ARGSm4_ifvaln([$5],[m4_divert_once([PARSE_ARGS_END],[#### Process package specific options when _not_ supplied.##])dnl m4_divert_once PARSE_ARGS_ENDm4_divert_text([PARSE_ARGS_END],[AS_IF([$at_arg_given_[]m4_bpatsubst([AT_first_option], -, _)],,[$5])dnl])dnl m4_divert_text PARSE_ARGS_END])dnl m4_ifvaln $5])dnl _AT_ARG_OPTION# AT_ARG_OPTION(OPTIONS,HELP-TEXT,[ACTION-IF-GIVEN],[ACTION-IF-NOT-GIVEN])# ------------------------------------------------------------------------# Accept a set of OPTIONS with arguments. Add HELP-TEXT to the HELP_OTHER# diversion.## Preceding dashes should not be passed into OPTIONS. Users will be required# to pass `--' before long options and `-' before single character options.## $at_arg_OPTION will be set to `:' if this option is received, `false' if# if --noOPTION is received, and `false' by default.## Run ACTION-IF-GIVEN each time an option in OPTIONS is encountered with# $at_optarg set to `:' or `false' as appropriate. $opt_arg is actually# just a copy of $at_arg_OPTION.## ACTION-IF-NOT-GIVEN will be run once after option parsing is complete# if no option from OPTIONS was found.m4_defun([AT_ARG_OPTION],[_AT_ARG_OPTION([$1],[$2],,[$3],[$4])])# AT_ARG_OPTION_ARG(OPTIONS,HELP-TEXT,[ACTION-IF-GIVEN],[ACTION-IF-NOT-GIVEN])# ---------------------------------------------------------------------------# Accept a set of OPTIONS with arguments, seperated by commas. Add HELP-TEXT# to the HELP_OTHER diversion.## Preceding dashes should not be passed into OPTIONS. Users will be required# to pass `--' before long options and `-' before single character options.## By default, any argument to these options will be assigned to the shell# variable $at_arg_OPTION, where OPTION is the first option in OPTIONS with# any `-' characters replaced with `_'.## Run ACTION-IF-GIVEN each time an option in OPTIONS is encountered with# $at_optarg set. $at_optarg is actually just a copy of $at_arg_OPTION.## ACTION-IF-NOT-GIVEN will be run once after option parsing is complete# if no option from OPTIONS was found.m4_defun([AT_ARG_OPTION_ARG],[_AT_ARG_OPTION([$1],[$2],1,[$3],[$4])])# AT_TESTED(PROGRAMS)# -------------------# Specify the list of programs exercised by the test suite. Their# versions are logged, and in the case of embedded test suite, they# must correspond to the version of the package.. The PATH should be# already preset so the proper executable will be selected.m4_define([AT_TESTED],[m4_append_uniq([AT_tested], [$1], [ ])])# AT_SETUP(DESCRIPTION)# ---------------------# Start a group of related tests, all to be executed in the same subshell.# The group is testing what DESCRIPTION says.m4_define([AT_SETUP],[m4_ifdef([AT_keywords], [m4_undefine([AT_keywords])])m4_define([AT_line], AT_LINE)m4_define([AT_xfail], [at_xfail=no])m4_define([AT_description], [$1])m4_define([AT_ordinal], m4_incr(AT_ordinal))m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal]))m4_divert_push([TESTS])dnl AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1 at_setup_line='m4_defn([AT_line])' at_desc='$1' $at_quiet $ECHO_N "m4_format([[%3d: %-45s]], AT_ordinal, [$1])[]$ECHO_C"m4_divert_push([TEST_SCRIPT])dnl])# AT_XFAIL_IF(SHELL-EXPRESSION)# -----------------------------------# Set up the test to be expected to fail if SHELL-EXPRESSION evaluates to# true (exitcode = 0).m4_define([AT_XFAIL_IF],[dnldnl Try to limit the amount of conditionals that we emit.m4_case([$1], [], [], [false], [], [:], [m4_define([AT_xfail], [at_xfail=yes])], [true], [m4_define([AT_xfail], [at_xfail=yes])], [m4_append([AT_xfail], [ $1 && at_xfail=yes])])])# AT_KEYWORDS(KEYOWRDS)# ---------------------# Declare a list of keywords associated to the current test group.m4_define([AT_KEYWORDS],[m4_append_uniq([AT_keywords], [$1], [ ])])# AT_CLEANUP# ----------# Complete a group of related tests.m4_define([AT_CLEANUP],[m4_append([AT_help_all],m4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords], [m4_defn([AT_keywords])]);)dnlm4_divert_pop([TEST_SCRIPT])dnl Back to TESTS AT_xfail ( echo "AT_ordinal. m4_defn([AT_line]): testing $1..." $at_traceonm4_undivert([TEST_SCRIPT])dnl Insert the code here $at_traceoff $at_times_p && times >$at_times_file ) AS_MESSAGE_LOG_FD>&1 2>&1 | eval $at_tee_pipe at_status=`cat $at_status_file` ;;m4_divert_pop([TESTS])dnl Back to KILL.])# AT_CLEANUP# AT_BANNER(TEXT)# ---------------# Output TEXT without any shell expansion.m4_define([AT_BANNER],[m4_define([AT_banner_ordinal], m4_incr(AT_banner_ordinal))m4_append([AT_groups_all], [ banner-]m4_defn([AT_banner_ordinal]))m4_divert_text([TESTS],[ banner-AT_banner_ordinal ) @%:@ Banner AT_banner_ordinal. AT_LINE cat <<\_ATEOF$1_ATEOF ;;])dnl])# AT_BANNER# AT_DATA(FILE, CONTENTS)# -----------------------# Initialize an input data FILE with given CONTENTS, which should end with# an end of line.# This macro is not robust to active symbols in CONTENTS *on purpose*.# If you don't want CONTENT to be evaluated, quote it twice.m4_define([AT_DATA],[cat >$1 <<'_ATEOF'$2[]_ATEOF])# AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR,# [RUN-IF-FAIL], [RUN-IF-PASS])# ------------------------------------------------# Execute a test by performing given shell COMMANDS. These commands# should normally exit with STATUS, while producing expected STDOUT and# STDERR contents. Shell metacharacters in STDOUT and STDERR are# _not_ processed by the shell, but are treated as string literals.## STATUS, STDOUT, and STDERR are not checked if equal to `ignore'.## If STDOUT is `expout', then stdout is compared to the content of the file# `expout'. Likewise for STDERR and `experr'.## If STDOUT is `stdout', then the stdout is left in the file `stdout',# likewise for STDERR and `stderr'. Don't do this:## AT_CHECK([command >out])# # Some checks on `out'## do this instead:## AT_CHECK([command], [], [stdout])# # Some checks on `stdout'## This is an unfortunate limitation inherited from Ultrix which will not# let you redirect several times the same FD (see the Autoconf documentation).# If you use the `AT_CHECK([command >out])' be sure to get a test suite# that will show spurious failures.## You might wonder why not just use `ignore' and directly use stdout and# stderr left by the test suite. Firstly because the names of these files# is an internal detail, and secondly, because## AT_CHECK([command], [], [ignore])# AT_CHECK([check stdout])## will use `stdout' both in input and output: undefined behavior would# certainly result. That's why the test suite will save them in `at-stdout'# and `at-stderr', and will provide you with `stdout' and `stderr'.## Any line of stderr starting with leading blanks and a `+' are filtered# out, since most shells when tracing include subshell traces in stderr.# This may cause spurious failures when the test suite is run with `-x'.#m4_define([AT_CHECK],[_AT_CHECK([$1],[$2],[$3],[$4],[$5],[$6],1)])# AT_CHECK_NOESCAPE(COMMANDS, [STATUS = 0], STDOUT, STDERR,# [RUN-IF-FAIL], [RUN-IF-PASS])# ---------------------------------------------------------# Like AT_CHECK, but do not AS_ESCAPE shell metacharacters in the STDOUT# and STDERR arguments before running the comparison.m4_define([AT_CHECK_NOESCAPE],[_AT_CHECK([$1],[$2],[$3],[$4],[$5],[$6])])# _AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR,# [RUN-IF-FAIL], [RUN-IF-PASS], SHELL_ESCAPE_IO)# ---------------------------------------------------------# Worker for AT_CHECK & AT_CHECK_NOESCAPE. The final SHELL-ESCAPE-IO# argument determines whether the STDOUT & STDERR arguments will be escaped or# not.### Implementation Details# ----------------------# Ideally, we would like to run## ( $at_traceon; COMMANDS >at-stdout 2> at-stderr )## but we must group COMMANDS as it is not limited to a single command, and# then the shells will save the traces in at-stderr. So we have to filter# them out when checking stderr, and we must send them into the test suite's# stderr to honor -x properly.## Limiting COMMANDS to a single command is not good either, since them# the user herself would use {} or (), and then we face the same problem.## But then, there is no point in running## ( $at_traceon { $1 ; } >at-stdout 2>at-stder1 )## instead of the simpler## ( $at_traceon; $1 ) >at-stdout 2>at-stder1#m4_define([_AT_CHECK],[$at_traceoffecho "AT_LINE: AS_ESCAPE([$1])"echo AT_LINE >$at_check_line_file( $at_traceon; $1 ) >$at_stdout 2>$at_stder1at_status=$?grep '^ *+' $at_stder1 >&2grep -v '^ *+' $at_stder1 >$at_stderrat_failed=falsednl Check stderr.m4_case([$4], stderr, [echo stderr:; tee stderr <$at_stderr], ignore, [echo stderr:; cat $at_stderr], experr, [$at_diff experr $at_stderr || at_failed=:], [], [$at_diff $at_devnull $at_stderr || at_failed=:], [echo >>$at_stderr; echo "m4_ifval([$7],[AS_ESCAPE([$4])],[$4])" | $at_diff - $at_stderr || at_failed=:])dnl Check stdout.m4_case([$3], stdout, [echo stdout:; tee stdout <$at_stdout], ignore, [echo stdout:; cat $at_stdout], expout, [$at_diff expout $at_stdout || at_failed=:], [], [$at_diff $at_devnull $at_stdout || at_failed=:], [echo >>$at_stdout; echo "m4_ifval([$7],[AS_ESCAPE([$3])],[$3])" | $at_diff - $at_stdout || at_failed=:])dnl Check exit val. Don't `skip' if we are precisely checking $? = 77.case $at_status inm4_case([$2], [77], [], [ 77) echo 77 > $at_status_file exit 77;;])dnlm4_case([$2], [ignore], [ *);;], [ m4_default([$2], [0])) ;; *) echo "AT_LINE: exit code was $at_status, expected m4_default([$2], [0])" at_failed=:;;])esacAS_IF($at_failed, [$5 echo 1 > $at_status_file exit 1], [$6])$at_traceon])# AT_CHECK_NOESCAPE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -