997 |
]) |
]) |
998 |
|
|
999 |
|
|
1000 |
# AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR) |
# AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR, |
1001 |
|
# [RUN-IF-FAIL], [RUN-IF-PASS]) |
1002 |
# ------------------------------------------------ |
# ------------------------------------------------ |
1003 |
# Execute a test by performing given shell COMMANDS. These commands |
# Execute a test by performing given shell COMMANDS. These commands |
1004 |
# should normally exit with STATUS, while producing expected STDOUT and |
# should normally exit with STATUS, while producing expected STDOUT and |
1005 |
# STDERR contents. |
# STDERR contents. Shell metacharacters in STDOUT and STDERR are |
1006 |
|
# _not_ processed by the shell, but are treated as string literals. |
1007 |
# |
# |
1008 |
# STATUS, STDOUT, and STDERR are not checked if equal to `ignore'. |
# STATUS, STDOUT, and STDERR are not checked if equal to `ignore'. |
1009 |
# |
# |
1041 |
# out, since most shells when tracing include subshell traces in stderr. |
# out, since most shells when tracing include subshell traces in stderr. |
1042 |
# This may cause spurious failures when the test suite is run with `-x'. |
# This may cause spurious failures when the test suite is run with `-x'. |
1043 |
# |
# |
1044 |
|
m4_define([AT_CHECK], |
1045 |
|
[AT_CHECK_NOESCAPE([$1],[$2],AS_ESCAPE([$3]),AS_ESCAPE([$4]),[$5],[$6])]) |
1046 |
|
|
1047 |
|
|
1048 |
|
|
1049 |
|
# AT_CHECK_NOESCAPE(COMMANDS, [STATUS = 0], STDOUT, STDERR, |
1050 |
|
# [RUN-IF-FAIL], [RUN-IF-PASS]) |
1051 |
|
# --------------------------------------------------------- |
1052 |
|
# Like AT_CHECK, but do not AS_ESCAPE shell metacharacters in the STDOUT |
1053 |
|
# and STDERR arguments before running the comparison. |
1054 |
|
# |
1055 |
# |
# |
1056 |
# Implementation Details |
# Implementation Details |
1057 |
# ---------------------- |
# ---------------------- |
1075 |
# |
# |
1076 |
# ( $at_traceon; $1 ) >at-stdout 2>at-stder1 |
# ( $at_traceon; $1 ) >at-stdout 2>at-stder1 |
1077 |
# |
# |
1078 |
m4_define([AT_CHECK], |
m4_define([AT_CHECK_NOESCAPE], |
1079 |
[$at_traceoff |
[$at_traceoff |
1080 |
echo "AT_LINE: AS_ESCAPE([$1])" |
echo "AT_LINE: AS_ESCAPE([$1])" |
1081 |
echo AT_LINE >$at_check_line_file |
echo AT_LINE >$at_check_line_file |
1090 |
ignore, [echo stderr:; cat $at_stderr], |
ignore, [echo stderr:; cat $at_stderr], |
1091 |
experr, [$at_diff experr $at_stderr || at_failed=:], |
experr, [$at_diff experr $at_stderr || at_failed=:], |
1092 |
[], [$at_diff $at_devnull $at_stderr || at_failed=:], |
[], [$at_diff $at_devnull $at_stderr || at_failed=:], |
1093 |
[echo >>$at_stderr; echo "AS_ESCAPE([$4])" | $at_diff - $at_stderr || at_failed=:]) |
[echo >>$at_stderr; echo "$4" | $at_diff - $at_stderr || at_failed=:]) |
1094 |
dnl Check stdout. |
dnl Check stdout. |
1095 |
m4_case([$3], |
m4_case([$3], |
1096 |
stdout, [echo stdout:; tee stdout <$at_stdout], |
stdout, [echo stdout:; tee stdout <$at_stdout], |
1097 |
ignore, [echo stdout:; cat $at_stdout], |
ignore, [echo stdout:; cat $at_stdout], |
1098 |
expout, [$at_diff expout $at_stdout || at_failed=:], |
expout, [$at_diff expout $at_stdout || at_failed=:], |
1099 |
[], [$at_diff $at_devnull $at_stdout || at_failed=:], |
[], [$at_diff $at_devnull $at_stdout || at_failed=:], |
1100 |
[echo >>$at_stdout; echo "AS_ESCAPE([$3])" | $at_diff - $at_stdout || at_failed=:]) |
[echo >>$at_stdout; echo "$3" | $at_diff - $at_stdout || at_failed=:]) |
1101 |
dnl Check exit val. Don't `skip' if we are precisely checking $? = 77. |
dnl Check exit val. Don't `skip' if we are precisely checking $? = 77. |
1102 |
case $at_status in |
case $at_status in |
1103 |
m4_case([$2], |
m4_case([$2], |
1117 |
echo 1 > $at_status_file |
echo 1 > $at_status_file |
1118 |
exit 1], [$6]) |
exit 1], [$6]) |
1119 |
$at_traceon |
$at_traceon |
1120 |
])# AT_CHECK |
])# AT_CHECK_NOESCAPE |