source: trunk/essentials/app-arch/cpio/tests/testsuite

Last change on this file was 3332, checked in by bird, 18 years ago

cpio 2.7

File size: 40.5 KB
Line 
1#! /bin/sh
2#
3# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
4# Foundation, Inc.
5# This test suite is free software; the Free Software Foundation gives
6# unlimited permission to copy, distribute and modify it.
7## --------------------- ##
8## M4sh Initialization. ##
9## --------------------- ##
10
11# Be Bourne compatible
12if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
13 emulate sh
14 NULLCMD=:
15 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
16 # is contrary to our usage. Disable this feature.
17 alias -g '${1+"$@"}'='"$@"'
18 setopt NO_GLOB_SUBST
19else
20 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
21fi
22BIN_SH=xpg4; export BIN_SH # for Tru64
23DUALCASE=1; export DUALCASE # for MKS sh
24
25
26# PATH needs CR
27# Avoid depending upon Character Ranges.
28as_cr_letters='abcdefghijklmnopqrstuvwxyz'
29as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
30as_cr_Letters=$as_cr_letters$as_cr_LETTERS
31as_cr_digits='0123456789'
32as_cr_alnum=$as_cr_Letters$as_cr_digits
33
34# The user is always right.
35if test "${PATH_SEPARATOR+set}" != set; then
36 echo "#! /bin/sh" >conf$$.sh
37 echo "exit 0" >>conf$$.sh
38 chmod +x conf$$.sh
39 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
40 PATH_SEPARATOR=';'
41 else
42 PATH_SEPARATOR=:
43 fi
44 rm -f conf$$.sh
45fi
46
47# Support unset when possible.
48if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
49 as_unset=unset
50else
51 as_unset=false
52fi
53
54
55# IFS
56# We need space, tab and new line, in precisely that order. Quoting is
57# there to prevent editors from complaining about space-tab.
58# (If _AS_PATH_WALK were called with IFS unset, it would disable word
59# splitting by setting IFS to empty value.)
60as_nl='
61'
62IFS=" "" $as_nl"
63
64# Find who we are. Look in the path if we contain no directory separator.
65case $0 in
66 *[\\/]* ) as_myself=$0 ;;
67 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
68for as_dir in $PATH
69do
70 IFS=$as_save_IFS
71 test -z "$as_dir" && as_dir=.
72 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
73done
74IFS=$as_save_IFS
75
76 ;;
77esac
78# We did not find ourselves, most probably we were run as `sh COMMAND'
79# in which case we are not to be found in the path.
80if test "x$as_myself" = x; then
81 as_myself=$0
82fi
83if test ! -f "$as_myself"; then
84 echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
85 { (exit 1); exit 1; }
86fi
87
88# Work around bugs in pre-3.0 UWIN ksh.
89for as_var in ENV MAIL MAILPATH
90do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
91done
92PS1='$ '
93PS2='> '
94PS4='+ '
95
96# NLS nuisances.
97for as_var in \
98 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
99 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
100 LC_TELEPHONE LC_TIME
101do
102 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
103 eval $as_var=C; export $as_var
104 else
105 ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
106 fi
107done
108
109# Required to use basename.
110if expr a : '\(a\)' >/dev/null 2>&1 &&
111 test "X`expr 00001 : '.*\(...\)'`" = X001; then
112 as_expr=expr
113else
114 as_expr=false
115fi
116
117if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
118 as_basename=basename
119else
120 as_basename=false
121fi
122
123
124# Name of the executable.
125as_me=`$as_basename -- "$0" ||
126$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
127 X"$0" : 'X\(//\)$' \| \
128 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
129echo X/"$0" |
130 sed '/^.*\/\([^/][^/]*\)\/*$/{
131 s//\1/
132 q
133 }
134 /^X\/\(\/\/\)$/{
135 s//\1/
136 q
137 }
138 /^X\/\(\/\).*/{
139 s//\1/
140 q
141 }
142 s/.*/./; q'`
143
144# CDPATH.
145$as_unset CDPATH
146
147
148if test "x$CONFIG_SHELL" = x; then
149 if (eval ":") 2>/dev/null; then
150 as_have_required=yes
151else
152 as_have_required=no
153fi
154
155 if test $as_have_required = yes && (eval ":
156(as_func_return () {
157 (exit \$1)
158}
159as_func_success () {
160 as_func_return 0
161}
162as_func_failure () {
163 as_func_return 1
164}
165as_func_ret_success () {
166 return 0
167}
168as_func_ret_failure () {
169 return 1
170}
171
172exitcode=0
173if as_func_success; then
174 :
175else
176 exitcode=1
177 echo as_func_success failed.
178fi
179
180if as_func_failure; then
181 exitcode=1
182 echo as_func_failure succeeded.
183fi
184
185if as_func_ret_success; then
186 :
187else
188 exitcode=1
189 echo as_func_ret_success failed.
190fi
191
192if as_func_ret_failure; then
193 exitcode=1
194 echo as_func_ret_failure succeeded.
195fi
196
197if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
198 :
199else
200 exitcode=1
201 echo positional parameters were not saved.
202fi
203
204test \$exitcode = 0) || { (exit 1); exit 1; }
205
206(
207 as_lineno_1=\$LINENO
208 as_lineno_2=\$LINENO
209 test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
210 test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
211") 2> /dev/null; then
212 :
213else
214 as_candidate_shells=
215 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
216for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
217do
218 IFS=$as_save_IFS
219 test -z "$as_dir" && as_dir=.
220 case $as_dir in
221 /*)
222 for as_base in sh bash ksh sh5; do
223 as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
224 done;;
225 esac
226done
227IFS=$as_save_IFS
228
229
230 for as_shell in $as_candidate_shells $SHELL; do
231 # Try only shells that exist, to save several forks.
232 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
233 { ("$as_shell") 2> /dev/null <<\_ASEOF
234# Be Bourne compatible
235if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
236 emulate sh
237 NULLCMD=:
238 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
239 # is contrary to our usage. Disable this feature.
240 alias -g '${1+"$@"}'='"$@"'
241 setopt NO_GLOB_SUBST
242else
243 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
244fi
245BIN_SH=xpg4; export BIN_SH # for Tru64
246DUALCASE=1; export DUALCASE # for MKS sh
247
248:
249_ASEOF
250}; then
251 CONFIG_SHELL=$as_shell
252 as_have_required=yes
253 if { "$as_shell" 2> /dev/null <<\_ASEOF
254# Be Bourne compatible
255if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
256 emulate sh
257 NULLCMD=:
258 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
259 # is contrary to our usage. Disable this feature.
260 alias -g '${1+"$@"}'='"$@"'
261 setopt NO_GLOB_SUBST
262else
263 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
264fi
265BIN_SH=xpg4; export BIN_SH # for Tru64
266DUALCASE=1; export DUALCASE # for MKS sh
267
268:
269(as_func_return () {
270 (exit $1)
271}
272as_func_success () {
273 as_func_return 0
274}
275as_func_failure () {
276 as_func_return 1
277}
278as_func_ret_success () {
279 return 0
280}
281as_func_ret_failure () {
282 return 1
283}
284
285exitcode=0
286if as_func_success; then
287 :
288else
289 exitcode=1
290 echo as_func_success failed.
291fi
292
293if as_func_failure; then
294 exitcode=1
295 echo as_func_failure succeeded.
296fi
297
298if as_func_ret_success; then
299 :
300else
301 exitcode=1
302 echo as_func_ret_success failed.
303fi
304
305if as_func_ret_failure; then
306 exitcode=1
307 echo as_func_ret_failure succeeded.
308fi
309
310if ( set x; as_func_ret_success y && test x = "$1" ); then
311 :
312else
313 exitcode=1
314 echo positional parameters were not saved.
315fi
316
317test $exitcode = 0) || { (exit 1); exit 1; }
318
319(
320 as_lineno_1=$LINENO
321 as_lineno_2=$LINENO
322 test "x$as_lineno_1" != "x$as_lineno_2" &&
323 test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
324
325_ASEOF
326}; then
327 break
328fi
329
330fi
331
332 done
333
334 if test "x$CONFIG_SHELL" != x; then
335 for as_var in BASH_ENV ENV
336 do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
337 done
338 export CONFIG_SHELL
339 exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
340fi
341
342
343 if test $as_have_required = no; then
344 echo This script requires a shell more modern than all the
345 echo shells that I found on your system. Please install a
346 echo modern shell, or manually run the script under such a
347 echo shell if you do have one.
348 { (exit 1); exit 1; }
349fi
350
351
352fi
353
354fi
355
356
357
358(eval "as_func_return () {
359 (exit \$1)
360}
361as_func_success () {
362 as_func_return 0
363}
364as_func_failure () {
365 as_func_return 1
366}
367as_func_ret_success () {
368 return 0
369}
370as_func_ret_failure () {
371 return 1
372}
373
374exitcode=0
375if as_func_success; then
376 :
377else
378 exitcode=1
379 echo as_func_success failed.
380fi
381
382if as_func_failure; then
383 exitcode=1
384 echo as_func_failure succeeded.
385fi
386
387if as_func_ret_success; then
388 :
389else
390 exitcode=1
391 echo as_func_ret_success failed.
392fi
393
394if as_func_ret_failure; then
395 exitcode=1
396 echo as_func_ret_failure succeeded.
397fi
398
399if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
400 :
401else
402 exitcode=1
403 echo positional parameters were not saved.
404fi
405
406test \$exitcode = 0") || {
407 echo No shell found that supports shell functions.
408 echo Please tell autoconf@gnu.org about your system,
409 echo including any error possibly output before this
410 echo message
411}
412
413
414
415 as_lineno_1=$LINENO
416 as_lineno_2=$LINENO
417 test "x$as_lineno_1" != "x$as_lineno_2" &&
418 test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
419
420 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
421 # uniformly replaced by the line number. The first 'sed' inserts a
422 # line-number line after each line using $LINENO; the second 'sed'
423 # does the real work. The second script uses 'N' to pair each
424 # line-number line with the line containing $LINENO, and appends
425 # trailing '-' during substitution so that $LINENO is not a special
426 # case at line end.
427 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
428 # scripts with optimization help from Paolo Bonzini. Blame Lee
429 # E. McMahon (1931-1989) for sed's syntax. :-)
430 sed -n '
431 p
432 /[$]LINENO/=
433 ' <$as_myself |
434 sed '
435 s/[$]LINENO.*/&-/
436 t lineno
437 b
438 :lineno
439 N
440 :loop
441 s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
442 t loop
443 s/-\n.*//
444 ' >$as_me.lineno &&
445 chmod +x "$as_me.lineno" ||
446 { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
447 { (exit 1); exit 1; }; }
448
449 # Don't try to exec as it changes $[0], causing all sort of problems
450 # (the dirname of $[0] is not the place where we might find the
451 # original and so on. Autoconf is especially sensitive to this).
452 . "./$as_me.lineno"
453 # Exit status is that of the last command.
454 exit
455}
456
457
458if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
459 as_dirname=dirname
460else
461 as_dirname=false
462fi
463
464ECHO_C= ECHO_N= ECHO_T=
465case `echo -n x` in
466-n*)
467 case `echo 'x\c'` in
468 *c*) ECHO_T=' ';; # ECHO_T is single tab character.
469 *) ECHO_C='\c';;
470 esac;;
471*)
472 ECHO_N='-n';;
473esac
474
475if expr a : '\(a\)' >/dev/null 2>&1 &&
476 test "X`expr 00001 : '.*\(...\)'`" = X001; then
477 as_expr=expr
478else
479 as_expr=false
480fi
481
482rm -f conf$$ conf$$.exe conf$$.file
483if test -d conf$$.dir; then
484 rm -f conf$$.dir/conf$$.file
485else
486 rm -f conf$$.dir
487 mkdir conf$$.dir
488fi
489echo >conf$$.file
490if ln -s conf$$.file conf$$ 2>/dev/null; then
491 as_ln_s='ln -s'
492 # ... but there are two gotchas:
493 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
494 # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
495 # In both cases, we have to default to `cp -p'.
496 ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
497 as_ln_s='cp -p'
498elif ln conf$$.file conf$$ 2>/dev/null; then
499 as_ln_s=ln
500else
501 as_ln_s='cp -p'
502fi
503rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
504rmdir conf$$.dir 2>/dev/null
505
506if mkdir -p . 2>/dev/null; then
507 as_mkdir_p=:
508else
509 test -d ./-p && rmdir ./-p
510 as_mkdir_p=false
511fi
512
513# Find out whether ``test -x'' works. Don't use a zero-byte file, as
514# systems may use methods other than mode bits to determine executability.
515cat >conf$$.file <<_ASEOF
516#! /bin/sh
517exit 0
518_ASEOF
519chmod +x conf$$.file
520if test -x conf$$.file >/dev/null 2>&1; then
521 as_executable_p="test -x"
522else
523 as_executable_p=:
524fi
525rm -f conf$$.file
526
527# Sed expression to map a string onto a valid CPP name.
528as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
529
530# Sed expression to map a string onto a valid variable name.
531as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
532
533
534
535SHELL=${CONFIG_SHELL-/bin/sh}
536
537# How were we run?
538at_cli_args="$@"
539
540# Load the config file.
541for at_file in atconfig atlocal
542do
543 test -r $at_file || continue
544 . ./$at_file || { echo "$as_me: error: invalid content: $at_file" >&2
545 { (exit 1); exit 1; }; }
546done
547
548# Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix:
549: ${at_top_build_prefix=$at_top_builddir}
550
551# atconfig delivers names relative to the directory the test suite is
552# in, but the groups themselves are run in testsuite-dir/group-dir.
553if test -n "$at_top_srcdir"; then
554 builddir=../..
555 for at_dir in srcdir top_srcdir top_build_prefix
556 do
557 at_val=`eval echo '${'at_$at_dir'}'`
558 eval "$at_dir=\$at_val/../.."
559 done
560fi
561
562# Not all shells have the 'times' builtin; the subshell is needed to make
563# sure we discard the 'times: not found' message from the shell.
564at_times_p=false
565(times) >/dev/null 2>&1 && at_times_p=:
566
567# CLI Arguments to pass to the debugging scripts.
568at_debug_args=
569# -e sets to true
570at_errexit_p=false
571# Shall we be verbose?
572at_verbose=:
573at_quiet=echo
574
575# Shall we keep the debug scripts? Must be `:' when the suite is
576# run by a debug script, so that the script doesn't remove itself.
577at_debug_p=false
578# Display help message?
579at_help_p=false
580# Display the version message?
581at_version_p=false
582# List test groups?
583at_list_p=false
584# Test groups to run
585at_groups=
586
587# The directory we are in.
588at_dir=`pwd`
589# The directory the whole suite works in.
590# Should be absolutely to let the user `cd' at will.
591at_suite_dir=$at_dir/$as_me.dir
592# The file containing the suite.
593at_suite_log=$at_dir/$as_me.log
594# The file containing the location of the last AT_CHECK.
595at_check_line_file=$at_suite_dir/at-check-line
596# The file containing the exit status of the last command.
597at_status_file=$at_suite_dir/at-status
598# The files containing the output of the tested commands.
599at_stdout=$at_suite_dir/at-stdout
600at_stder1=$at_suite_dir/at-stder1
601at_stderr=$at_suite_dir/at-stderr
602# The file containing dates.
603at_times_file=$at_suite_dir/at-times
604
605# List of the tested programs.
606at_tested='cpio'
607# List of the all the test groups.
608at_groups_all=' 1 2'
609# As many question marks as there are digits in the last test group number.
610# Used to normalize the test group numbers so that `ls' lists them in
611# numerical order.
612at_format='?'
613# Description of all the test groups.
614at_help_all='1;version.at:19;cpio version;;
6152;inout.at:19;basic functionality: copyin/copyout;;
616'
617
618at_prev=
619for at_option
620do
621 # If the previous option needs an argument, assign it.
622 if test -n "$at_prev"; then
623 at_option=$at_prev=$at_option
624 at_prev=
625 fi
626
627 case $at_option in
628 *=*) at_optarg=`expr "x$at_option" : 'x[^=]*=\(.*\)'` ;;
629 *) at_optarg= ;;
630 esac
631
632 # Accept the important Cygnus configure options, so we can diagnose typos.
633
634 case $at_option in
635 --help | -h )
636 at_help_p=:
637 ;;
638
639 --list | -l )
640 at_list_p=:
641 ;;
642
643 --version | -V )
644 at_version_p=:
645 ;;
646
647 --clean | -c )
648 test -d "$at_suite_dir" &&
649 find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
650 rm -f -r "$at_suite_dir" "$at_suite_log"
651 exit 0
652 ;;
653
654 --debug | -d )
655 at_debug_p=:
656 ;;
657
658 --errexit | -e )
659 at_debug_p=:
660 at_errexit_p=:
661 ;;
662
663 --verbose | -v )
664 at_verbose=echo; at_quiet=:
665 ;;
666
667 --trace | -x )
668 at_traceon='set -x'; at_traceoff='set +x'
669 ;;
670
671 [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9])
672 at_groups="$at_groups$at_option "
673 ;;
674
675 # Ranges
676 [0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-)
677 at_range_start=`echo $at_option |tr -d X-`
678 at_range=`echo " $at_groups_all " | \
679 sed -e 's/^.* \('$at_range_start' \)/\1/'`
680 at_groups="$at_groups$at_range "
681 ;;
682
683 -[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9])
684 at_range_end=`echo $at_option |tr -d X-`
685 at_range=`echo " $at_groups_all " | \
686 sed -e 's/\( '$at_range_end'\) .*$/\1/'`
687 at_groups="$at_groups$at_range "
688 ;;
689
690 [0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \
691 [0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \
692 [0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \
693 [0-9][0-9][0-9]-[0-9][0-9][0-9] | \
694 [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \
695 [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] )
696 at_range_start=`expr $at_option : '\(.*\)-'`
697 at_range_end=`expr $at_option : '.*-\(.*\)'`
698 if test $at_range_start -gt $at_range_end; then
699 at_tmp=$at_range_end
700 at_range_end=$at_range_start
701 at_range_start=$at_tmp
702 fi
703 at_range=`echo " $at_groups_all " | \
704 sed -e 's/^.*\( '$at_range_start' \)/\1/' \
705 -e 's/\( '$at_range_end'\) .*$/\1/'`
706 at_groups="$at_groups$at_range "
707 ;;
708
709 # Keywords.
710 --keywords | -k )
711 at_prev=--keywords
712 ;;
713 --keywords=* )
714 at_groups_selected=$at_help_all
715 at_save_IFS=$IFS
716 IFS=,
717 set X $at_optarg
718 shift
719 IFS=$at_save_IFS
720 for at_keyword
721 do
722 at_invert=
723 case $at_keyword in
724 '!'*)
725 at_invert="-v"
726 at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'`
727 ;;
728 esac
729 # It is on purpose that we match the test group titles too.
730 at_groups_selected=`echo "$at_groups_selected" |
731 grep -i $at_invert "^[1-9][^;]*;.*[; ]$at_keyword[ ;]"`
732 done
733 at_groups_selected=`echo "$at_groups_selected" | sed 's/;.*//'`
734 # Smash the newlines.
735 at_groups="$at_groups`echo $at_groups_selected` "
736 ;;
737
738 *=*)
739 at_envvar=`expr "x$at_option" : 'x\([^=]*\)='`
740 # Reject names that are not valid shell variable names.
741 expr "x$at_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
742 { echo "$as_me: error: invalid variable name: $at_envvar" >&2
743 { (exit 1); exit 1; }; }
744 at_value=`echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"`
745 eval "$at_envvar='$at_value'"
746 export $at_envvar
747 # Propagate to debug scripts.
748 at_debug_args="$at_debug_args $at_envvar='$at_value'"
749 ;;
750
751 *) echo "$as_me: invalid option: $at_option" >&2
752 echo "Try \`$0 --help' for more information." >&2
753 exit 1
754 ;;
755 esac
756done
757
758# Selected test groups.
759if test -z "$at_groups"; then
760 at_groups=$at_groups_all
761else
762 # Sort the tests, removing duplicates:
763 at_groups=`echo $at_groups | tr ' ' "$as_nl" | sort -nu`
764 # and add banners. (Passing at_groups_all is tricky--see the comment
765 # starting with "Passing at_groups is tricky.")
766 at_groups=`echo "$at_groups$as_nl $at_groups_all" |
767 awk 'BEGIN { FS = "@" } # Effectively switch off field splitting.
768 /^$/ { next } # Ignore the empty line.
769 !/ / { groups++; selected[$ 0] = 1; next }
770 # The last line, containing at_groups_all.
771 {
772 n = split($ 0, a, " ")
773 # If there are several tests, select their banners:
774 if (groups > 1) {
775 for (i = 1; i <= n; i++) {
776 if (a[i] ~ /^banner-/)
777 banner = a[i]
778 else if (banner != "" && selected[a[i]] == 1)
779 selected[banner] = 1
780 }
781 }
782 for (i = 1; i <= n; i++)
783 if (selected[a[i]] == 1)
784 list = list " " a[i]
785 print list
786 }'`
787fi
788
789# Help message.
790if $at_help_p; then
791 cat <<_ATEOF
792Usage: $0 [OPTION]... [VARIABLE=VALUE]... [TESTS]
793
794Run all the tests, or the selected TESTS, given by numeric ranges, and
795save a detailed log file. Upon failure, create debugging scripts.
796
797You should not change environment variables unless explicitly passed
798as command line arguments. Set \`AUTOTEST_PATH' to select the executables
799to exercise. Each relative directory is expanded as build and source
800directories relatively to the top level of this distribution. E.g.,
801
802 $ $0 AUTOTEST_PATH=bin
803
804possibly amounts into
805
806 PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH
807_ATEOF
808cat <<_ATEOF
809
810Operation modes:
811 -h, --help print the help message, then exit
812 -V, --version print version number, then exit
813 -c, --clean remove all the files this test suite might create and exit
814 -l, --list describes all the tests, or the selected TESTS
815_ATEOF
816cat <<_ATEOF
817
818Execution tuning:
819 -k, --keywords=KEYWORDS
820 select the tests matching all the comma-separated KEYWORDS
821 multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD
822 -e, --errexit abort as soon as a test fails; implies --debug
823 -v, --verbose force more detailed output
824 default for debugging scripts
825 -d, --debug inhibit clean up and top-level logging
826 default for debugging scripts
827 -x, --trace enable tests shell tracing
828_ATEOF
829cat <<_ATEOF
830
831Report bugs to <bug-cpio@gnu.org>.
832_ATEOF
833 exit 0
834fi
835
836# List of tests.
837if $at_list_p; then
838 cat <<_ATEOF
839GNU cpio 2.7 test suite test groups:
840
841 NUM: FILE-NAME:LINE TEST-GROUP-NAME
842 KEYWORDS
843
844_ATEOF
845 # Passing at_groups is tricky. We cannot use it to form a literal string
846 # or regexp because of the limitation of AIX awk. And Solaris' awk
847 # doesn't grok more than 99 fields in a record, so we have to use `split'.
848 echo "$at_groups$as_nl$at_help_all" |
849 awk 'BEGIN { FS = ";" }
850 NR == 1 {
851 for (n = split($ 0, a, " "); n; n--) selected[a[n]] = 1
852 next
853 }
854 {
855 if (selected[$ 1]) {
856 printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3
857 if ($ 4) printf " %s\n", $ 4
858 }
859 }'
860 exit 0
861fi
862if $at_version_p; then
863 echo "$as_me (GNU cpio 2.7)"
864 cat <<\_ACEOF
865
866Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
867Foundation, Inc.
868This test suite is free software; the Free Software Foundation gives
869unlimited permission to copy, distribute and modify it.
870_ACEOF
871 exit 0
872fi
873
874# Don't take risks: use only absolute directories in PATH.
875#
876# For stand-alone test suites, AUTOTEST_PATH is relative to `.'.
877#
878# For embedded test suites, AUTOTEST_PATH is relative to the top level
879# of the package. Then expand it into build/src parts, since users
880# may create executables in both places.
881AUTOTEST_PATH=`echo $AUTOTEST_PATH | sed "s&:&$PATH_SEPARATOR&g"`
882at_path=
883as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
884for as_dir in $AUTOTEST_PATH $PATH
885do
886 IFS=$as_save_IFS
887 test -z "$as_dir" && as_dir=.
888 test -n "$at_path" && at_path=$at_path$PATH_SEPARATOR
889case $as_dir in
890 [\\/]* | ?:[\\/]* )
891 at_path=$at_path$as_dir
892 ;;
893 * )
894 if test -z "$at_top_build_prefix"; then
895 # Stand-alone test suite.
896 at_path=$at_path$as_dir
897 else
898 # Embedded test suite.
899 at_path=$at_path$at_top_build_prefix$as_dir$PATH_SEPARATOR
900 at_path=$at_path$at_top_srcdir/$as_dir
901 fi
902 ;;
903esac
904done
905IFS=$as_save_IFS
906
907
908# Now build and simplify PATH.
909#
910# There might be directories that don't exist, but don't redirect
911# builtins' (eg., cd) stderr directly: Ultrix's sh hates that.
912PATH=
913as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
914for as_dir in $at_path
915do
916 IFS=$as_save_IFS
917 test -z "$as_dir" && as_dir=.
918 as_dir=`(cd "$as_dir" && pwd) 2>/dev/null`
919test -d "$as_dir" || continue
920case $PATH in
921 $as_dir | \
922 $as_dir$PATH_SEPARATOR* | \
923 *$PATH_SEPARATOR$as_dir | \
924 *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR* ) ;;
925
926 '') PATH=$as_dir ;;
927 *) PATH=$PATH$PATH_SEPARATOR$as_dir ;;
928esac
929done
930IFS=$as_save_IFS
931
932export PATH
933
934# Setting up the FDs.
935# 5 is the log file. Not to be overwritten if `-d'.
936
937if $at_debug_p; then
938 at_suite_log=/dev/null
939else
940 : >"$at_suite_log"
941fi
942exec 5>>"$at_suite_log"
943
944# Banners and logs.
945cat <<\_ASBOX
946## ------------------------ ##
947## GNU cpio 2.7 test suite. ##
948## ------------------------ ##
949_ASBOX
950{
951 cat <<\_ASBOX
952## ------------------------ ##
953## GNU cpio 2.7 test suite. ##
954## ------------------------ ##
955_ASBOX
956 echo
957
958 echo "$as_me: command line was:"
959 echo " $ $0 $at_cli_args"
960 echo
961
962 # Try to find a few ChangeLogs in case it might help determining the
963 # exact version. Use the relative dir: if the top dir is a symlink,
964 # find will not follow it (and options to follow the links are not
965 # portable), which would result in no output here.
966 if test -n "$at_top_srcdir"; then
967 cat <<\_ASBOX
968## ----------- ##
969## ChangeLogs. ##
970## ----------- ##
971_ASBOX
972 echo
973 for at_file in `find "$at_top_srcdir" -name ChangeLog -print`
974 do
975 echo "$as_me: $at_file:"
976 sed 's/^/| /;10q' $at_file
977 echo
978 done
979
980 {
981cat <<_ASUNAME
982## --------- ##
983## Platform. ##
984## --------- ##
985
986hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
987uname -m = `(uname -m) 2>/dev/null || echo unknown`
988uname -r = `(uname -r) 2>/dev/null || echo unknown`
989uname -s = `(uname -s) 2>/dev/null || echo unknown`
990uname -v = `(uname -v) 2>/dev/null || echo unknown`
991
992/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
993/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
994
995/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
996/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
997/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
998/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
999/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
1000/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
1001/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
1002
1003_ASUNAME
1004
1005as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1006for as_dir in $PATH
1007do
1008 IFS=$as_save_IFS
1009 test -z "$as_dir" && as_dir=.
1010 echo "PATH: $as_dir"
1011done
1012IFS=$as_save_IFS
1013
1014}
1015 echo
1016 fi
1017
1018 # Contents of the config files.
1019 for at_file in atconfig atlocal
1020 do
1021 test -r $at_file || continue
1022 echo "$as_me: $at_file:"
1023 sed 's/^/| /' $at_file
1024 echo
1025 done
1026
1027 cat <<\_ASBOX
1028## ---------------- ##
1029## Tested programs. ##
1030## ---------------- ##
1031_ASBOX
1032 echo
1033} >&5
1034
1035# Report what programs are being tested.
1036for at_program in : $at_tested
1037do
1038 test "$at_program" = : && continue
1039 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1040for as_dir in $PATH
1041do
1042 IFS=$as_save_IFS
1043 test -z "$as_dir" && as_dir=.
1044 test -f "$as_dir/$at_program" && break
1045done
1046IFS=$as_save_IFS
1047
1048 if test -f "$as_dir/$at_program"; then
1049 {
1050 echo "$at_srcdir/testsuite.at:24: $as_dir/$at_program --version"
1051 "$as_dir/$at_program" --version
1052 echo
1053 } >&5 2>&1
1054 else
1055 { { echo "$as_me:$LINENO: error: cannot find $at_program" >&5
1056echo "$as_me: error: cannot find $at_program" >&2;}
1057 { (exit 1); exit 1; }; }
1058 fi
1059done
1060
1061{
1062 cat <<\_ASBOX
1063## ------------------ ##
1064## Running the tests. ##
1065## ------------------ ##
1066_ASBOX
1067} >&5
1068
1069at_start_date=`date`
1070at_start_time=`date +%s 2>/dev/null`
1071echo "$as_me: starting at: $at_start_date" >&5
1072at_xpass_list=
1073at_xfail_list=
1074at_pass_list=
1075at_fail_list=
1076at_skip_list=
1077at_group_count=0
1078
1079# Create the master directory if it doesn't already exist.
1080test -d "$at_suite_dir" ||
1081 mkdir "$at_suite_dir" ||
1082 { { echo "$as_me:$LINENO: error: cannot create '$at_suite_dir'" >&5
1083echo "$as_me: error: cannot create '$at_suite_dir'" >&2;}
1084 { (exit 1); exit 1; }; }
1085
1086# Can we diff with `/dev/null'? DU 5.0 refuses.
1087if diff /dev/null /dev/null >/dev/null 2>&1; then
1088 at_devnull=/dev/null
1089else
1090 at_devnull=$at_suite_dir/devnull
1091 >"$at_devnull"
1092fi
1093
1094# Use `diff -u' when possible.
1095if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff"
1096then
1097 at_diff='diff -u'
1098else
1099 at_diff=diff
1100fi
1101
1102
1103for at_group in $at_groups
1104do
1105 # Be sure to come back to the top test directory.
1106 cd "$at_suite_dir"
1107
1108 case $at_group in
1109 banner-*)
1110 at_group_log=$at_suite_log
1111 ;;
1112
1113 *)
1114 at_group_normalized=$at_group
1115
1116 while :; do
1117 case $at_group_normalized in #(
1118 $at_format*) break;;
1119 esac
1120 at_group_normalized=0$at_group_normalized
1121 done
1122
1123
1124 # Create a fresh directory for the next test group, and enter.
1125 at_group_dir=$at_suite_dir/$at_group_normalized
1126 at_group_log=$at_group_dir/$as_me.log
1127 if test -d "$at_group_dir"; then
1128 find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
1129 rm -fr "$at_group_dir"
1130 fi
1131 # Be tolerant if the above `rm' was not able to remove the directory.
1132 { as_dir=$at_group_dir
1133 case $as_dir in #(
1134 -*) as_dir=./$as_dir;;
1135 esac
1136 test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
1137 as_dirs=
1138 while :; do
1139 case $as_dir in #(
1140 *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
1141 *) as_qdir=$as_dir;;
1142 esac
1143 as_dirs="'$as_qdir' $as_dirs"
1144 as_dir=`$as_dirname -- "$as_dir" ||
1145$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
1146 X"$as_dir" : 'X\(//\)[^/]' \| \
1147 X"$as_dir" : 'X\(//\)$' \| \
1148 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
1149echo X"$as_dir" |
1150 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
1151 s//\1/
1152 q
1153 }
1154 /^X\(\/\/\)[^/].*/{
1155 s//\1/
1156 q
1157 }
1158 /^X\(\/\/\)$/{
1159 s//\1/
1160 q
1161 }
1162 /^X\(\/\).*/{
1163 s//\1/
1164 q
1165 }
1166 s/.*/./; q'`
1167 test -d "$as_dir" && break
1168 done
1169 test -z "$as_dirs" || eval "mkdir $as_dirs"
1170 } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
1171echo "$as_me: error: cannot create directory $as_dir" >&2;}
1172 { (exit 1); exit 1; }; }; }
1173 cd $at_group_dir
1174 ;;
1175 esac
1176
1177 echo 0 > "$at_status_file"
1178
1179 # Clearly separate the test groups when verbose.
1180 test $at_group_count != 0 && $at_verbose
1181
1182 # In verbose mode, append to the log file *and* show on
1183 # the standard output; in quiet mode only write to the log
1184 if test $at_verbose = echo; then
1185 at_tee_pipe='tee -a "$at_group_log"'
1186 else
1187 at_tee_pipe='cat >> "$at_group_log"'
1188 fi
1189
1190 case $at_group in
1191 1 ) # 1. version.at:19: cpio version
1192 at_setup_line='version.at:19'
1193 at_desc='cpio version'
1194 $at_quiet $ECHO_N " 1: cpio version $ECHO_C"
1195 at_xfail=no
1196 echo "# -*- compilation -*-" >> "$at_group_log"
1197 (
1198 echo "1. version.at:19: testing ..."
1199 $at_traceon
1200
1201
1202$at_traceoff
1203echo "$at_srcdir/version.at:31: cpio --version"
1204echo version.at:31 >"$at_check_line_file"
1205
1206at_trace_this=
1207if test -n "$at_traceon"; then
1208 at_trace_this=yes
1209fi
1210
1211if test -n "$at_trace_this"; then
1212 ( $at_traceon; cpio --version ) >"$at_stdout" 2>"$at_stder1"
1213 at_status=$?
1214 grep '^ *+' "$at_stder1" >&2
1215 grep -v '^ *+' "$at_stder1" >"$at_stderr"
1216else
1217 ( :; cpio --version ) >"$at_stdout" 2>"$at_stderr"
1218 at_status=$?
1219fi
1220
1221at_failed=false
1222$at_diff "$at_devnull" "$at_stderr" || at_failed=:
1223echo >>"$at_stdout"; echo "cpio (GNU cpio) 2.7
1224" | $at_diff - "$at_stdout" || at_failed=:
1225case $at_status in
1226 77) echo 77 > "$at_status_file"; exit 77;;
1227 0) ;;
1228 *) echo "$at_srcdir/version.at:31: exit code was $at_status, expected 0"
1229 at_failed=:;;
1230esac
1231if $at_failed; then
1232
1233
1234 echo 1 > "$at_status_file"
1235 exit 1
1236else
1237
1238echo '=============================================================='
1239echo 'WARNING: Not using the proper version, *all* checks dubious...'
1240echo '=============================================================='
1241
1242fi
1243
1244$at_traceon
1245
1246
1247 $at_traceoff
1248 $at_times_p && times >"$at_times_file"
1249 ) 5>&1 2>&1 | eval $at_tee_pipe
1250 at_status=`cat "$at_status_file"`
1251 ;;
1252
1253 2 ) # 2. inout.at:19: basic functionality: copyin/copyout
1254 at_setup_line='inout.at:19'
1255 at_desc='basic functionality: copyin/copyout'
1256 $at_quiet $ECHO_N " 2: basic functionality: copyin/copyout $ECHO_C"
1257 at_xfail=no
1258 echo "# -*- compilation -*-" >> "$at_group_log"
1259 (
1260 echo "2. inout.at:19: testing ..."
1261 $at_traceon
1262
1263
1264cat >filelist <<'_ATEOF'
1265a 18
1266b 1024
1267c 356
1268d 20000
1269e 3
1270f 0
1271g 10658
1272h 45
1273_ATEOF
1274
1275
1276$at_traceoff
1277echo "$at_srcdir/inout.at:37:
1278while read NAME LENGTH
1279do
1280 genfile --length \$LENGTH > \$NAME
1281 echo \$NAME
1282done < filelist |
1283 cpio --quiet -o > archive"
1284echo inout.at:37 >"$at_check_line_file"
1285
1286at_trace_this=
1287if test -n "$at_traceon"; then
1288 echo 'Not enabling shell tracing (command contains an embedded newline)'
1289fi
1290
1291if test -n "$at_trace_this"; then
1292 ( $at_traceon;
1293while read NAME LENGTH
1294do
1295 genfile --length $LENGTH > $NAME
1296 echo $NAME
1297done < filelist |
1298 cpio --quiet -o > archive ) >"$at_stdout" 2>"$at_stder1"
1299 at_status=$?
1300 grep '^ *+' "$at_stder1" >&2
1301 grep -v '^ *+' "$at_stder1" >"$at_stderr"
1302else
1303 ( :;
1304while read NAME LENGTH
1305do
1306 genfile --length $LENGTH > $NAME
1307 echo $NAME
1308done < filelist |
1309 cpio --quiet -o > archive ) >"$at_stdout" 2>"$at_stderr"
1310 at_status=$?
1311fi
1312
1313at_failed=false
1314$at_diff "$at_devnull" "$at_stderr" || at_failed=:
1315$at_diff "$at_devnull" "$at_stdout" || at_failed=:
1316case $at_status in
1317 77) echo 77 > "$at_status_file"; exit 77;;
1318 0) ;;
1319 *) echo "$at_srcdir/inout.at:37: exit code was $at_status, expected 0"
1320 at_failed=:;;
1321esac
1322if $at_failed; then
1323
1324
1325 echo 1 > "$at_status_file"
1326 exit 1
1327fi
1328
1329$at_traceon
1330
1331
1332 $at_traceoff
1333 $at_times_p && times >"$at_times_file"
1334 ) 5>&1 2>&1 | eval $at_tee_pipe
1335 at_status=`cat "$at_status_file"`
1336 ;;
1337
1338
1339 * )
1340 echo "$as_me: no such test group: $at_group" >&2
1341 continue
1342 ;;
1343 esac
1344
1345 # Be sure to come back to the suite directory, in particular
1346 # since below we might `rm' the group directory we are in currently.
1347 cd "$at_suite_dir"
1348
1349 case $at_group in
1350 banner-*) ;;
1351 *)
1352 if test ! -f "$at_check_line_file"; then
1353 sed "s/^ */$as_me: warning: /" <<_ATEOF
1354 A failure happened in a test group before any test could be
1355 run. This means that test suite is improperly designed. Please
1356 report this failure to <bug-cpio@gnu.org>.
1357_ATEOF
1358 echo "$at_setup_line" >"$at_check_line_file"
1359 fi
1360 at_group_count=`expr 1 + $at_group_count`
1361 $at_verbose $ECHO_N "$at_group. $at_setup_line: $ECHO_C"
1362 echo $ECHO_N "$at_group. $at_setup_line: $ECHO_C" >> "$at_group_log"
1363 case $at_xfail:$at_status in
1364 yes:0)
1365 at_msg="UNEXPECTED PASS"
1366 at_xpass_list="$at_xpass_list $at_group"
1367 at_errexit=$at_errexit_p
1368 ;;
1369 no:0)
1370 at_msg="ok"
1371 at_pass_list="$at_pass_list $at_group"
1372 at_errexit=false
1373 ;;
1374 *:77)
1375 at_msg='skipped ('`cat "$at_check_line_file"`')'
1376 at_skip_list="$at_skip_list $at_group"
1377 at_errexit=false
1378 ;;
1379 yes:*)
1380 at_msg='expected failure ('`cat "$at_check_line_file"`')'
1381 at_xfail_list="$at_xfail_list $at_group"
1382 at_errexit=false
1383 ;;
1384 no:*)
1385 at_msg='FAILED ('`cat "$at_check_line_file"`')'
1386 at_fail_list="$at_fail_list $at_group"
1387 at_errexit=$at_errexit_p
1388 ;;
1389 esac
1390 # Make sure there is a separator even with long titles.
1391 echo " $at_msg"
1392 at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg"
1393 case $at_status in
1394 0|77)
1395 # $at_times_file is only available if the group succeeded.
1396 # We're not including the group log, so the success message
1397 # is written in the global log separately. But we also
1398 # write to the group log in case they're using -d.
1399 if test -f "$at_times_file"; then
1400 at_log_msg="$at_log_msg ("`sed 1d "$at_times_file"`')'
1401 rm -f "$at_times_file"
1402 fi
1403 echo "$at_log_msg" >> "$at_group_log"
1404 echo "$at_log_msg" >&5
1405
1406 # Cleanup the group directory, unless the user wants the files.
1407 if $at_debug_p ; then
1408 {
1409 echo "#! /bin/sh"
1410 echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$@"}'\''='\''"$@"'\'''
1411 echo "cd '$at_dir'"
1412 echo 'exec ${CONFIG_SHELL-'"$SHELL"'}' "$0" \
1413 '-v -d' "$at_debug_args" "$at_group" '${1+"$@"}'
1414 echo 'exit 1'
1415 } >$at_group_dir/run
1416 chmod +x $at_group_dir/run
1417
1418 elif test -d "$at_group_dir"; then
1419 find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
1420 rm -fr "$at_group_dir"
1421 fi
1422 ;;
1423 *)
1424 # Upon failure, include the log into the testsuite's global
1425 # log. The failure message is written in the group log. It
1426 # is later included in the global log.
1427 echo "$at_log_msg" >> "$at_group_log"
1428
1429 # Upon failure, keep the group directory for autopsy, and
1430 # create the debugging script.
1431 {
1432 echo "#! /bin/sh"
1433 echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$@"}'\''='\''"$@"'\'''
1434 echo "cd '$at_dir'"
1435 echo 'exec ${CONFIG_SHELL-'"$SHELL"'}' "$0" \
1436 '-v -d' "$at_debug_args" "$at_group" '${1+"$@"}'
1437 echo 'exit 1'
1438 } >$at_group_dir/run
1439 chmod +x $at_group_dir/run
1440
1441 $at_errexit && break
1442 ;;
1443 esac
1444 ;;
1445 esac
1446done
1447
1448# Back to the top directory.
1449cd "$at_dir"
1450
1451# Compute the duration of the suite.
1452at_stop_date=`date`
1453at_stop_time=`date +%s 2>/dev/null`
1454echo "$as_me: ending at: $at_stop_date" >&5
1455case $at_start_time,$at_stop_time in
1456 [0-9]*,[0-9]*)
1457 at_duration_s=`expr $at_stop_time - $at_start_time`
1458 at_duration_m=`expr $at_duration_s / 60`
1459 at_duration_h=`expr $at_duration_m / 60`
1460 at_duration_s=`expr $at_duration_s % 60`
1461 at_duration_m=`expr $at_duration_m % 60`
1462 at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
1463 echo "$as_me: test suite duration: $at_duration" >&5
1464 ;;
1465esac
1466
1467# Wrap up the test suite with summary statistics.
1468at_skip_count=`set dummy $at_skip_list; shift; echo $#`
1469at_fail_count=`set dummy $at_fail_list; shift; echo $#`
1470at_xpass_count=`set dummy $at_xpass_list; shift; echo $#`
1471at_xfail_count=`set dummy $at_xfail_list; shift; echo $#`
1472
1473at_run_count=`expr $at_group_count - $at_skip_count`
1474at_unexpected_count=`expr $at_xpass_count + $at_fail_count`
1475at_total_fail_count=`expr $at_xfail_count + $at_fail_count`
1476
1477echo
1478cat <<\_ASBOX
1479## ------------- ##
1480## Test results. ##
1481## ------------- ##
1482_ASBOX
1483echo
1484{
1485 echo
1486 cat <<\_ASBOX
1487## ------------- ##
1488## Test results. ##
1489## ------------- ##
1490_ASBOX
1491 echo
1492} >&5
1493
1494if test $at_run_count = 1; then
1495 at_result="1 test"
1496 at_were=was
1497else
1498 at_result="$at_run_count tests"
1499 at_were=were
1500fi
1501if $at_errexit_p && test $at_unexpected_count != 0; then
1502 if test $at_xpass_count = 1; then
1503 at_result="$at_result $at_were run, one passed"
1504 else
1505 at_result="$at_result $at_were run, one failed"
1506 fi
1507 at_result="$at_result unexpectedly and inhibited subsequent tests."
1508else
1509 # Don't you just love exponential explosion of the number of cases?
1510 case $at_xpass_count:$at_fail_count:$at_xfail_count in
1511 # So far, so good.
1512 0:0:0) at_result="$at_result $at_were successful." ;;
1513 0:0:*) at_result="$at_result behaved as expected." ;;
1514
1515 # Some unexpected failures
1516 0:*:0) at_result="$at_result $at_were run,
1517$at_fail_count failed unexpectedly." ;;
1518
1519 # Some failures, both expected and unexpected
1520 0:*:1) at_result="$at_result $at_were run,
1521$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
1522 0:*:*) at_result="$at_result $at_were run,
1523$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
1524
1525 # No unexpected failures, but some xpasses
1526 *:0:*) at_result="$at_result $at_were run,
1527$at_xpass_count passed unexpectedly." ;;
1528
1529 # No expected failures, but failures and xpasses
1530 *:1:0) at_result="$at_result $at_were run,
1531$at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;;
1532 *:*:0) at_result="$at_result $at_were run,
1533$at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;;
1534
1535 # All of them.
1536 *:*:1) at_result="$at_result $at_were run,
1537$at_xpass_count passed unexpectedly,
1538$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
1539 *:*:*) at_result="$at_result $at_were run,
1540$at_xpass_count passed unexpectedly,
1541$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
1542 esac
1543
1544 if test $at_skip_count = 0 && test $at_run_count -gt 1; then
1545 at_result="All $at_result"
1546 fi
1547fi
1548
1549# Now put skips in the mix.
1550case $at_skip_count in
1551 0) ;;
1552 1) at_result="$at_result
15531 test was skipped." ;;
1554 *) at_result="$at_result
1555$at_skip_count tests were skipped." ;;
1556esac
1557
1558if test $at_unexpected_count = 0; then
1559 echo "$at_result"
1560 echo "$at_result" >&5
1561else
1562 echo "ERROR: $at_result" >&2
1563 echo "ERROR: $at_result" >&5
1564 {
1565 echo
1566 cat <<\_ASBOX
1567## ------------------------ ##
1568## Summary of the failures. ##
1569## ------------------------ ##
1570_ASBOX
1571
1572 # Summary of failed and skipped tests.
1573 if test $at_fail_count != 0; then
1574 echo "Failed tests:"
1575 $SHELL "$0" $at_fail_list --list
1576 echo
1577 fi
1578 if test $at_skip_count != 0; then
1579 echo "Skipped tests:"
1580 $SHELL "$0" $at_skip_list --list
1581 echo
1582 fi
1583 if test $at_xpass_count != 0; then
1584 echo "Unexpected passes:"
1585 $SHELL "$0" $at_xpass_list --list
1586 echo
1587 fi
1588 if test $at_fail_count != 0; then
1589 cat <<\_ASBOX
1590## ---------------------- ##
1591## Detailed failed tests. ##
1592## ---------------------- ##
1593_ASBOX
1594 echo
1595 for at_group in $at_fail_list
1596 do
1597 at_group_normalized=$at_group
1598
1599 while :; do
1600 case $at_group_normalized in #(
1601 $at_format*) break;;
1602 esac
1603 at_group_normalized=0$at_group_normalized
1604 done
1605
1606 cat "$at_suite_dir/$at_group_normalized/$as_me.log"
1607 echo
1608 done
1609 echo
1610 fi
1611 if test -n "$at_top_srcdir"; then
1612 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
1613## ${at_top_build_prefix}config.log ##
1614_ASBOX
1615 sed 's/^/| /' ${at_top_build_prefix}config.log
1616 echo
1617 fi
1618 } >&5
1619
1620 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
1621## $as_me.log was created. ##
1622_ASBOX
1623
1624 echo
1625 echo "Please send \`${at_testdir+${at_testdir}/}$as_me.log' and all information you think might help:"
1626 echo
1627 echo " To: <bug-cpio@gnu.org>"
1628 echo " Subject: [GNU cpio 2.7] $as_me:$at_fail_list${at_fail_list:+ failed${at_xpass_list:+,}}$at_xpass_list${at_xpass_list:+ passed unexpectedly}"
1629 echo
1630 if test $at_debug_p = false; then
1631 echo
1632 echo 'You may investigate any problem if you feel able to do so, in which'
1633 echo 'case the test suite provides a good starting point. Its output may'
1634 echo "be found below \`${at_testdir+${at_testdir}/}$as_me.dir'."
1635 echo
1636 fi
1637 exit 1
1638fi
1639
1640exit 0
1641
1642
1643
Note: See TracBrowser for help on using the repository browser.