81 |
# optimization. Do anything else that needs to be done to prepare for |
# optimization. Do anything else that needs to be done to prepare for |
82 |
# tests. Sets up verbose and log file descriptors. Sets and logs PATH. |
# tests. Sets up verbose and log file descriptors. Sets and logs PATH. |
83 |
# - TESTS |
# - TESTS |
84 |
# The core of the test suite, the ``normal'' diversion. Scripting in the |
# The core of the test suite, the ``normal'' diversion. |
|
# source *.at file ends up here too. |
|
85 |
# - TESTS_END |
# - TESTS_END |
86 |
# overall wrap up, generation of debugging scripts and statistics. |
# tail of the core for;case, overall wrap up, generation of debugging |
87 |
|
# scripts and statistics. |
88 |
|
|
89 |
m4_define([_m4_divert(DEFAULTS)], 100) |
m4_define([_m4_divert(DEFAULTS)], 100) |
90 |
m4_define([_m4_divert(PARSE_ARGS)], 200) |
m4_define([_m4_divert(PARSE_ARGS)], 200) |
568 |
else |
else |
569 |
at_diff=diff |
at_diff=diff |
570 |
fi |
fi |
571 |
m4_divert_pop([TESTS])dnl |
|
572 |
dnl Individual tests are inserted here. |
|
573 |
m4_divert_push([TESTS_END])dnl |
for at_group in $at_groups |
574 |
|
do |
575 |
|
# Be sure to come back to the top test directory. |
576 |
|
cd $at_suite_dir |
577 |
|
|
578 |
|
case $at_group in |
579 |
|
banner-*) ;; |
580 |
|
*) |
581 |
|
# Skip tests we already run (using --keywords makes it easy to get |
582 |
|
# duplication). |
583 |
|
case " $at_pass_test $at_skip_test $at_fail_test " in |
584 |
|
*" $at_group "* ) continue;; |
585 |
|
esac |
586 |
|
|
587 |
|
# Normalize the test group number. |
588 |
|
at_group_normalized=`expr "00000$at_group" : ".*\($at_format\)"` |
589 |
|
|
590 |
|
# Create a fresh directory for the next test group, and enter. |
591 |
|
at_group_dir=$at_suite_dir/$at_group_normalized |
592 |
|
rm -rf $at_group_dir |
593 |
|
mkdir $at_group_dir || |
594 |
|
AS_ERROR([cannot create $at_group_dir]) |
595 |
|
cd $at_group_dir |
596 |
|
;; |
597 |
|
esac |
598 |
|
|
599 |
|
at_status=0 |
600 |
|
# Clearly separate the test groups when verbose. |
601 |
|
test $at_group_count != 0 && $at_verbose |
602 |
|
case $at_group in |
603 |
|
dnl Test groups inserted here (TESTS). |
604 |
|
m4_divert_pop([TESTS])[]dnl |
605 |
|
m4_divert_push([TESTS_END])[]dnl |
606 |
|
|
607 |
|
* ) |
608 |
|
echo "$as_me: no such test group: $at_group" >&2 |
609 |
|
continue |
610 |
|
;; |
611 |
|
esac |
612 |
|
|
613 |
|
# Be sure to come back to the suite directory, in particular |
614 |
|
# since below we might `rm' the group directory we are in currently. |
615 |
|
cd $at_suite_dir |
616 |
|
|
617 |
|
case $at_group in |
618 |
|
banner-*) ;; |
619 |
|
*) |
620 |
|
if test ! -f $at_check_line_file; then |
621 |
|
sed "s/^ */$as_me: warning: /" <<_ATEOF |
622 |
|
A failure happened in a test group before any test could be |
623 |
|
run. This means that test suite is improperly designed. Please |
624 |
|
report this failure to <AT_PACKAGE_BUGREPORT>. |
625 |
|
_ATEOF |
626 |
|
echo "$at_setup_line" >$at_check_line_file |
627 |
|
fi |
628 |
|
at_group_count=`expr 1 + $at_group_count` |
629 |
|
$at_verbose $ECHO_N "$at_group. $at_setup_line: $ECHO_C" |
630 |
|
case $at_status in |
631 |
|
0) at_msg="ok" |
632 |
|
at_pass_list="$at_pass_list $at_group" |
633 |
|
# Cleanup the group directory, unless the user wants the files. |
634 |
|
$at_debug_p || rm -rf $at_group_dir |
635 |
|
;; |
636 |
|
77) at_msg="ok (skipped near \``cat $at_check_line_file`')" |
637 |
|
at_skip_list="$at_skip_list $at_group" |
638 |
|
# Cleanup the group directory, unless the user wants the files. |
639 |
|
$at_debug_p || rm -rf $at_group_dir |
640 |
|
;; |
641 |
|
*) at_msg="FAILED near \``cat $at_check_line_file`'" |
642 |
|
at_fail_list="$at_fail_list $at_group" |
643 |
|
# Up failure, keep the group directory for autopsy. |
644 |
|
# Create the debugging script. |
645 |
|
{ |
646 |
|
echo "#! /bin/sh" |
647 |
|
echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$[@]"}'\''='\''"$[@]"'\''' |
648 |
|
echo "cd $at_dir" |
649 |
|
echo 'exec ${CONFIG_SHELL-'"$SHELL"'}' "$[0]" \ |
650 |
|
'-v -d' "$at_debug_args" "$at_group" '${1+"$[@]"}' |
651 |
|
echo 'exit 1' |
652 |
|
} >$at_group_dir/run |
653 |
|
chmod +x $at_group_dir/run |
654 |
|
;; |
655 |
|
esac |
656 |
|
echo $at_msg |
657 |
|
at_log_msg="$at_group. $at_setup_line: $at_msg" |
658 |
|
# If the group failed, $at_times_file is not available. |
659 |
|
test -f $at_times_file && |
660 |
|
at_log_msg="$at_log_msg (`sed 1d $at_times_file`)" |
661 |
|
echo "$at_log_msg" >&AS_MESSAGE_LOG_FD |
662 |
|
$at_errexit_p && test -n "$at_fail_list" && break |
663 |
|
;; |
664 |
|
esac |
665 |
|
done |
666 |
|
|
667 |
# Back to the top directory, in particular because we might |
# Back to the top directory, in particular because we might |
668 |
# rerun the suite verbosely. |
# rerun the suite verbosely. |
759 |
|
|
760 |
exit 0 |
exit 0 |
761 |
m4_divert_pop([TESTS_END])dnl |
m4_divert_pop([TESTS_END])dnl |
762 |
dnl End of AT_INIT: divert to TESTS, script in the file is output into |
dnl End of AT_INIT: divert to KILL, only test groups are to be |
763 |
dnl the standard diversion with the tests. |
dnl output, the rest is ignored. Current diversion is BODY, inherited |
764 |
dnl Current diversion is BODY, inherited from M4sh. |
dnl from M4sh. |
765 |
m4_divert_push([TESTS])dnl |
m4_divert_push([KILL]) |
766 |
m4_wrap([m4_divert_pop([TESTS])[]]) |
m4_wrap([m4_divert_pop([KILL])[]]) |
767 |
])# AT_INIT |
])# AT_INIT |
768 |
|
|
769 |
|
|
782 |
# Start a group of related tests, all to be executed in the same subshell. |
# Start a group of related tests, all to be executed in the same subshell. |
783 |
# The group is testing what DESCRIPTION says. |
# The group is testing what DESCRIPTION says. |
784 |
m4_define([AT_SETUP], |
m4_define([AT_SETUP], |
785 |
[m4_ifdef([AT_keywords], [m4_undefine([AT_keywords])])dnl |
[m4_ifdef([AT_keywords], [m4_undefine([AT_keywords])]) |
786 |
m4_define([AT_line], AT_LINE)dnl |
m4_define([AT_line], AT_LINE) |
787 |
m4_define([AT_description], [$1])dnl |
m4_define([AT_description], [$1]) |
788 |
m4_define([AT_ordinal], m4_incr(AT_ordinal))dnl |
m4_define([AT_ordinal], m4_incr(AT_ordinal)) |
789 |
m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal]))dnl |
m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal])) |
790 |
|
m4_divert_push([TESTS])dnl |
791 |
if $at_errexit_p && test -n "$at_fail_list"; then |
AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1 |
792 |
: |
at_setup_line='m4_defn([AT_line])' |
793 |
else |
$at_verbose "AT_ordinal. m4_defn([AT_line]): testing $1..." |
794 |
# Be sure to come back to the top test directory. |
$at_quiet $ECHO_N "m4_format([[%3d: %-18s]], |
795 |
cd $at_suite_dir |
AT_ordinal, m4_defn([AT_line]))[]$ECHO_C" |
796 |
|
( |
797 |
# Skip this test if it isn't in our list of tests to run |
$at_traceon |
|
case " $at_groups " in |
|
|
*" AT_ordinal "*) |
|
|
# Normalize the test group number. |
|
|
at_group_normalized=`expr "00000[]AT_ordinal" : ".*\($at_format\)"` |
|
|
|
|
|
# Create a fresh directory for the next test group, and enter. |
|
|
at_group_dir=$at_suite_dir/$at_group_normalized |
|
|
rm -rf $at_group_dir |
|
|
mkdir $at_group_dir || |
|
|
AS_ERROR([cannot create $at_group_dir]) |
|
|
cd $at_group_dir |
|
|
|
|
|
at_status=0 |
|
|
# Clearly separate the test groups when verbose. |
|
|
test $at_group_count != 0 && $at_verbose |
|
|
|
|
|
@%:@ AT_ordinal. m4_defn([AT_line]): $1 |
|
|
at_setup_line='m4_defn([AT_line])' |
|
|
$at_verbose "AT_ordinal. m4_defn([AT_line]): testing $1..." |
|
|
$at_quiet $ECHO_N "m4_format([[%3d: %-18s]], |
|
|
AT_ordinal, m4_defn([AT_line]))[]$ECHO_C" |
|
|
( |
|
|
$at_traceon |
|
798 |
]) |
]) |
799 |
|
|
800 |
|
|
813 |
at_help_all=$at_help_all'm4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords], [m4_defn([AT_keywords])]) |
at_help_all=$at_help_all'm4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords], [m4_defn([AT_keywords])]) |
814 |
' |
' |
815 |
)dnl |
)dnl |
816 |
$at_times_skip || times >$at_times_file |
$at_times_skip || times >$at_times_file |
817 |
) |
) |
818 |
at_status=$? |
at_status=$? |
819 |
|
;; |
|
# Be sure to come back to the suite directory, in particular |
|
|
# since below we might `rm' the group directory we are in currently. |
|
|
cd $at_suite_dir |
|
820 |
|
|
821 |
if test ! -f $at_check_line_file; then |
m4_divert_pop([TESTS])dnl Back to KILL. |
|
sed "s/^ */$as_me: warning: /" <<_ATEOF |
|
|
A failure happened in a test group before any test could be |
|
|
run. This means that test suite is improperly designed. Please |
|
|
report this failure to <AT_PACKAGE_BUGREPORT>. |
|
|
_ATEOF |
|
|
echo "$at_setup_line" >$at_check_line_file |
|
|
fi |
|
|
at_group_count=`expr 1 + $at_group_count` |
|
|
$at_verbose $ECHO_N "AT_ordinal. $at_setup_line: $ECHO_C" |
|
|
case $at_status in |
|
|
0) at_msg="ok" |
|
|
at_pass_list="$at_pass_list AT_ordinal" |
|
|
# Cleanup the group directory, unless the user wants the files. |
|
|
$at_debug_p || rm -rf $at_group_dir |
|
|
;; |
|
|
77) at_msg="ok (skipped near \``cat $at_check_line_file`')" |
|
|
at_skip_list="$at_skip_list AT_ordinal" |
|
|
# Cleanup the group directory, unless the user wants the files. |
|
|
$at_debug_p || rm -rf $at_group_dir |
|
|
;; |
|
|
*) at_msg="FAILED near \``cat $at_check_line_file`'" |
|
|
at_fail_list="$at_fail_list AT_ordinal" |
|
|
# Up failure, keep the group directory for autopsy. |
|
|
# Create the debugging script. |
|
|
{ |
|
|
echo "#! /bin/sh" |
|
|
echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$[@]"}'\''='\''"$[@]"'\''' |
|
|
echo "cd $at_dir" |
|
|
echo 'exec ${CONFIG_SHELL-'"$SHELL"'}' "$[0]" \ |
|
|
'-v -d' "$at_debug_args" "AT_ordinal" '${1+"$[@]"}' |
|
|
echo 'exit 1' |
|
|
} >$at_group_dir/run |
|
|
chmod +x $at_group_dir/run |
|
|
;; |
|
|
esac |
|
|
echo $at_msg |
|
|
at_log_msg="AT_ordinal. $at_setup_line: $at_msg" |
|
|
# If the group failed, $at_times_file is not available. |
|
|
test -f $at_times_file && |
|
|
at_log_msg="$at_log_msg (`sed 1d $at_times_file`)" |
|
|
echo "$at_log_msg" >&AS_MESSAGE_LOG_FD |
|
|
;; |
|
|
esac |
|
|
fi |
|
822 |
])# AT_CLEANUP |
])# AT_CLEANUP |
823 |
|
|
824 |
|
|
826 |
# --------------- |
# --------------- |
827 |
# Output TEXT without any shell expansion. |
# Output TEXT without any shell expansion. |
828 |
m4_define([AT_BANNER], |
m4_define([AT_BANNER], |
829 |
[m4_define([AT_banner_ordinal], m4_incr(AT_banner_ordinal))dnl |
[m4_define([AT_banner_ordinal], m4_incr(AT_banner_ordinal)) |
830 |
m4_append([AT_groups_all], [ banner-]m4_defn([AT_banner_ordinal]))dnl |
m4_append([AT_groups_all], [ banner-]m4_defn([AT_banner_ordinal])) |
831 |
|
m4_divert_text([TESTS], |
832 |
case " $at_groups " in |
[ |
833 |
*" banner-AT_banner_ordinal "* ) |
banner-AT_banner_ordinal ) @%:@ Banner AT_banner_ordinal. AT_LINE |
|
@%:@ Banner AT_banner_ordinal. AT_LINE |
|
834 |
cat <<\_ATEOF |
cat <<\_ATEOF |
835 |
|
|
836 |
$1 |
$1 |
837 |
|
|
838 |
_ATEOF |
_ATEOF |
839 |
;; |
;; |
840 |
esac |
])dnl |
841 |
])# AT_BANNER |
])# AT_BANNER |
842 |
|
|
843 |
|
|