1#! /bin/sh
2# Generated from testsuite.at by GNU Autoconf 2.69.
3#
4# Copyright (C) 2009-2012 Free Software Foundation, Inc.
5#
6# This test suite is free software; the Free Software Foundation gives
7# unlimited permission to copy, distribute and modify it.
8## -------------------- ##
9## M4sh Initialization. ##
10## -------------------- ##
11
12# Be more Bourne compatible
13DUALCASE=1; export DUALCASE # for MKS sh
14if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
15  emulate sh
16  NULLCMD=:
17  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
18  # is contrary to our usage.  Disable this feature.
19  alias -g '${1+"$@"}'='"$@"'
20  setopt NO_GLOB_SUBST
21else
22  case `(set -o) 2>/dev/null` in #(
23  *posix*) :
24    set -o posix ;; #(
25  *) :
26     ;;
27esac
28fi
29
30
31as_nl='
32'
33export as_nl
34# Printing a long string crashes Solaris 7 /usr/bin/printf.
35as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
36as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
37as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
38# Prefer a ksh shell builtin over an external printf program on Solaris,
39# but without wasting forks for bash or zsh.
40if test -z "$BASH_VERSION$ZSH_VERSION" \
41    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
42  as_echo='print -r --'
43  as_echo_n='print -rn --'
44elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
45  as_echo='printf %s\n'
46  as_echo_n='printf %s'
47else
48  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
49    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
50    as_echo_n='/usr/ucb/echo -n'
51  else
52    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
53    as_echo_n_body='eval
54      arg=$1;
55      case $arg in #(
56      *"$as_nl"*)
57	expr "X$arg" : "X\\(.*\\)$as_nl";
58	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
59      esac;
60      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
61    '
62    export as_echo_n_body
63    as_echo_n='sh -c $as_echo_n_body as_echo'
64  fi
65  export as_echo_body
66  as_echo='sh -c $as_echo_body as_echo'
67fi
68
69# The user is always right.
70if test "${PATH_SEPARATOR+set}" != set; then
71  PATH_SEPARATOR=:
72  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
73    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
74      PATH_SEPARATOR=';'
75  }
76fi
77
78
79# IFS
80# We need space, tab and new line, in precisely that order.  Quoting is
81# there to prevent editors from complaining about space-tab.
82# (If _AS_PATH_WALK were called with IFS unset, it would disable word
83# splitting by setting IFS to empty value.)
84IFS=" ""	$as_nl"
85
86# Find who we are.  Look in the path if we contain no directory separator.
87as_myself=
88case $0 in #((
89  *[\\/]* ) as_myself=$0 ;;
90  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
91for as_dir in $PATH
92do
93  IFS=$as_save_IFS
94  test -z "$as_dir" && as_dir=.
95    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
96  done
97IFS=$as_save_IFS
98
99     ;;
100esac
101# We did not find ourselves, most probably we were run as `sh COMMAND'
102# in which case we are not to be found in the path.
103if test "x$as_myself" = x; then
104  as_myself=$0
105fi
106if test ! -f "$as_myself"; then
107  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
108  exit 1
109fi
110
111# Unset variables that we do not need and which cause bugs (e.g. in
112# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
113# suppresses any "Segmentation fault" message there.  '((' could
114# trigger a bug in pdksh 5.2.14.
115for as_var in BASH_ENV ENV MAIL MAILPATH
116do eval test x\${$as_var+set} = xset \
117  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
118done
119PS1='$ '
120PS2='> '
121PS4='+ '
122
123# NLS nuisances.
124LC_ALL=C
125export LC_ALL
126LANGUAGE=C
127export LANGUAGE
128
129# CDPATH.
130(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
131
132if test "x$CONFIG_SHELL" = x; then
133  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
134  emulate sh
135  NULLCMD=:
136  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
137  # is contrary to our usage.  Disable this feature.
138  alias -g '\${1+\"\$@\"}'='\"\$@\"'
139  setopt NO_GLOB_SUBST
140else
141  case \`(set -o) 2>/dev/null\` in #(
142  *posix*) :
143    set -o posix ;; #(
144  *) :
145     ;;
146esac
147fi
148"
149  as_required="as_fn_return () { (exit \$1); }
150as_fn_success () { as_fn_return 0; }
151as_fn_failure () { as_fn_return 1; }
152as_fn_ret_success () { return 0; }
153as_fn_ret_failure () { return 1; }
154
155exitcode=0
156as_fn_success || { exitcode=1; echo as_fn_success failed.; }
157as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
158as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
159as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
160if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
161
162else
163  exitcode=1; echo positional parameters were not saved.
164fi
165test x\$exitcode = x0 || exit 1
166test -x / || exit 1"
167  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
168  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
169  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
170  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
171test \$(( 1 + 1 )) = 2 || exit 1"
172  if (eval "$as_required") 2>/dev/null; then :
173  as_have_required=yes
174else
175  as_have_required=no
176fi
177  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
178
179else
180  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
181as_found=false
182for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
183do
184  IFS=$as_save_IFS
185  test -z "$as_dir" && as_dir=.
186  as_found=:
187  case $as_dir in #(
188	 /*)
189	   for as_base in sh bash ksh sh5; do
190	     # Try only shells that exist, to save several forks.
191	     as_shell=$as_dir/$as_base
192	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
193		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
194  CONFIG_SHELL=$as_shell as_have_required=yes
195		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
196  break 2
197fi
198fi
199	   done;;
200       esac
201  as_found=false
202done
203$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
204	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
205  CONFIG_SHELL=$SHELL as_have_required=yes
206fi; }
207IFS=$as_save_IFS
208
209
210      if test "x$CONFIG_SHELL" != x; then :
211  export CONFIG_SHELL
212             # We cannot yet assume a decent shell, so we have to provide a
213# neutralization value for shells without unset; and this also
214# works around shells that cannot unset nonexistent variables.
215# Preserve -v and -x to the replacement shell.
216BASH_ENV=/dev/null
217ENV=/dev/null
218(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
219case $- in # ((((
220  *v*x* | *x*v* ) as_opts=-vx ;;
221  *v* ) as_opts=-v ;;
222  *x* ) as_opts=-x ;;
223  * ) as_opts= ;;
224esac
225exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
226# Admittedly, this is quite paranoid, since all the known shells bail
227# out after a failed `exec'.
228$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
229exit 255
230fi
231
232    if test x$as_have_required = xno; then :
233  $as_echo "$0: This script requires a shell more modern than all"
234  $as_echo "$0: the shells that I found on your system."
235  if test x${ZSH_VERSION+set} = xset ; then
236    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
237    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
238  else
239    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
240$0: including any error possibly output before this
241$0: message. Then install a modern shell, or manually run
242$0: the script under such a shell if you do have one."
243  fi
244  exit 1
245fi
246fi
247fi
248SHELL=${CONFIG_SHELL-/bin/sh}
249export SHELL
250# Unset more variables known to interfere with behavior of common tools.
251CLICOLOR_FORCE= GREP_OPTIONS=
252unset CLICOLOR_FORCE GREP_OPTIONS
253
254## --------------------- ##
255## M4sh Shell Functions. ##
256## --------------------- ##
257# as_fn_unset VAR
258# ---------------
259# Portably unset VAR.
260as_fn_unset ()
261{
262  { eval $1=; unset $1;}
263}
264as_unset=as_fn_unset
265
266# as_fn_set_status STATUS
267# -----------------------
268# Set $? to STATUS, without forking.
269as_fn_set_status ()
270{
271  return $1
272} # as_fn_set_status
273
274# as_fn_exit STATUS
275# -----------------
276# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
277as_fn_exit ()
278{
279  set +e
280  as_fn_set_status $1
281  exit $1
282} # as_fn_exit
283
284# as_fn_mkdir_p
285# -------------
286# Create "$as_dir" as a directory, including parents if necessary.
287as_fn_mkdir_p ()
288{
289
290  case $as_dir in #(
291  -*) as_dir=./$as_dir;;
292  esac
293  test -d "$as_dir" || eval $as_mkdir_p || {
294    as_dirs=
295    while :; do
296      case $as_dir in #(
297      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
298      *) as_qdir=$as_dir;;
299      esac
300      as_dirs="'$as_qdir' $as_dirs"
301      as_dir=`$as_dirname -- "$as_dir" ||
302$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
303	 X"$as_dir" : 'X\(//\)[^/]' \| \
304	 X"$as_dir" : 'X\(//\)$' \| \
305	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
306$as_echo X"$as_dir" |
307    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
308	    s//\1/
309	    q
310	  }
311	  /^X\(\/\/\)[^/].*/{
312	    s//\1/
313	    q
314	  }
315	  /^X\(\/\/\)$/{
316	    s//\1/
317	    q
318	  }
319	  /^X\(\/\).*/{
320	    s//\1/
321	    q
322	  }
323	  s/.*/./; q'`
324      test -d "$as_dir" && break
325    done
326    test -z "$as_dirs" || eval "mkdir $as_dirs"
327  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
328
329
330} # as_fn_mkdir_p
331
332# as_fn_executable_p FILE
333# -----------------------
334# Test if FILE is an executable regular file.
335as_fn_executable_p ()
336{
337  test -f "$1" && test -x "$1"
338} # as_fn_executable_p
339# as_fn_append VAR VALUE
340# ----------------------
341# Append the text in VALUE to the end of the definition contained in VAR. Take
342# advantage of any shell optimizations that allow amortized linear growth over
343# repeated appends, instead of the typical quadratic growth present in naive
344# implementations.
345if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
346  eval 'as_fn_append ()
347  {
348    eval $1+=\$2
349  }'
350else
351  as_fn_append ()
352  {
353    eval $1=\$$1\$2
354  }
355fi # as_fn_append
356
357# as_fn_arith ARG...
358# ------------------
359# Perform arithmetic evaluation on the ARGs, and store the result in the
360# global $as_val. Take advantage of shells that can avoid forks. The arguments
361# must be portable across $(()) and expr.
362if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
363  eval 'as_fn_arith ()
364  {
365    as_val=$(( $* ))
366  }'
367else
368  as_fn_arith ()
369  {
370    as_val=`expr "$@" || test $? -eq 1`
371  }
372fi # as_fn_arith
373
374
375# as_fn_error STATUS ERROR [LINENO LOG_FD]
376# ----------------------------------------
377# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
378# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
379# script with STATUS, using 1 if that was 0.
380as_fn_error ()
381{
382  as_status=$1; test $as_status -eq 0 && as_status=1
383  if test "$4"; then
384    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
385    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
386  fi
387  $as_echo "$as_me: error: $2" >&2
388  as_fn_exit $as_status
389} # as_fn_error
390
391if expr a : '\(a\)' >/dev/null 2>&1 &&
392   test "X`expr 00001 : '.*\(...\)'`" = X001; then
393  as_expr=expr
394else
395  as_expr=false
396fi
397
398if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
399  as_basename=basename
400else
401  as_basename=false
402fi
403
404as_me=`$as_basename -- "$0" ||
405$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
406	 X"$0" : 'X\(//\)$' \| \
407	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
408$as_echo X/"$0" |
409    sed '/^.*\/\([^/][^/]*\)\/*$/{
410	    s//\1/
411	    q
412	  }
413	  /^X\/\(\/\/\)$/{
414	    s//\1/
415	    q
416	  }
417	  /^X\/\(\/\).*/{
418	    s//\1/
419	    q
420	  }
421	  s/.*/./; q'`
422
423if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
424  as_dirname=dirname
425else
426  as_dirname=false
427fi
428
429# Avoid depending upon Character Ranges.
430as_cr_letters='abcdefghijklmnopqrstuvwxyz'
431as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
432as_cr_Letters=$as_cr_letters$as_cr_LETTERS
433as_cr_digits='0123456789'
434as_cr_alnum=$as_cr_Letters$as_cr_digits
435
436
437  as_lineno_1=$LINENO as_lineno_1a=$LINENO
438  as_lineno_2=$LINENO as_lineno_2a=$LINENO
439  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
440  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
441  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
442  sed -n '
443    p
444    /[$]LINENO/=
445  ' <$as_myself |
446    sed '
447      s/[$]LINENO.*/&-/
448      t lineno
449      b
450      :lineno
451      N
452      :loop
453      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
454      t loop
455      s/-\n.*//
456    ' >$as_me.lineno &&
457  chmod +x "$as_me.lineno" ||
458    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
459
460  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
461  # already done that, so ensure we don't try to do so again and fall
462  # in an infinite loop.  This has already happened in practice.
463  _as_can_reexec=no; export _as_can_reexec
464  # Don't try to exec as it changes $[0], causing all sort of problems
465  # (the dirname of $[0] is not the place where we might find the
466  # original and so on.  Autoconf is especially sensitive to this).
467  . "./$as_me.lineno"
468  # Exit status is that of the last command.
469  exit
470}
471
472ECHO_C= ECHO_N= ECHO_T=
473case `echo -n x` in #(((((
474-n*)
475  case `echo 'xy\c'` in
476  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
477  xy)  ECHO_C='\c';;
478  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
479       ECHO_T='	';;
480  esac;;
481*)
482  ECHO_N='-n';;
483esac
484
485rm -f conf$$ conf$$.exe conf$$.file
486if test -d conf$$.dir; then
487  rm -f conf$$.dir/conf$$.file
488else
489  rm -f conf$$.dir
490  mkdir conf$$.dir 2>/dev/null
491fi
492if (echo >conf$$.file) 2>/dev/null; then
493  if ln -s conf$$.file conf$$ 2>/dev/null; then
494    as_ln_s='ln -s'
495    # ... but there are two gotchas:
496    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
497    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
498    # In both cases, we have to default to `cp -pR'.
499    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
500      as_ln_s='cp -pR'
501  elif ln conf$$.file conf$$ 2>/dev/null; then
502    as_ln_s=ln
503  else
504    as_ln_s='cp -pR'
505  fi
506else
507  as_ln_s='cp -pR'
508fi
509rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
510rmdir conf$$.dir 2>/dev/null
511
512if mkdir -p . 2>/dev/null; then
513  as_mkdir_p='mkdir -p "$as_dir"'
514else
515  test -d ./-p && rmdir ./-p
516  as_mkdir_p=false
517fi
518
519as_test_x='test -x'
520as_executable_p=as_fn_executable_p
521
522# Sed expression to map a string onto a valid CPP name.
523as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
524
525# Sed expression to map a string onto a valid variable name.
526as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
527
528
529
530
531
532SHELL=${CONFIG_SHELL-/bin/sh}
533
534# How were we run?
535at_cli_args="$@"
536
537
538# Not all shells have the 'times' builtin; the subshell is needed to make
539# sure we discard the 'times: not found' message from the shell.
540at_times_p=false
541(times) >/dev/null 2>&1 && at_times_p=:
542
543# CLI Arguments to pass to the debugging scripts.
544at_debug_args=
545# -e sets to true
546at_errexit_p=false
547# Shall we be verbose?  ':' means no, empty means yes.
548at_verbose=:
549at_quiet=
550# Running several jobs in parallel, 0 means as many as test groups.
551at_jobs=1
552at_traceon=:
553at_trace_echo=:
554at_check_filter_trace=:
555
556# Shall we keep the debug scripts?  Must be `:' when the suite is
557# run by a debug script, so that the script doesn't remove itself.
558at_debug_p=false
559# Display help message?
560at_help_p=false
561# Display the version message?
562at_version_p=false
563# List test groups?
564at_list_p=false
565# --clean
566at_clean=false
567# Test groups to run
568at_groups=
569# Whether to rerun failed tests.
570at_recheck=
571# Whether a write failure occurred
572at_write_fail=0
573
574# The directory we run the suite in.  Default to . if no -C option.
575at_dir=`pwd`
576# An absolute reference to this testsuite script.
577case $as_myself in
578  [\\/]* | ?:[\\/]* ) at_myself=$as_myself ;;
579  * ) at_myself=$at_dir/$as_myself ;;
580esac
581# Whether -C is in effect.
582at_change_dir=false
583
584# Whether to enable colored test results.
585at_color=no
586# List of the tested programs.
587at_tested='mimeview'
588# As many question marks as there are digits in the last test group number.
589# Used to normalize the test group numbers so that `ls' lists them in
590# numerical order.
591at_format='??'
592# Description of all the test groups.
593at_help_all="1;testsuite.at:74;mimeview version;;
5942;testsuite.at:76;default;mimeview;
5953;testsuite.at:80;suffixes;mimeview;
5964;testsuite.at:89;default ordering;mimeview;
5975;testsuite.at:95;priority;mimeview;
5986;testsuite.at:104;match;mimeview;
5997;testsuite.at:112;ascii;mimeview;
6008;testsuite.at:120;printable;mimeview;
6019;testsuite.at:128;regex;mimeview;
60210;testsuite.at:135;string;mimeview;
60311;testsuite.at:143;istring;mimeview;
60412;testsuite.at:150;char;mimeview;
60513;testsuite.at:157;short;mimeview;
60614;testsuite.at:164;int;mimeview;
60715;testsuite.at:174;contains;mimeview;
60816;testsuite.at:180;argument strings;mimeview;
60917;testsuite.at:191;logical or;mimeview;
61018;testsuite.at:200;logical and;mimeview;
61119;testsuite.at:207;grouping;mimeview;
61220;testsuite.at:214;error recovery;mimeview;
61321;testsuite.at:226;multiple error recovery;mimeview;
614"
615# List of the all the test groups.
616at_groups_all=`$as_echo "$at_help_all" | sed 's/;.*//'`
617
618# at_fn_validate_ranges NAME...
619# -----------------------------
620# Validate and normalize the test group number contained in each variable
621# NAME. Leading zeroes are treated as decimal.
622at_fn_validate_ranges ()
623{
624  for at_grp
625  do
626    eval at_value=\$$at_grp
627    if test $at_value -lt 1 || test $at_value -gt 21; then
628      $as_echo "invalid test group: $at_value" >&2
629      exit 1
630    fi
631    case $at_value in
632      0*) # We want to treat leading 0 as decimal, like expr and test, but
633	  # AS_VAR_ARITH treats it as octal if it uses $(( )).
634	  # With XSI shells, ${at_value#${at_value%%[1-9]*}} avoids the
635	  # expr fork, but it is not worth the effort to determine if the
636	  # shell supports XSI when the user can just avoid leading 0.
637	  eval $at_grp='`expr $at_value + 0`' ;;
638    esac
639  done
640}
641
642at_prev=
643for at_option
644do
645  # If the previous option needs an argument, assign it.
646  if test -n "$at_prev"; then
647    at_option=$at_prev=$at_option
648    at_prev=
649  fi
650
651  case $at_option in
652  *=?*) at_optarg=`expr "X$at_option" : '[^=]*=\(.*\)'` ;;
653  *)    at_optarg= ;;
654  esac
655
656  # Accept the important Cygnus configure options, so we can diagnose typos.
657
658  case $at_option in
659    --help | -h )
660	at_help_p=:
661	;;
662
663    --list | -l )
664	at_list_p=:
665	;;
666
667    --version | -V )
668	at_version_p=:
669	;;
670
671    --clean | -c )
672	at_clean=:
673	;;
674
675    --color )
676	at_color=always
677	;;
678    --color=* )
679	case $at_optarg in
680	no | never | none) at_color=never ;;
681	auto | tty | if-tty) at_color=auto ;;
682	always | yes | force) at_color=always ;;
683	*) at_optname=`echo " $at_option" | sed 's/^ //; s/=.*//'`
684	   as_fn_error $? "unrecognized argument to $at_optname: $at_optarg" ;;
685	esac
686	;;
687
688    --debug | -d )
689	at_debug_p=:
690	;;
691
692    --errexit | -e )
693	at_debug_p=:
694	at_errexit_p=:
695	;;
696
697    --verbose | -v )
698	at_verbose=; at_quiet=:
699	;;
700
701    --trace | -x )
702	at_traceon='set -x'
703	at_trace_echo=echo
704	at_check_filter_trace=at_fn_filter_trace
705	;;
706
707    [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9])
708	at_fn_validate_ranges at_option
709	as_fn_append at_groups "$at_option$as_nl"
710	;;
711
712    # Ranges
713    [0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-)
714	at_range_start=`echo $at_option |tr -d X-`
715	at_fn_validate_ranges at_range_start
716	at_range=`$as_echo "$at_groups_all" | \
717	  sed -ne '/^'$at_range_start'$/,$p'`
718	as_fn_append at_groups "$at_range$as_nl"
719	;;
720
721    -[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9])
722	at_range_end=`echo $at_option |tr -d X-`
723	at_fn_validate_ranges at_range_end
724	at_range=`$as_echo "$at_groups_all" | \
725	  sed -ne '1,/^'$at_range_end'$/p'`
726	as_fn_append at_groups "$at_range$as_nl"
727	;;
728
729    [0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \
730    [0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \
731    [0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \
732    [0-9][0-9][0-9]-[0-9][0-9][0-9] | \
733    [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \
734    [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] )
735	at_range_start=`expr $at_option : '\(.*\)-'`
736	at_range_end=`expr $at_option : '.*-\(.*\)'`
737	if test $at_range_start -gt $at_range_end; then
738	  at_tmp=$at_range_end
739	  at_range_end=$at_range_start
740	  at_range_start=$at_tmp
741	fi
742	at_fn_validate_ranges at_range_start at_range_end
743	at_range=`$as_echo "$at_groups_all" | \
744	  sed -ne '/^'$at_range_start'$/,/^'$at_range_end'$/p'`
745	as_fn_append at_groups "$at_range$as_nl"
746	;;
747
748    # Directory selection.
749    --directory | -C )
750	at_prev=--directory
751	;;
752    --directory=* )
753	at_change_dir=:
754	at_dir=$at_optarg
755	if test x- = "x$at_dir" ; then
756	  at_dir=./-
757	fi
758	;;
759
760    # Parallel execution.
761    --jobs | -j )
762	at_jobs=0
763	;;
764    --jobs=* | -j[0-9]* )
765	if test -n "$at_optarg"; then
766	  at_jobs=$at_optarg
767	else
768	  at_jobs=`expr X$at_option : 'X-j\(.*\)'`
769	fi
770	case $at_jobs in *[!0-9]*)
771	  at_optname=`echo " $at_option" | sed 's/^ //; s/[0-9=].*//'`
772	  as_fn_error $? "non-numeric argument to $at_optname: $at_jobs" ;;
773	esac
774	;;
775
776    # Keywords.
777    --keywords | -k )
778	at_prev=--keywords
779	;;
780    --keywords=* )
781	at_groups_selected=$at_help_all
782	at_save_IFS=$IFS
783	IFS=,
784	set X $at_optarg
785	shift
786	IFS=$at_save_IFS
787	for at_keyword
788	do
789	  at_invert=
790	  case $at_keyword in
791	  '!'*)
792	    at_invert="-v"
793	    at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'`
794	    ;;
795	  esac
796	  # It is on purpose that we match the test group titles too.
797	  at_groups_selected=`$as_echo "$at_groups_selected" |
798	      grep -i $at_invert "^[1-9][^;]*;.*[; ]$at_keyword[ ;]"`
799	done
800	# Smash the keywords.
801	at_groups_selected=`$as_echo "$at_groups_selected" | sed 's/;.*//'`
802	as_fn_append at_groups "$at_groups_selected$as_nl"
803	;;
804    --recheck)
805	at_recheck=:
806	;;
807
808    *=*)
809	at_envvar=`expr "x$at_option" : 'x\([^=]*\)='`
810	# Reject names that are not valid shell variable names.
811	case $at_envvar in
812	  '' | [0-9]* | *[!_$as_cr_alnum]* )
813	    as_fn_error $? "invalid variable name: \`$at_envvar'" ;;
814	esac
815	at_value=`$as_echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"`
816	# Export now, but save eval for later and for debug scripts.
817	export $at_envvar
818	as_fn_append at_debug_args " $at_envvar='$at_value'"
819	;;
820
821     *) $as_echo "$as_me: invalid option: $at_option" >&2
822	$as_echo "Try \`$0 --help' for more information." >&2
823	exit 1
824	;;
825  esac
826done
827
828# Verify our last option didn't require an argument
829if test -n "$at_prev"; then :
830  as_fn_error $? "\`$at_prev' requires an argument"
831fi
832
833# The file containing the suite.
834at_suite_log=$at_dir/$as_me.log
835
836# Selected test groups.
837if test -z "$at_groups$at_recheck"; then
838  at_groups=$at_groups_all
839else
840  if test -n "$at_recheck" && test -r "$at_suite_log"; then
841    at_oldfails=`sed -n '
842      /^Failed tests:$/,/^Skipped tests:$/{
843	s/^[ ]*\([1-9][0-9]*\):.*/\1/p
844      }
845      /^Unexpected passes:$/,/^## Detailed failed tests/{
846	s/^[ ]*\([1-9][0-9]*\):.*/\1/p
847      }
848      /^## Detailed failed tests/q
849      ' "$at_suite_log"`
850    as_fn_append at_groups "$at_oldfails$as_nl"
851  fi
852  # Sort the tests, removing duplicates.
853  at_groups=`$as_echo "$at_groups" | sort -nu | sed '/^$/d'`
854fi
855
856if test x"$at_color" = xalways \
857   || { test x"$at_color" = xauto && test -t 1; }; then
858  at_red=`printf '\033[0;31m'`
859  at_grn=`printf '\033[0;32m'`
860  at_lgn=`printf '\033[1;32m'`
861  at_blu=`printf '\033[1;34m'`
862  at_std=`printf '\033[m'`
863else
864  at_red= at_grn= at_lgn= at_blu= at_std=
865fi
866
867# Help message.
868if $at_help_p; then
869  cat <<_ATEOF || at_write_fail=1
870Usage: $0 [OPTION]... [VARIABLE=VALUE]... [TESTS]
871
872Run all the tests, or the selected TESTS, given by numeric ranges, and
873save a detailed log file.  Upon failure, create debugging scripts.
874
875Do not change environment variables directly.  Instead, set them via
876command line arguments.  Set \`AUTOTEST_PATH' to select the executables
877to exercise.  Each relative directory is expanded as build and source
878directories relative to the top level of this distribution.
879E.g., from within the build directory /tmp/foo-1.0, invoking this:
880
881  $ $0 AUTOTEST_PATH=bin
882
883is equivalent to the following, assuming the source directory is /src/foo-1.0:
884
885  PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH $0
886_ATEOF
887cat <<_ATEOF || at_write_fail=1
888
889Operation modes:
890  -h, --help     print the help message, then exit
891  -V, --version  print version number, then exit
892  -c, --clean    remove all the files this test suite might create and exit
893  -l, --list     describes all the tests, or the selected TESTS
894_ATEOF
895cat <<_ATEOF || at_write_fail=1
896
897Execution tuning:
898  -C, --directory=DIR
899                 change to directory DIR before starting
900      --color[=never|auto|always]
901                 enable colored test results on terminal, or always
902  -j, --jobs[=N]
903                 Allow N jobs at once; infinite jobs with no arg (default 1)
904  -k, --keywords=KEYWORDS
905                 select the tests matching all the comma-separated KEYWORDS
906                 multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD
907      --recheck  select all tests that failed or passed unexpectedly last time
908  -e, --errexit  abort as soon as a test fails; implies --debug
909  -v, --verbose  force more detailed output
910                 default for debugging scripts
911  -d, --debug    inhibit clean up and top-level logging
912                 default for debugging scripts
913  -x, --trace    enable tests shell tracing
914_ATEOF
915cat <<_ATEOF || at_write_fail=1
916
917Report bugs to <bug-mailutils@gnu.org>.
918General help using GNU software: <http://www.gnu.org/gethelp/>.
919_ATEOF
920  exit $at_write_fail
921fi
922
923# List of tests.
924if $at_list_p; then
925  cat <<_ATEOF || at_write_fail=1
926GNU Mailutils 3.13 test suite test groups:
927
928 NUM: FILE-NAME:LINE     TEST-GROUP-NAME
929      KEYWORDS
930
931_ATEOF
932  # Pass an empty line as separator between selected groups and help.
933  $as_echo "$at_groups$as_nl$as_nl$at_help_all" |
934    awk 'NF == 1 && FS != ";" {
935	   selected[$ 1] = 1
936	   next
937	 }
938	 /^$/ { FS = ";" }
939	 NF > 0 {
940	   if (selected[$ 1]) {
941	     printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3
942	     if ($ 4) {
943	       lmax = 79
944	       indent = "     "
945	       line = indent
946	       len = length (line)
947	       n = split ($ 4, a, " ")
948	       for (i = 1; i <= n; i++) {
949		 l = length (a[i]) + 1
950		 if (i > 1 && len + l > lmax) {
951		   print line
952		   line = indent " " a[i]
953		   len = length (line)
954		 } else {
955		   line = line " " a[i]
956		   len += l
957		 }
958	       }
959	       if (n)
960		 print line
961	     }
962	   }
963	 }' || at_write_fail=1
964  exit $at_write_fail
965fi
966if $at_version_p; then
967  $as_echo "$as_me (GNU Mailutils 3.13)" &&
968  cat <<\_ATEOF || at_write_fail=1
969
970Copyright (C) 2012 Free Software Foundation, Inc.
971This test suite is free software; the Free Software Foundation gives
972unlimited permission to copy, distribute and modify it.
973_ATEOF
974  exit $at_write_fail
975fi
976
977# Should we print banners?  Yes if more than one test is run.
978case $at_groups in #(
979  *$as_nl* )
980      at_print_banners=: ;; #(
981  * ) at_print_banners=false ;;
982esac
983# Text for banner N, set to a single space once printed.
984# Banner 1. testsuite.at:101
985# Category starts at test group 6.
986at_banner_text_1="Functions"
987
988# Take any -C into account.
989if $at_change_dir ; then
990  test x != "x$at_dir" && cd "$at_dir" \
991    || as_fn_error $? "unable to change directory"
992  at_dir=`pwd`
993fi
994
995# Load the config files for any default variable assignments.
996for at_file in atconfig atlocal
997do
998  test -r $at_file || continue
999  . ./$at_file || as_fn_error $? "invalid content: $at_file"
1000done
1001
1002# Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix:
1003: "${at_top_build_prefix=$at_top_builddir}"
1004
1005# Perform any assignments requested during argument parsing.
1006eval "$at_debug_args"
1007
1008# atconfig delivers names relative to the directory the test suite is
1009# in, but the groups themselves are run in testsuite-dir/group-dir.
1010if test -n "$at_top_srcdir"; then
1011  builddir=../..
1012  for at_dir_var in srcdir top_srcdir top_build_prefix
1013  do
1014    eval at_val=\$at_$at_dir_var
1015    case $at_val in
1016      [\\/$]* | ?:[\\/]* ) at_prefix= ;;
1017      *) at_prefix=../../ ;;
1018    esac
1019    eval "$at_dir_var=\$at_prefix\$at_val"
1020  done
1021fi
1022
1023## -------------------- ##
1024## Directory structure. ##
1025## -------------------- ##
1026
1027# This is the set of directories and files used by this script
1028# (non-literals are capitalized):
1029#
1030# TESTSUITE         - the testsuite
1031# TESTSUITE.log     - summarizes the complete testsuite run
1032# TESTSUITE.dir/    - created during a run, remains after -d or failed test
1033# + at-groups/      - during a run: status of all groups in run
1034# | + NNN/          - during a run: meta-data about test group NNN
1035# | | + check-line  - location (source file and line) of current AT_CHECK
1036# | | + status      - exit status of current AT_CHECK
1037# | | + stdout      - stdout of current AT_CHECK
1038# | | + stder1      - stderr, including trace
1039# | | + stderr      - stderr, with trace filtered out
1040# | | + test-source - portion of testsuite that defines group
1041# | | + times       - timestamps for computing duration
1042# | | + pass        - created if group passed
1043# | | + xpass       - created if group xpassed
1044# | | + fail        - created if group failed
1045# | | + xfail       - created if group xfailed
1046# | | + skip        - created if group skipped
1047# + at-stop         - during a run: end the run if this file exists
1048# + at-source-lines - during a run: cache of TESTSUITE line numbers for extraction
1049# + 0..NNN/         - created for each group NNN, remains after -d or failed test
1050# | + TESTSUITE.log - summarizes the group results
1051# | + ...           - files created during the group
1052
1053# The directory the whole suite works in.
1054# Should be absolute to let the user `cd' at will.
1055at_suite_dir=$at_dir/$as_me.dir
1056# The file containing the suite ($at_dir might have changed since earlier).
1057at_suite_log=$at_dir/$as_me.log
1058# The directory containing helper files per test group.
1059at_helper_dir=$at_suite_dir/at-groups
1060# Stop file: if it exists, do not start new jobs.
1061at_stop_file=$at_suite_dir/at-stop
1062# The fifo used for the job dispatcher.
1063at_job_fifo=$at_suite_dir/at-job-fifo
1064
1065if $at_clean; then
1066  test -d "$at_suite_dir" &&
1067    find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
1068  rm -f -r "$at_suite_dir" "$at_suite_log"
1069  exit $?
1070fi
1071
1072# Don't take risks: use only absolute directories in PATH.
1073#
1074# For stand-alone test suites (ie. atconfig was not found),
1075# AUTOTEST_PATH is relative to `.'.
1076#
1077# For embedded test suites, AUTOTEST_PATH is relative to the top level
1078# of the package.  Then expand it into build/src parts, since users
1079# may create executables in both places.
1080AUTOTEST_PATH=`$as_echo "$AUTOTEST_PATH" | sed "s|:|$PATH_SEPARATOR|g"`
1081at_path=
1082as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1083for as_dir in $AUTOTEST_PATH $PATH
1084do
1085  IFS=$as_save_IFS
1086  test -z "$as_dir" && as_dir=.
1087    test -n "$at_path" && as_fn_append at_path $PATH_SEPARATOR
1088case $as_dir in
1089  [\\/]* | ?:[\\/]* )
1090    as_fn_append at_path "$as_dir"
1091    ;;
1092  * )
1093    if test -z "$at_top_build_prefix"; then
1094      # Stand-alone test suite.
1095      as_fn_append at_path "$as_dir"
1096    else
1097      # Embedded test suite.
1098      as_fn_append at_path "$at_top_build_prefix$as_dir$PATH_SEPARATOR"
1099      as_fn_append at_path "$at_top_srcdir/$as_dir"
1100    fi
1101    ;;
1102esac
1103  done
1104IFS=$as_save_IFS
1105
1106
1107# Now build and simplify PATH.
1108#
1109# There might be directories that don't exist, but don't redirect
1110# builtins' (eg., cd) stderr directly: Ultrix's sh hates that.
1111at_new_path=
1112as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1113for as_dir in $at_path
1114do
1115  IFS=$as_save_IFS
1116  test -z "$as_dir" && as_dir=.
1117    test -d "$as_dir" || continue
1118case $as_dir in
1119  [\\/]* | ?:[\\/]* ) ;;
1120  * ) as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` ;;
1121esac
1122case $PATH_SEPARATOR$at_new_path$PATH_SEPARATOR in
1123  *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR*) ;;
1124  $PATH_SEPARATOR$PATH_SEPARATOR) at_new_path=$as_dir ;;
1125  *) as_fn_append at_new_path "$PATH_SEPARATOR$as_dir" ;;
1126esac
1127  done
1128IFS=$as_save_IFS
1129
1130PATH=$at_new_path
1131export PATH
1132
1133# Setting up the FDs.
1134
1135
1136
1137# 5 is the log file.  Not to be overwritten if `-d'.
1138if $at_debug_p; then
1139  at_suite_log=/dev/null
1140else
1141  : >"$at_suite_log"
1142fi
1143exec 5>>"$at_suite_log"
1144
1145# Banners and logs.
1146$as_echo "## ------------------------------ ##
1147## GNU Mailutils 3.13 test suite. ##
1148## ------------------------------ ##"
1149{
1150  $as_echo "## ------------------------------ ##
1151## GNU Mailutils 3.13 test suite. ##
1152## ------------------------------ ##"
1153  echo
1154
1155  $as_echo "$as_me: command line was:"
1156  $as_echo "  \$ $0 $at_cli_args"
1157  echo
1158
1159  # If ChangeLog exists, list a few lines in case it might help determining
1160  # the exact version.
1161  if test -n "$at_top_srcdir" && test -f "$at_top_srcdir/ChangeLog"; then
1162    $as_echo "## ---------- ##
1163## ChangeLog. ##
1164## ---------- ##"
1165    echo
1166    sed 's/^/| /;10q' "$at_top_srcdir/ChangeLog"
1167    echo
1168  fi
1169
1170  {
1171cat <<_ASUNAME
1172## --------- ##
1173## Platform. ##
1174## --------- ##
1175
1176hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
1177uname -m = `(uname -m) 2>/dev/null || echo unknown`
1178uname -r = `(uname -r) 2>/dev/null || echo unknown`
1179uname -s = `(uname -s) 2>/dev/null || echo unknown`
1180uname -v = `(uname -v) 2>/dev/null || echo unknown`
1181
1182/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
1183/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
1184
1185/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
1186/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
1187/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
1188/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
1189/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
1190/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
1191/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
1192
1193_ASUNAME
1194
1195as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1196for as_dir in $PATH
1197do
1198  IFS=$as_save_IFS
1199  test -z "$as_dir" && as_dir=.
1200    $as_echo "PATH: $as_dir"
1201  done
1202IFS=$as_save_IFS
1203
1204}
1205  echo
1206
1207  # Contents of the config files.
1208  for at_file in atconfig atlocal
1209  do
1210    test -r $at_file || continue
1211    $as_echo "$as_me: $at_file:"
1212    sed 's/^/| /' $at_file
1213    echo
1214  done
1215} >&5
1216
1217# This setting is needed on FreeBSD to ensure the LD_LIBRARY_PATH overrides
1218# the DT_RPATH tag in ELF header.  See
1219# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27510
1220# for details.
1221LD_LIBRARY_PATH_RPATH=y
1222export LD_LIBRARY_PATH_RPATH
1223
1224
1225## ------------------------- ##
1226## Autotest shell functions. ##
1227## ------------------------- ##
1228
1229# at_fn_banner NUMBER
1230# -------------------
1231# Output banner NUMBER, provided the testsuite is running multiple groups and
1232# this particular banner has not yet been printed.
1233at_fn_banner ()
1234{
1235  $at_print_banners || return 0
1236  eval at_banner_text=\$at_banner_text_$1
1237  test "x$at_banner_text" = "x " && return 0
1238  eval "at_banner_text_$1=\" \""
1239  if test -z "$at_banner_text"; then
1240    $at_first || echo
1241  else
1242    $as_echo "$as_nl$at_banner_text$as_nl"
1243  fi
1244} # at_fn_banner
1245
1246# at_fn_check_prepare_notrace REASON LINE
1247# ---------------------------------------
1248# Perform AT_CHECK preparations for the command at LINE for an untraceable
1249# command; REASON is the reason for disabling tracing.
1250at_fn_check_prepare_notrace ()
1251{
1252  $at_trace_echo "Not enabling shell tracing (command contains $1)"
1253  $as_echo "$2" >"$at_check_line_file"
1254  at_check_trace=: at_check_filter=:
1255  : >"$at_stdout"; : >"$at_stderr"
1256}
1257
1258# at_fn_check_prepare_trace LINE
1259# ------------------------------
1260# Perform AT_CHECK preparations for the command at LINE for a traceable
1261# command.
1262at_fn_check_prepare_trace ()
1263{
1264  $as_echo "$1" >"$at_check_line_file"
1265  at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace
1266  : >"$at_stdout"; : >"$at_stderr"
1267}
1268
1269# at_fn_check_prepare_dynamic COMMAND LINE
1270# ----------------------------------------
1271# Decide if COMMAND at LINE is traceable at runtime, and call the appropriate
1272# preparation function.
1273at_fn_check_prepare_dynamic ()
1274{
1275  case $1 in
1276    *$as_nl*)
1277      at_fn_check_prepare_notrace 'an embedded newline' "$2" ;;
1278    *)
1279      at_fn_check_prepare_trace "$2" ;;
1280  esac
1281}
1282
1283# at_fn_filter_trace
1284# ------------------
1285# Remove the lines in the file "$at_stderr" generated by "set -x" and print
1286# them to stderr.
1287at_fn_filter_trace ()
1288{
1289  mv "$at_stderr" "$at_stder1"
1290  grep '^ *+' "$at_stder1" >&2
1291  grep -v '^ *+' "$at_stder1" >"$at_stderr"
1292}
1293
1294# at_fn_log_failure FILE-LIST
1295# ---------------------------
1296# Copy the files in the list on stdout with a "> " prefix, and exit the shell
1297# with a failure exit code.
1298at_fn_log_failure ()
1299{
1300  for file
1301    do $as_echo "$file:"; sed 's/^/> /' "$file"; done
1302  echo 1 > "$at_status_file"
1303  exit 1
1304}
1305
1306# at_fn_check_skip EXIT-CODE LINE
1307# -------------------------------
1308# Check whether EXIT-CODE is a special exit code (77 or 99), and if so exit
1309# the test group subshell with that same exit code. Use LINE in any report
1310# about test failure.
1311at_fn_check_skip ()
1312{
1313  case $1 in
1314    99) echo 99 > "$at_status_file"; at_failed=:
1315	$as_echo "$2: hard failure"; exit 99;;
1316    77) echo 77 > "$at_status_file"; exit 77;;
1317  esac
1318}
1319
1320# at_fn_check_status EXPECTED EXIT-CODE LINE
1321# ------------------------------------------
1322# Check whether EXIT-CODE is the EXPECTED exit code, and if so do nothing.
1323# Otherwise, if it is 77 or 99, exit the test group subshell with that same
1324# exit code; if it is anything else print an error message referring to LINE,
1325# and fail the test.
1326at_fn_check_status ()
1327{
1328  case $2 in
1329    $1 ) ;;
1330    77) echo 77 > "$at_status_file"; exit 77;;
1331    99) echo 99 > "$at_status_file"; at_failed=:
1332	$as_echo "$3: hard failure"; exit 99;;
1333    *) $as_echo "$3: exit code was $2, expected $1"
1334      at_failed=:;;
1335  esac
1336}
1337
1338# at_fn_diff_devnull FILE
1339# -----------------------
1340# Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless diff
1341# invocations.
1342at_fn_diff_devnull ()
1343{
1344  test -s "$1" || return 0
1345  $at_diff "$at_devnull" "$1"
1346}
1347
1348# at_fn_test NUMBER
1349# -----------------
1350# Parse out test NUMBER from the tail of this file.
1351at_fn_test ()
1352{
1353  eval at_sed=\$at_sed$1
1354  sed "$at_sed" "$at_myself" > "$at_test_source"
1355}
1356
1357# at_fn_create_debugging_script
1358# -----------------------------
1359# Create the debugging script $at_group_dir/run which will reproduce the
1360# current test group.
1361at_fn_create_debugging_script ()
1362{
1363  {
1364    echo "#! /bin/sh" &&
1365    echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$@"}'\''='\''"$@"'\''' &&
1366    $as_echo "cd '$at_dir'" &&
1367    $as_echo "exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d $at_debug_args $at_group \${1+\"\$@\"}" &&
1368    echo 'exit 1'
1369  } >"$at_group_dir/run" &&
1370  chmod +x "$at_group_dir/run"
1371}
1372
1373## -------------------------------- ##
1374## End of autotest shell functions. ##
1375## -------------------------------- ##
1376{
1377  $as_echo "## ---------------- ##
1378## Tested programs. ##
1379## ---------------- ##"
1380  echo
1381} >&5
1382
1383# Report what programs are being tested.
1384for at_program in : $at_tested
1385do
1386  test "$at_program" = : && continue
1387  case $at_program in
1388    [\\/]* | ?:[\\/]* ) $at_program_=$at_program ;;
1389    * )
1390    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1391for as_dir in $PATH
1392do
1393  IFS=$as_save_IFS
1394  test -z "$as_dir" && as_dir=.
1395    test -f "$as_dir/$at_program" && break
1396  done
1397IFS=$as_save_IFS
1398
1399    at_program_=$as_dir/$at_program ;;
1400  esac
1401  if test -f "$at_program_"; then
1402    {
1403      $as_echo "$at_srcdir/testsuite.at:72: $at_program_ --version"
1404      "$at_program_" --version </dev/null
1405      echo
1406    } >&5 2>&1
1407  else
1408    as_fn_error $? "cannot find $at_program" "$LINENO" 5
1409  fi
1410done
1411
1412{
1413  $as_echo "## ------------------ ##
1414## Running the tests. ##
1415## ------------------ ##"
1416} >&5
1417
1418at_start_date=`date`
1419at_start_time=`date +%s 2>/dev/null`
1420$as_echo "$as_me: starting at: $at_start_date" >&5
1421
1422# Create the master directory if it doesn't already exist.
1423as_dir="$at_suite_dir"; as_fn_mkdir_p ||
1424  as_fn_error $? "cannot create \`$at_suite_dir'" "$LINENO" 5
1425
1426# Can we diff with `/dev/null'?  DU 5.0 refuses.
1427if diff /dev/null /dev/null >/dev/null 2>&1; then
1428  at_devnull=/dev/null
1429else
1430  at_devnull=$at_suite_dir/devnull
1431  >"$at_devnull"
1432fi
1433
1434# Use `diff -u' when possible.
1435if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff"
1436then
1437  at_diff='diff -u'
1438else
1439  at_diff=diff
1440fi
1441
1442# Get the last needed group.
1443for at_group in : $at_groups; do :; done
1444
1445# Extract the start and end lines of each test group at the tail
1446# of this file
1447awk '
1448BEGIN { FS="" }
1449/^#AT_START_/ {
1450  start = NR
1451}
1452/^#AT_STOP_/ {
1453  test = substr ($ 0, 10)
1454  print "at_sed" test "=\"1," start "d;" (NR-1) "q\""
1455  if (test == "'"$at_group"'") exit
1456}' "$at_myself" > "$at_suite_dir/at-source-lines" &&
1457. "$at_suite_dir/at-source-lines" ||
1458  as_fn_error $? "cannot create test line number cache" "$LINENO" 5
1459rm -f "$at_suite_dir/at-source-lines"
1460
1461# Set number of jobs for `-j'; avoid more jobs than test groups.
1462set X $at_groups; shift; at_max_jobs=$#
1463if test $at_max_jobs -eq 0; then
1464  at_jobs=1
1465fi
1466if test $at_jobs -ne 1 &&
1467   { test $at_jobs -eq 0 || test $at_jobs -gt $at_max_jobs; }; then
1468  at_jobs=$at_max_jobs
1469fi
1470
1471# If parallel mode, don't output banners, don't split summary lines.
1472if test $at_jobs -ne 1; then
1473  at_print_banners=false
1474  at_quiet=:
1475fi
1476
1477# Set up helper dirs.
1478rm -rf "$at_helper_dir" &&
1479mkdir "$at_helper_dir" &&
1480cd "$at_helper_dir" &&
1481{ test -z "$at_groups" || mkdir $at_groups; } ||
1482as_fn_error $? "testsuite directory setup failed" "$LINENO" 5
1483
1484# Functions for running a test group.  We leave the actual
1485# test group execution outside of a shell function in order
1486# to avoid hitting zsh 4.x exit status bugs.
1487
1488# at_fn_group_prepare
1489# -------------------
1490# Prepare for running a test group.
1491at_fn_group_prepare ()
1492{
1493  # The directory for additional per-group helper files.
1494  at_job_dir=$at_helper_dir/$at_group
1495  # The file containing the location of the last AT_CHECK.
1496  at_check_line_file=$at_job_dir/check-line
1497  # The file containing the exit status of the last command.
1498  at_status_file=$at_job_dir/status
1499  # The files containing the output of the tested commands.
1500  at_stdout=$at_job_dir/stdout
1501  at_stder1=$at_job_dir/stder1
1502  at_stderr=$at_job_dir/stderr
1503  # The file containing the code for a test group.
1504  at_test_source=$at_job_dir/test-source
1505  # The file containing dates.
1506  at_times_file=$at_job_dir/times
1507
1508  # Be sure to come back to the top test directory.
1509  cd "$at_suite_dir"
1510
1511  # Clearly separate the test groups when verbose.
1512  $at_first || $at_verbose echo
1513
1514  at_group_normalized=$at_group
1515
1516  eval 'while :; do
1517    case $at_group_normalized in #(
1518    '"$at_format"'*) break;;
1519    esac
1520    at_group_normalized=0$at_group_normalized
1521  done'
1522
1523
1524  # Create a fresh directory for the next test group, and enter.
1525  # If one already exists, the user may have invoked ./run from
1526  # within that directory; we remove the contents, but not the
1527  # directory itself, so that we aren't pulling the rug out from
1528  # under the shell's notion of the current directory.
1529  at_group_dir=$at_suite_dir/$at_group_normalized
1530  at_group_log=$at_group_dir/$as_me.log
1531  if test -d "$at_group_dir"; then
1532  find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx {} \;
1533  rm -fr "$at_group_dir"/* "$at_group_dir"/.[!.] "$at_group_dir"/.??*
1534fi ||
1535    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test directory for $at_group_normalized could not be cleaned" >&5
1536$as_echo "$as_me: WARNING: test directory for $at_group_normalized could not be cleaned" >&2;}
1537  # Be tolerant if the above `rm' was not able to remove the directory.
1538  as_dir="$at_group_dir"; as_fn_mkdir_p
1539
1540  echo 0 > "$at_status_file"
1541
1542  # In verbose mode, append to the log file *and* show on
1543  # the standard output; in quiet mode only write to the log.
1544  if test -z "$at_verbose"; then
1545    at_tee_pipe='tee -a "$at_group_log"'
1546  else
1547    at_tee_pipe='cat >> "$at_group_log"'
1548  fi
1549}
1550
1551# at_fn_group_banner ORDINAL LINE DESC PAD [BANNER]
1552# -------------------------------------------------
1553# Declare the test group ORDINAL, located at LINE with group description DESC,
1554# and residing under BANNER. Use PAD to align the status column.
1555at_fn_group_banner ()
1556{
1557  at_setup_line="$2"
1558  test -n "$5" && at_fn_banner $5
1559  at_desc="$3"
1560  case $1 in
1561    [0-9])      at_desc_line="  $1: ";;
1562    [0-9][0-9]) at_desc_line=" $1: " ;;
1563    *)          at_desc_line="$1: "  ;;
1564  esac
1565  as_fn_append at_desc_line "$3$4"
1566  $at_quiet $as_echo_n "$at_desc_line"
1567  echo "#                             -*- compilation -*-" >> "$at_group_log"
1568}
1569
1570# at_fn_group_postprocess
1571# -----------------------
1572# Perform cleanup after running a test group.
1573at_fn_group_postprocess ()
1574{
1575  # Be sure to come back to the suite directory, in particular
1576  # since below we might `rm' the group directory we are in currently.
1577  cd "$at_suite_dir"
1578
1579  if test ! -f "$at_check_line_file"; then
1580    sed "s/^ */$as_me: WARNING: /" <<_ATEOF
1581      A failure happened in a test group before any test could be
1582      run. This means that test suite is improperly designed.  Please
1583      report this failure to <bug-mailutils@gnu.org>.
1584_ATEOF
1585    $as_echo "$at_setup_line" >"$at_check_line_file"
1586    at_status=99
1587  fi
1588  $at_verbose $as_echo_n "$at_group. $at_setup_line: "
1589  $as_echo_n "$at_group. $at_setup_line: " >> "$at_group_log"
1590  case $at_xfail:$at_status in
1591    yes:0)
1592	at_msg="UNEXPECTED PASS"
1593	at_res=xpass
1594	at_errexit=$at_errexit_p
1595	at_color=$at_red
1596	;;
1597    no:0)
1598	at_msg="ok"
1599	at_res=pass
1600	at_errexit=false
1601	at_color=$at_grn
1602	;;
1603    *:77)
1604	at_msg='skipped ('`cat "$at_check_line_file"`')'
1605	at_res=skip
1606	at_errexit=false
1607	at_color=$at_blu
1608	;;
1609    no:* | *:99)
1610	at_msg='FAILED ('`cat "$at_check_line_file"`')'
1611	at_res=fail
1612	at_errexit=$at_errexit_p
1613	at_color=$at_red
1614	;;
1615    yes:*)
1616	at_msg='expected failure ('`cat "$at_check_line_file"`')'
1617	at_res=xfail
1618	at_errexit=false
1619	at_color=$at_lgn
1620	;;
1621  esac
1622  echo "$at_res" > "$at_job_dir/$at_res"
1623  # In parallel mode, output the summary line only afterwards.
1624  if test $at_jobs -ne 1 && test -n "$at_verbose"; then
1625    $as_echo "$at_desc_line $at_color$at_msg$at_std"
1626  else
1627    # Make sure there is a separator even with long titles.
1628    $as_echo " $at_color$at_msg$at_std"
1629  fi
1630  at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg"
1631  case $at_status in
1632    0|77)
1633      # $at_times_file is only available if the group succeeded.
1634      # We're not including the group log, so the success message
1635      # is written in the global log separately.  But we also
1636      # write to the group log in case they're using -d.
1637      if test -f "$at_times_file"; then
1638	at_log_msg="$at_log_msg     ("`sed 1d "$at_times_file"`')'
1639	rm -f "$at_times_file"
1640      fi
1641      $as_echo "$at_log_msg" >> "$at_group_log"
1642      $as_echo "$at_log_msg" >&5
1643
1644      # Cleanup the group directory, unless the user wants the files
1645      # or the success was unexpected.
1646      if $at_debug_p || test $at_res = xpass; then
1647	at_fn_create_debugging_script
1648	if test $at_res = xpass && $at_errexit; then
1649	  echo stop > "$at_stop_file"
1650	fi
1651      else
1652	if test -d "$at_group_dir"; then
1653	  find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
1654	  rm -fr "$at_group_dir"
1655	fi
1656	rm -f "$at_test_source"
1657      fi
1658      ;;
1659    *)
1660      # Upon failure, include the log into the testsuite's global
1661      # log.  The failure message is written in the group log.  It
1662      # is later included in the global log.
1663      $as_echo "$at_log_msg" >> "$at_group_log"
1664
1665      # Upon failure, keep the group directory for autopsy, and create
1666      # the debugging script.  With -e, do not start any further tests.
1667      at_fn_create_debugging_script
1668      if $at_errexit; then
1669	echo stop > "$at_stop_file"
1670      fi
1671      ;;
1672  esac
1673}
1674
1675
1676## ------------ ##
1677## Driver loop. ##
1678## ------------ ##
1679
1680
1681if (set -m && set +m && set +b) >/dev/null 2>&1; then
1682  set +b
1683  at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=-
1684else
1685  at_job_control_on=: at_job_control_off=: at_job_group=
1686fi
1687
1688for at_signal in 1 2 15; do
1689  trap 'set +x; set +e
1690	$at_job_control_off
1691	at_signal='"$at_signal"'
1692	echo stop > "$at_stop_file"
1693	trap "" $at_signal
1694	at_pgids=
1695	for at_pgid in `jobs -p 2>/dev/null`; do
1696	  at_pgids="$at_pgids $at_job_group$at_pgid"
1697	done
1698	test -z "$at_pgids" || kill -$at_signal $at_pgids 2>/dev/null
1699	wait
1700	if test "$at_jobs" -eq 1 || test -z "$at_verbose"; then
1701	  echo >&2
1702	fi
1703	at_signame=`kill -l $at_signal 2>&1 || echo $at_signal`
1704	set x $at_signame
1705	test 0 -gt 2 && at_signame=$at_signal
1706	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: caught signal $at_signame, bailing out" >&5
1707$as_echo "$as_me: WARNING: caught signal $at_signame, bailing out" >&2;}
1708	as_fn_arith 128 + $at_signal && exit_status=$as_val
1709	as_fn_exit $exit_status' $at_signal
1710done
1711
1712rm -f "$at_stop_file"
1713at_first=:
1714
1715if test $at_jobs -ne 1 &&
1716     rm -f "$at_job_fifo" &&
1717     test -n "$at_job_group" &&
1718     ( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null
1719then
1720  # FIFO job dispatcher.
1721
1722  trap 'at_pids=
1723	for at_pid in `jobs -p`; do
1724	  at_pids="$at_pids $at_job_group$at_pid"
1725	done
1726	if test -n "$at_pids"; then
1727	  at_sig=TSTP
1728	  test "${TMOUT+set}" = set && at_sig=STOP
1729	  kill -$at_sig $at_pids 2>/dev/null
1730	fi
1731	kill -STOP $$
1732	test -z "$at_pids" || kill -CONT $at_pids 2>/dev/null' TSTP
1733
1734  echo
1735  # Turn jobs into a list of numbers, starting from 1.
1736  at_joblist=`$as_echo "$at_groups" | sed -n 1,${at_jobs}p`
1737
1738  set X $at_joblist
1739  shift
1740  for at_group in $at_groups; do
1741    $at_job_control_on 2>/dev/null
1742    (
1743      # Start one test group.
1744      $at_job_control_off
1745      if $at_first; then
1746	exec 7>"$at_job_fifo"
1747      else
1748	exec 6<&-
1749      fi
1750      trap 'set +x; set +e
1751	    trap "" PIPE
1752	    echo stop > "$at_stop_file"
1753	    echo >&7
1754	    as_fn_exit 141' PIPE
1755      at_fn_group_prepare
1756      if cd "$at_group_dir" &&
1757	 at_fn_test $at_group &&
1758	 . "$at_test_source"
1759      then :; else
1760	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5
1761$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;}
1762	at_failed=:
1763      fi
1764      at_fn_group_postprocess
1765      echo >&7
1766    ) &
1767    $at_job_control_off
1768    if $at_first; then
1769      at_first=false
1770      exec 6<"$at_job_fifo" 7>"$at_job_fifo"
1771    fi
1772    shift # Consume one token.
1773    if test $# -gt 0; then :; else
1774      read at_token <&6 || break
1775      set x $*
1776    fi
1777    test -f "$at_stop_file" && break
1778  done
1779  exec 7>&-
1780  # Read back the remaining ($at_jobs - 1) tokens.
1781  set X $at_joblist
1782  shift
1783  if test $# -gt 0; then
1784    shift
1785    for at_job
1786    do
1787      read at_token
1788    done <&6
1789  fi
1790  exec 6<&-
1791  wait
1792else
1793  # Run serially, avoid forks and other potential surprises.
1794  for at_group in $at_groups; do
1795    at_fn_group_prepare
1796    if cd "$at_group_dir" &&
1797       at_fn_test $at_group &&
1798       . "$at_test_source"; then :; else
1799      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5
1800$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;}
1801      at_failed=:
1802    fi
1803    at_fn_group_postprocess
1804    test -f "$at_stop_file" && break
1805    at_first=false
1806  done
1807fi
1808
1809# Wrap up the test suite with summary statistics.
1810cd "$at_helper_dir"
1811
1812# Use ?..???? when the list must remain sorted, the faster * otherwise.
1813at_pass_list=`for f in */pass; do echo $f; done | sed '/\*/d; s,/pass,,'`
1814at_skip_list=`for f in */skip; do echo $f; done | sed '/\*/d; s,/skip,,'`
1815at_xfail_list=`for f in */xfail; do echo $f; done | sed '/\*/d; s,/xfail,,'`
1816at_xpass_list=`for f in ?/xpass ??/xpass ???/xpass ????/xpass; do
1817		 echo $f; done | sed '/?/d; s,/xpass,,'`
1818at_fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do
1819		echo $f; done | sed '/?/d; s,/fail,,'`
1820
1821set X $at_pass_list $at_xpass_list $at_xfail_list $at_fail_list $at_skip_list
1822shift; at_group_count=$#
1823set X $at_xpass_list; shift; at_xpass_count=$#; at_xpass_list=$*
1824set X $at_xfail_list; shift; at_xfail_count=$#
1825set X $at_fail_list; shift; at_fail_count=$#; at_fail_list=$*
1826set X $at_skip_list; shift; at_skip_count=$#
1827
1828as_fn_arith $at_group_count - $at_skip_count && at_run_count=$as_val
1829as_fn_arith $at_xpass_count + $at_fail_count && at_unexpected_count=$as_val
1830as_fn_arith $at_xfail_count + $at_fail_count && at_total_fail_count=$as_val
1831
1832# Back to the top directory.
1833cd "$at_dir"
1834rm -rf "$at_helper_dir"
1835
1836# Compute the duration of the suite.
1837at_stop_date=`date`
1838at_stop_time=`date +%s 2>/dev/null`
1839$as_echo "$as_me: ending at: $at_stop_date" >&5
1840case $at_start_time,$at_stop_time in
1841  [0-9]*,[0-9]*)
1842    as_fn_arith $at_stop_time - $at_start_time && at_duration_s=$as_val
1843    as_fn_arith $at_duration_s / 60 && at_duration_m=$as_val
1844    as_fn_arith $at_duration_m / 60 && at_duration_h=$as_val
1845    as_fn_arith $at_duration_s % 60 && at_duration_s=$as_val
1846    as_fn_arith $at_duration_m % 60 && at_duration_m=$as_val
1847    at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
1848    $as_echo "$as_me: test suite duration: $at_duration" >&5
1849    ;;
1850esac
1851
1852echo
1853$as_echo "## ------------- ##
1854## Test results. ##
1855## ------------- ##"
1856echo
1857{
1858  echo
1859  $as_echo "## ------------- ##
1860## Test results. ##
1861## ------------- ##"
1862  echo
1863} >&5
1864
1865if test $at_run_count = 1; then
1866  at_result="1 test"
1867  at_were=was
1868else
1869  at_result="$at_run_count tests"
1870  at_were=were
1871fi
1872if $at_errexit_p && test $at_unexpected_count != 0; then
1873  if test $at_xpass_count = 1; then
1874    at_result="$at_result $at_were run, one passed"
1875  else
1876    at_result="$at_result $at_were run, one failed"
1877  fi
1878  at_result="$at_result unexpectedly and inhibited subsequent tests."
1879  at_color=$at_red
1880else
1881  # Don't you just love exponential explosion of the number of cases?
1882  at_color=$at_red
1883  case $at_xpass_count:$at_fail_count:$at_xfail_count in
1884    # So far, so good.
1885    0:0:0) at_result="$at_result $at_were successful." at_color=$at_grn ;;
1886    0:0:*) at_result="$at_result behaved as expected." at_color=$at_lgn ;;
1887
1888    # Some unexpected failures
1889    0:*:0) at_result="$at_result $at_were run,
1890$at_fail_count failed unexpectedly." ;;
1891
1892    # Some failures, both expected and unexpected
1893    0:*:1) at_result="$at_result $at_were run,
1894$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
1895    0:*:*) at_result="$at_result $at_were run,
1896$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
1897
1898    # No unexpected failures, but some xpasses
1899    *:0:*) at_result="$at_result $at_were run,
1900$at_xpass_count passed unexpectedly." ;;
1901
1902    # No expected failures, but failures and xpasses
1903    *:1:0) at_result="$at_result $at_were run,
1904$at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;;
1905    *:*:0) at_result="$at_result $at_were run,
1906$at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;;
1907
1908    # All of them.
1909    *:*:1) at_result="$at_result $at_were run,
1910$at_xpass_count passed unexpectedly,
1911$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
1912    *:*:*) at_result="$at_result $at_were run,
1913$at_xpass_count passed unexpectedly,
1914$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
1915  esac
1916
1917  if test $at_skip_count = 0 && test $at_run_count -gt 1; then
1918    at_result="All $at_result"
1919  fi
1920fi
1921
1922# Now put skips in the mix.
1923case $at_skip_count in
1924  0) ;;
1925  1) at_result="$at_result
19261 test was skipped." ;;
1927  *) at_result="$at_result
1928$at_skip_count tests were skipped." ;;
1929esac
1930
1931if test $at_unexpected_count = 0; then
1932  echo "$at_color$at_result$at_std"
1933  echo "$at_result" >&5
1934else
1935  echo "${at_color}ERROR: $at_result$at_std" >&2
1936  echo "ERROR: $at_result" >&5
1937  {
1938    echo
1939    $as_echo "## ------------------------ ##
1940## Summary of the failures. ##
1941## ------------------------ ##"
1942
1943    # Summary of failed and skipped tests.
1944    if test $at_fail_count != 0; then
1945      echo "Failed tests:"
1946      $SHELL "$at_myself" $at_fail_list --list
1947      echo
1948    fi
1949    if test $at_skip_count != 0; then
1950      echo "Skipped tests:"
1951      $SHELL "$at_myself" $at_skip_list --list
1952      echo
1953    fi
1954    if test $at_xpass_count != 0; then
1955      echo "Unexpected passes:"
1956      $SHELL "$at_myself" $at_xpass_list --list
1957      echo
1958    fi
1959    if test $at_fail_count != 0; then
1960      $as_echo "## ---------------------- ##
1961## Detailed failed tests. ##
1962## ---------------------- ##"
1963      echo
1964      for at_group in $at_fail_list
1965      do
1966	at_group_normalized=$at_group
1967
1968  eval 'while :; do
1969    case $at_group_normalized in #(
1970    '"$at_format"'*) break;;
1971    esac
1972    at_group_normalized=0$at_group_normalized
1973  done'
1974
1975	cat "$at_suite_dir/$at_group_normalized/$as_me.log"
1976	echo
1977      done
1978      echo
1979    fi
1980    if test -n "$at_top_srcdir"; then
1981      sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
1982## ${at_top_build_prefix}config.log ##
1983_ASBOX
1984      sed 's/^/| /' ${at_top_build_prefix}config.log
1985      echo
1986    fi
1987  } >&5
1988
1989  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
1990## $as_me.log was created. ##
1991_ASBOX
1992
1993  echo
1994  if $at_debug_p; then
1995    at_msg='per-test log files'
1996  else
1997    at_msg="\`${at_testdir+${at_testdir}/}$as_me.log'"
1998  fi
1999  $as_echo "Please send $at_msg and all information you think might help:
2000
2001   To: <bug-mailutils@gnu.org>
2002   Subject: [GNU Mailutils 3.13] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}
2003
2004You may investigate any problem if you feel able to do so, in which
2005case the test suite provides a good starting point.  Its output may
2006be found below \`${at_testdir+${at_testdir}/}$as_me.dir'.
2007"
2008  exit 1
2009fi
2010
2011exit 0
2012
2013## ------------- ##
2014## Actual tests. ##
2015## ------------- ##
2016#AT_START_1
2017at_fn_group_banner 1 'testsuite.at:74' \
2018  "mimeview version" "                               "
2019at_xfail=no
2020(
2021  $as_echo "1. $at_setup_line: testing $at_desc ..."
2022  $at_traceon
2023
2024
2025{ set +x
2026$as_echo "$at_srcdir/testsuite.at:74: mimeview --version | sed '1{s/-[0-9][0-9]* //;s/ *\\[.*\\]//;q;}' "
2027at_fn_check_prepare_notrace 'a shell pipeline' "testsuite.at:74"
2028( $at_check_trace; mimeview --version | sed '1{s/-[0-9][0-9]* //;s/ *\[.*\]//;q;}'
2029) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2030at_status=$? at_failed=false
2031$at_check_filter
2032at_fn_diff_devnull "$at_stderr" || at_failed=:
2033echo >>"$at_stdout"; $as_echo "mimeview (GNU Mailutils) 3.13
2034" | \
2035  $at_diff - "$at_stdout" || at_failed=:
2036at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:74"
2037$at_failed && at_fn_log_failure
2038$at_traceon; }
2039
2040
2041  set +x
2042  $at_times_p && times >"$at_times_file"
2043) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2044read at_status <"$at_status_file"
2045#AT_STOP_1
2046#AT_START_2
2047at_fn_group_banner 2 'testsuite.at:76' \
2048  "default" "                                        "
2049at_xfail=no
2050(
2051  $as_echo "2. $at_setup_line: testing $at_desc ..."
2052  $at_traceon
2053
2054
2055{ set +x
2056$as_echo "$at_srcdir/testsuite.at:76:
2057cat >mime.types <<'_ATEOF'
2058application/octet-stream
2059_ATEOF
2060
2061
2062bf input
2063
2064
2065mimeview --no-site --no-user --identify -f mime.types  input
2066"
2067at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:76"
2068( $at_check_trace;
2069cat >mime.types <<'_ATEOF'
2070application/octet-stream
2071_ATEOF
2072
2073
2074bf input
2075
2076
2077mimeview --no-site --no-user --identify -f mime.types  input
2078
2079) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2080at_status=$? at_failed=false
2081$at_check_filter
2082at_fn_diff_devnull "$at_stderr" || at_failed=:
2083echo >>"$at_stdout"; $as_echo "input: application/octet-stream
2084" | \
2085  $at_diff - "$at_stdout" || at_failed=:
2086at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:76"
2087$at_failed && at_fn_log_failure
2088$at_traceon; }
2089
2090  set +x
2091  $at_times_p && times >"$at_times_file"
2092) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2093read at_status <"$at_status_file"
2094#AT_STOP_2
2095#AT_START_3
2096at_fn_group_banner 3 'testsuite.at:80' \
2097  "suffixes" "                                       "
2098at_xfail=no
2099(
2100  $as_echo "3. $at_setup_line: testing $at_desc ..."
2101  $at_traceon
2102
2103
2104{ set +x
2105$as_echo "$at_srcdir/testsuite.at:80:
2106cat >mime.types <<'_ATEOF'
2107foo/x-bar bar baz
2108foo/x-qux qux quux
2109
2110_ATEOF
2111
2112
2113bf a.bar
2114
2115bf a.baz
2116
2117bf a.quux
2118
2119bf a.qx
2120
2121
2122mimeview --no-site --no-user --identify -f mime.types  a.bar a.baz a.quux a.qx
2123"
2124at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:80"
2125( $at_check_trace;
2126cat >mime.types <<'_ATEOF'
2127foo/x-bar bar baz
2128foo/x-qux qux quux
2129
2130_ATEOF
2131
2132
2133bf a.bar
2134
2135bf a.baz
2136
2137bf a.quux
2138
2139bf a.qx
2140
2141
2142mimeview --no-site --no-user --identify -f mime.types  a.bar a.baz a.quux a.qx
2143
2144) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2145at_status=$? at_failed=false
2146$at_check_filter
2147at_fn_diff_devnull "$at_stderr" || at_failed=:
2148echo >>"$at_stdout"; $as_echo "a.bar: foo/x-bar
2149a.baz: foo/x-bar
2150a.quux: foo/x-qux
2151a.qx: unknown
2152" | \
2153  $at_diff - "$at_stdout" || at_failed=:
2154at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:80"
2155$at_failed && at_fn_log_failure
2156$at_traceon; }
2157
2158  set +x
2159  $at_times_p && times >"$at_times_file"
2160) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2161read at_status <"$at_status_file"
2162#AT_STOP_3
2163#AT_START_4
2164at_fn_group_banner 4 'testsuite.at:89' \
2165  "default ordering" "                               "
2166at_xfail=no
2167(
2168  $as_echo "4. $at_setup_line: testing $at_desc ..."
2169  $at_traceon
2170
2171
2172{ set +x
2173$as_echo "$at_srcdir/testsuite.at:89:
2174cat >mime.types <<'_ATEOF'
2175text/foo bar
2176text/bar bar
2177
2178_ATEOF
2179
2180
2181bf a.bar
2182
2183
2184mimeview --no-site --no-user --identify -f mime.types  a.bar
2185"
2186at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:89"
2187( $at_check_trace;
2188cat >mime.types <<'_ATEOF'
2189text/foo bar
2190text/bar bar
2191
2192_ATEOF
2193
2194
2195bf a.bar
2196
2197
2198mimeview --no-site --no-user --identify -f mime.types  a.bar
2199
2200) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2201at_status=$? at_failed=false
2202$at_check_filter
2203at_fn_diff_devnull "$at_stderr" || at_failed=:
2204echo >>"$at_stdout"; $as_echo "a.bar: text/bar
2205" | \
2206  $at_diff - "$at_stdout" || at_failed=:
2207at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:89"
2208$at_failed && at_fn_log_failure
2209$at_traceon; }
2210
2211  set +x
2212  $at_times_p && times >"$at_times_file"
2213) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2214read at_status <"$at_status_file"
2215#AT_STOP_4
2216#AT_START_5
2217at_fn_group_banner 5 'testsuite.at:95' \
2218  "priority" "                                       "
2219at_xfail=no
2220(
2221  $as_echo "5. $at_setup_line: testing $at_desc ..."
2222  $at_traceon
2223
2224
2225{ set +x
2226$as_echo "$at_srcdir/testsuite.at:95:
2227cat >mime.types <<'_ATEOF'
2228text/bar bar
2229text/foo bar priority(20)
2230
2231_ATEOF
2232
2233
2234bf a.bar
2235
2236
2237mimeview --no-site --no-user --identify -f mime.types  a.bar
2238"
2239at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:95"
2240( $at_check_trace;
2241cat >mime.types <<'_ATEOF'
2242text/bar bar
2243text/foo bar priority(20)
2244
2245_ATEOF
2246
2247
2248bf a.bar
2249
2250
2251mimeview --no-site --no-user --identify -f mime.types  a.bar
2252
2253) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2254at_status=$? at_failed=false
2255$at_check_filter
2256at_fn_diff_devnull "$at_stderr" || at_failed=:
2257echo >>"$at_stdout"; $as_echo "a.bar: text/foo
2258" | \
2259  $at_diff - "$at_stdout" || at_failed=:
2260at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:95"
2261$at_failed && at_fn_log_failure
2262$at_traceon; }
2263
2264  set +x
2265  $at_times_p && times >"$at_times_file"
2266) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2267read at_status <"$at_status_file"
2268#AT_STOP_5
2269#AT_START_6
2270at_fn_group_banner 6 'testsuite.at:104' \
2271  "match" "                                          " 1
2272at_xfail=no
2273(
2274  $as_echo "6. $at_setup_line: testing $at_desc ..."
2275  $at_traceon
2276
2277
2278{ set +x
2279$as_echo "$at_srcdir/testsuite.at:104:
2280cat >mime.types <<'_ATEOF'
2281application/x-csource	match(*.c)
2282
2283_ATEOF
2284
2285
2286bf a.c
2287
2288bf a.c1
2289
2290
2291mimeview --no-site --no-user --identify -f mime.types  a.c a.c1
2292"
2293at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:104"
2294( $at_check_trace;
2295cat >mime.types <<'_ATEOF'
2296application/x-csource	match(*.c)
2297
2298_ATEOF
2299
2300
2301bf a.c
2302
2303bf a.c1
2304
2305
2306mimeview --no-site --no-user --identify -f mime.types  a.c a.c1
2307
2308) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2309at_status=$? at_failed=false
2310$at_check_filter
2311at_fn_diff_devnull "$at_stderr" || at_failed=:
2312echo >>"$at_stdout"; $as_echo "a.c: application/x-csource
2313a.c1: unknown
2314" | \
2315  $at_diff - "$at_stdout" || at_failed=:
2316at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:104"
2317$at_failed && at_fn_log_failure
2318$at_traceon; }
2319
2320  set +x
2321  $at_times_p && times >"$at_times_file"
2322) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2323read at_status <"$at_status_file"
2324#AT_STOP_6
2325#AT_START_7
2326at_fn_group_banner 7 'testsuite.at:112' \
2327  "ascii" "                                          " 1
2328at_xfail=no
2329(
2330  $as_echo "7. $at_setup_line: testing $at_desc ..."
2331  $at_traceon
2332
2333
2334{ set +x
2335$as_echo "$at_srcdir/testsuite.at:112:
2336cat >mime.types <<'_ATEOF'
2337application/x-bar	ascii(16,6)
2338
2339_ATEOF
2340
2341
2342bf one -seek 16 -string foobar -int 100
2343
2344bf two -seek 16 -string fooba -byte 129
2345
2346
2347mimeview --no-site --no-user --identify -f mime.types  one two
2348"
2349at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:112"
2350( $at_check_trace;
2351cat >mime.types <<'_ATEOF'
2352application/x-bar	ascii(16,6)
2353
2354_ATEOF
2355
2356
2357bf one -seek 16 -string foobar -int 100
2358
2359bf two -seek 16 -string fooba -byte 129
2360
2361
2362mimeview --no-site --no-user --identify -f mime.types  one two
2363
2364) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2365at_status=$? at_failed=false
2366$at_check_filter
2367at_fn_diff_devnull "$at_stderr" || at_failed=:
2368echo >>"$at_stdout"; $as_echo "one: application/x-bar
2369two: unknown
2370" | \
2371  $at_diff - "$at_stdout" || at_failed=:
2372at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:112"
2373$at_failed && at_fn_log_failure
2374$at_traceon; }
2375
2376  set +x
2377  $at_times_p && times >"$at_times_file"
2378) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2379read at_status <"$at_status_file"
2380#AT_STOP_7
2381#AT_START_8
2382at_fn_group_banner 8 'testsuite.at:120' \
2383  "printable" "                                      " 1
2384at_xfail=no
2385(
2386  $as_echo "8. $at_setup_line: testing $at_desc ..."
2387  $at_traceon
2388
2389
2390{ set +x
2391$as_echo "$at_srcdir/testsuite.at:120:
2392cat >mime.types <<'_ATEOF'
2393application/x-bar	printable(16,6)
2394
2395_ATEOF
2396
2397
2398bf one -seek 16 -string foobar -int 100
2399
2400bf two -seek 16 -string fooba -byte 129
2401
2402bf three -seek 16 -string fooba -byte 127
2403
2404
2405mimeview --no-site --no-user --identify -f mime.types  one two three
2406"
2407at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:120"
2408( $at_check_trace;
2409cat >mime.types <<'_ATEOF'
2410application/x-bar	printable(16,6)
2411
2412_ATEOF
2413
2414
2415bf one -seek 16 -string foobar -int 100
2416
2417bf two -seek 16 -string fooba -byte 129
2418
2419bf three -seek 16 -string fooba -byte 127
2420
2421
2422mimeview --no-site --no-user --identify -f mime.types  one two three
2423
2424) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2425at_status=$? at_failed=false
2426$at_check_filter
2427at_fn_diff_devnull "$at_stderr" || at_failed=:
2428echo >>"$at_stdout"; $as_echo "one: application/x-bar
2429two: application/x-bar
2430three: unknown
2431" | \
2432  $at_diff - "$at_stdout" || at_failed=:
2433at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:120"
2434$at_failed && at_fn_log_failure
2435$at_traceon; }
2436
2437  set +x
2438  $at_times_p && times >"$at_times_file"
2439) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2440read at_status <"$at_status_file"
2441#AT_STOP_8
2442#AT_START_9
2443at_fn_group_banner 9 'testsuite.at:128' \
2444  "regex" "                                          " 1
2445at_xfail=no
2446(
2447  $as_echo "9. $at_setup_line: testing $at_desc ..."
2448  $at_traceon
2449
2450
2451{ set +x
2452$as_echo "$at_srcdir/testsuite.at:128:
2453cat >mime.types <<'_ATEOF'
2454application/pdf    regex(0,^[\\n\\r]*%PDF)
2455
2456_ATEOF
2457
2458
2459bf one -byte 10 -byte 10 -byte 13 -byte 10 -string %PDF
2460
2461bf two -byte 10 -byte 10 -byte 13 -byte 7 -string %PDF
2462
2463
2464mimeview --no-site --no-user --identify -f mime.types  one two
2465"
2466at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:128"
2467( $at_check_trace;
2468cat >mime.types <<'_ATEOF'
2469application/pdf    regex(0,^[\n\r]*%PDF)
2470
2471_ATEOF
2472
2473
2474bf one -byte 10 -byte 10 -byte 13 -byte 10 -string %PDF
2475
2476bf two -byte 10 -byte 10 -byte 13 -byte 7 -string %PDF
2477
2478
2479mimeview --no-site --no-user --identify -f mime.types  one two
2480
2481) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2482at_status=$? at_failed=false
2483$at_check_filter
2484at_fn_diff_devnull "$at_stderr" || at_failed=:
2485echo >>"$at_stdout"; $as_echo "one: application/pdf
2486two: unknown
2487" | \
2488  $at_diff - "$at_stdout" || at_failed=:
2489at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:128"
2490$at_failed && at_fn_log_failure
2491$at_traceon; }
2492
2493  set +x
2494  $at_times_p && times >"$at_times_file"
2495) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2496read at_status <"$at_status_file"
2497#AT_STOP_9
2498#AT_START_10
2499at_fn_group_banner 10 'testsuite.at:135' \
2500  "string" "                                         " 1
2501at_xfail=no
2502(
2503  $as_echo "10. $at_setup_line: testing $at_desc ..."
2504  $at_traceon
2505
2506
2507{ set +x
2508$as_echo "$at_srcdir/testsuite.at:135:
2509cat >mime.types <<'_ATEOF'
2510application/x-foo  string(5,FOO)
2511
2512_ATEOF
2513
2514
2515bf one -seek 5 -string FOO
2516
2517bf two -seek 4 -string FOO
2518
2519
2520mimeview --no-site --no-user --identify -f mime.types  one two
2521"
2522at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:135"
2523( $at_check_trace;
2524cat >mime.types <<'_ATEOF'
2525application/x-foo  string(5,FOO)
2526
2527_ATEOF
2528
2529
2530bf one -seek 5 -string FOO
2531
2532bf two -seek 4 -string FOO
2533
2534
2535mimeview --no-site --no-user --identify -f mime.types  one two
2536
2537) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2538at_status=$? at_failed=false
2539$at_check_filter
2540at_fn_diff_devnull "$at_stderr" || at_failed=:
2541echo >>"$at_stdout"; $as_echo "one: application/x-foo
2542two: unknown
2543" | \
2544  $at_diff - "$at_stdout" || at_failed=:
2545at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:135"
2546$at_failed && at_fn_log_failure
2547$at_traceon; }
2548
2549  set +x
2550  $at_times_p && times >"$at_times_file"
2551) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2552read at_status <"$at_status_file"
2553#AT_STOP_10
2554#AT_START_11
2555at_fn_group_banner 11 'testsuite.at:143' \
2556  "istring" "                                        " 1
2557at_xfail=no
2558(
2559  $as_echo "11. $at_setup_line: testing $at_desc ..."
2560  $at_traceon
2561
2562
2563{ set +x
2564$as_echo "$at_srcdir/testsuite.at:143:
2565cat >mime.types <<'_ATEOF'
2566application/x-foo  istring(5,FOO)
2567
2568_ATEOF
2569
2570
2571bf one -seek 5 -string foO
2572
2573bf two -seek 4 -string FOO
2574
2575
2576mimeview --no-site --no-user --identify -f mime.types  one two
2577"
2578at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:143"
2579( $at_check_trace;
2580cat >mime.types <<'_ATEOF'
2581application/x-foo  istring(5,FOO)
2582
2583_ATEOF
2584
2585
2586bf one -seek 5 -string foO
2587
2588bf two -seek 4 -string FOO
2589
2590
2591mimeview --no-site --no-user --identify -f mime.types  one two
2592
2593) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2594at_status=$? at_failed=false
2595$at_check_filter
2596at_fn_diff_devnull "$at_stderr" || at_failed=:
2597echo >>"$at_stdout"; $as_echo "one: application/x-foo
2598two: unknown
2599" | \
2600  $at_diff - "$at_stdout" || at_failed=:
2601at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:143"
2602$at_failed && at_fn_log_failure
2603$at_traceon; }
2604
2605  set +x
2606  $at_times_p && times >"$at_times_file"
2607) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2608read at_status <"$at_status_file"
2609#AT_STOP_11
2610#AT_START_12
2611at_fn_group_banner 12 'testsuite.at:150' \
2612  "char" "                                           " 1
2613at_xfail=no
2614(
2615  $as_echo "12. $at_setup_line: testing $at_desc ..."
2616  $at_traceon
2617
2618
2619{ set +x
2620$as_echo "$at_srcdir/testsuite.at:150:
2621cat >mime.types <<'_ATEOF'
2622application/x-foo  char(5,15)
2623
2624_ATEOF
2625
2626
2627bf one -seek 5 -byte 15
2628
2629bf two -seek 5 -byte 1
2630
2631
2632mimeview --no-site --no-user --identify -f mime.types  one two
2633"
2634at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:150"
2635( $at_check_trace;
2636cat >mime.types <<'_ATEOF'
2637application/x-foo  char(5,15)
2638
2639_ATEOF
2640
2641
2642bf one -seek 5 -byte 15
2643
2644bf two -seek 5 -byte 1
2645
2646
2647mimeview --no-site --no-user --identify -f mime.types  one two
2648
2649) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2650at_status=$? at_failed=false
2651$at_check_filter
2652at_fn_diff_devnull "$at_stderr" || at_failed=:
2653echo >>"$at_stdout"; $as_echo "one: application/x-foo
2654two: unknown
2655" | \
2656  $at_diff - "$at_stdout" || at_failed=:
2657at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:150"
2658$at_failed && at_fn_log_failure
2659$at_traceon; }
2660
2661  set +x
2662  $at_times_p && times >"$at_times_file"
2663) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2664read at_status <"$at_status_file"
2665#AT_STOP_12
2666#AT_START_13
2667at_fn_group_banner 13 'testsuite.at:157' \
2668  "short" "                                          " 1
2669at_xfail=no
2670(
2671  $as_echo "13. $at_setup_line: testing $at_desc ..."
2672  $at_traceon
2673
2674
2675{ set +x
2676$as_echo "$at_srcdir/testsuite.at:157:
2677cat >mime.types <<'_ATEOF'
2678application/x-foo  short(5,1600)
2679
2680_ATEOF
2681
2682
2683bf one -seek 5 -short 1600
2684
2685bf two -seek 5 -short 1601
2686
2687
2688mimeview --no-site --no-user --identify -f mime.types  one two
2689"
2690at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:157"
2691( $at_check_trace;
2692cat >mime.types <<'_ATEOF'
2693application/x-foo  short(5,1600)
2694
2695_ATEOF
2696
2697
2698bf one -seek 5 -short 1600
2699
2700bf two -seek 5 -short 1601
2701
2702
2703mimeview --no-site --no-user --identify -f mime.types  one two
2704
2705) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2706at_status=$? at_failed=false
2707$at_check_filter
2708at_fn_diff_devnull "$at_stderr" || at_failed=:
2709echo >>"$at_stdout"; $as_echo "one: application/x-foo
2710two: unknown
2711" | \
2712  $at_diff - "$at_stdout" || at_failed=:
2713at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:157"
2714$at_failed && at_fn_log_failure
2715$at_traceon; }
2716
2717  set +x
2718  $at_times_p && times >"$at_times_file"
2719) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2720read at_status <"$at_status_file"
2721#AT_STOP_13
2722#AT_START_14
2723at_fn_group_banner 14 'testsuite.at:164' \
2724  "int" "                                            " 1
2725at_xfail=no
2726(
2727  $as_echo "14. $at_setup_line: testing $at_desc ..."
2728  $at_traceon
2729
2730
2731{ set +x
2732$as_echo "$at_srcdir/testsuite.at:164:
2733cat >mime.types <<'_ATEOF'
2734application/x-foo  int(5,16578)
2735
2736_ATEOF
2737
2738
2739bf one -seek 5 -int 16578
2740
2741bf two -seek 5 -int 16579
2742
2743
2744mimeview --no-site --no-user --identify -f mime.types  one two
2745"
2746at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:164"
2747( $at_check_trace;
2748cat >mime.types <<'_ATEOF'
2749application/x-foo  int(5,16578)
2750
2751_ATEOF
2752
2753
2754bf one -seek 5 -int 16578
2755
2756bf two -seek 5 -int 16579
2757
2758
2759mimeview --no-site --no-user --identify -f mime.types  one two
2760
2761) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2762at_status=$? at_failed=false
2763$at_check_filter
2764at_fn_diff_devnull "$at_stderr" || at_failed=:
2765echo >>"$at_stdout"; $as_echo "one: application/x-foo
2766two: unknown
2767" | \
2768  $at_diff - "$at_stdout" || at_failed=:
2769at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:164"
2770$at_failed && at_fn_log_failure
2771$at_traceon; }
2772
2773  set +x
2774  $at_times_p && times >"$at_times_file"
2775) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2776read at_status <"$at_status_file"
2777#AT_STOP_14
2778#AT_START_15
2779at_fn_group_banner 15 'testsuite.at:174' \
2780  "contains" "                                       " 1
2781at_xfail=no
2782(
2783  $as_echo "15. $at_setup_line: testing $at_desc ..."
2784  $at_traceon
2785
2786
2787{ set +x
2788$as_echo "$at_srcdir/testsuite.at:174:
2789cat >mime.types <<'_ATEOF'
2790application/x-foo contains(10,1024,\"TESTSTRING\")
2791
2792_ATEOF
2793
2794
2795bf one -seek 512 -string TESTSTRING
2796
2797bf two -seek 512 -string TEST
2798
2799
2800mimeview --no-site --no-user --identify -f mime.types  one two
2801"
2802at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:174"
2803( $at_check_trace;
2804cat >mime.types <<'_ATEOF'
2805application/x-foo contains(10,1024,"TESTSTRING")
2806
2807_ATEOF
2808
2809
2810bf one -seek 512 -string TESTSTRING
2811
2812bf two -seek 512 -string TEST
2813
2814
2815mimeview --no-site --no-user --identify -f mime.types  one two
2816
2817) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2818at_status=$? at_failed=false
2819$at_check_filter
2820at_fn_diff_devnull "$at_stderr" || at_failed=:
2821echo >>"$at_stdout"; $as_echo "one: application/x-foo
2822two: unknown
2823" | \
2824  $at_diff - "$at_stdout" || at_failed=:
2825at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:174"
2826$at_failed && at_fn_log_failure
2827$at_traceon; }
2828
2829  set +x
2830  $at_times_p && times >"$at_times_file"
2831) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2832read at_status <"$at_status_file"
2833#AT_STOP_15
2834#AT_START_16
2835at_fn_group_banner 16 'testsuite.at:180' \
2836  "argument strings" "                               " 1
2837at_xfail=no
2838(
2839  $as_echo "16. $at_setup_line: testing $at_desc ..."
2840  $at_traceon
2841
2842
2843{ set +x
2844$as_echo "$at_srcdir/testsuite.at:180:
2845cat >mime.types <<'_ATEOF'
2846application/x-foo string(0,\"FOO\")
2847application/x-bar string(0,'B A R')
2848application/x-baz string(0,\"B A\"Z<1B0103>BAZ)
2849application/x-qux string(0,<1B>45\" Q \"<01>)
2850
2851_ATEOF
2852
2853
2854bf one -string FOO
2855
2856bf two -string 'B A R'
2857
2858bf three -string \"B AZ\" -byte 0x1b -byte 0x01 -byte 0x03 -string BAZ
2859
2860bf four -byte 0x1b -string '45 Q ' -byte 0x01
2861
2862
2863mimeview --no-site --no-user --identify -f mime.types  one two three four
2864"
2865at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:180"
2866( $at_check_trace;
2867cat >mime.types <<'_ATEOF'
2868application/x-foo string(0,"FOO")
2869application/x-bar string(0,'B A R')
2870application/x-baz string(0,"B A"Z<1B0103>BAZ)
2871application/x-qux string(0,<1B>45" Q "<01>)
2872
2873_ATEOF
2874
2875
2876bf one -string FOO
2877
2878bf two -string 'B A R'
2879
2880bf three -string "B AZ" -byte 0x1b -byte 0x01 -byte 0x03 -string BAZ
2881
2882bf four -byte 0x1b -string '45 Q ' -byte 0x01
2883
2884
2885mimeview --no-site --no-user --identify -f mime.types  one two three four
2886
2887) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2888at_status=$? at_failed=false
2889$at_check_filter
2890at_fn_diff_devnull "$at_stderr" || at_failed=:
2891echo >>"$at_stdout"; $as_echo "one: application/x-foo
2892two: application/x-bar
2893three: application/x-baz
2894four: application/x-qux
2895" | \
2896  $at_diff - "$at_stdout" || at_failed=:
2897at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:180"
2898$at_failed && at_fn_log_failure
2899$at_traceon; }
2900
2901  set +x
2902  $at_times_p && times >"$at_times_file"
2903) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2904read at_status <"$at_status_file"
2905#AT_STOP_16
2906#AT_START_17
2907at_fn_group_banner 17 'testsuite.at:191' \
2908  "logical or" "                                     " 1
2909at_xfail=no
2910(
2911  $as_echo "17. $at_setup_line: testing $at_desc ..."
2912  $at_traceon
2913
2914
2915{ set +x
2916$as_echo "$at_srcdir/testsuite.at:191:
2917cat >mime.types <<'_ATEOF'
2918text/x-bar bar baz string(0,bar) printable(3,10)
2919
2920_ATEOF
2921
2922
2923bf one.bar
2924
2925bf one.baz
2926
2927bf foo -string bar
2928
2929bf bar -seek 3 -string teststring
2930
2931bf baz -seek 3 -string test -byte 0 -string tring
2932
2933
2934mimeview --no-site --no-user --identify -f mime.types  one.bar one.baz foo bar baz
2935"
2936at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:191"
2937( $at_check_trace;
2938cat >mime.types <<'_ATEOF'
2939text/x-bar bar baz string(0,bar) printable(3,10)
2940
2941_ATEOF
2942
2943
2944bf one.bar
2945
2946bf one.baz
2947
2948bf foo -string bar
2949
2950bf bar -seek 3 -string teststring
2951
2952bf baz -seek 3 -string test -byte 0 -string tring
2953
2954
2955mimeview --no-site --no-user --identify -f mime.types  one.bar one.baz foo bar baz
2956
2957) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2958at_status=$? at_failed=false
2959$at_check_filter
2960at_fn_diff_devnull "$at_stderr" || at_failed=:
2961echo >>"$at_stdout"; $as_echo "one.bar: text/x-bar
2962one.baz: text/x-bar
2963foo: text/x-bar
2964bar: text/x-bar
2965baz: unknown
2966" | \
2967  $at_diff - "$at_stdout" || at_failed=:
2968at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:191"
2969$at_failed && at_fn_log_failure
2970$at_traceon; }
2971
2972  set +x
2973  $at_times_p && times >"$at_times_file"
2974) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2975read at_status <"$at_status_file"
2976#AT_STOP_17
2977#AT_START_18
2978at_fn_group_banner 18 'testsuite.at:200' \
2979  "logical and" "                                    " 1
2980at_xfail=no
2981(
2982  $as_echo "18. $at_setup_line: testing $at_desc ..."
2983  $at_traceon
2984
2985
2986{ set +x
2987$as_echo "$at_srcdir/testsuite.at:200:
2988cat >mime.types <<'_ATEOF'
2989text/x-foo bar + string(0,bar<10>) + printable(4,10)
2990
2991_ATEOF
2992
2993
2994bf one.bar -string bar -byte 0x10 -string TESTSTRING
2995
2996bf one -string bar -byte 0x10 -string TESTSTRING
2997
2998bf two.bar -string bar -byte 0x13 -byte 0x10 -string TEST
2999
3000
3001mimeview --no-site --no-user --identify -f mime.types  one.bar one two.bar
3002"
3003at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:200"
3004( $at_check_trace;
3005cat >mime.types <<'_ATEOF'
3006text/x-foo bar + string(0,bar<10>) + printable(4,10)
3007
3008_ATEOF
3009
3010
3011bf one.bar -string bar -byte 0x10 -string TESTSTRING
3012
3013bf one -string bar -byte 0x10 -string TESTSTRING
3014
3015bf two.bar -string bar -byte 0x13 -byte 0x10 -string TEST
3016
3017
3018mimeview --no-site --no-user --identify -f mime.types  one.bar one two.bar
3019
3020) >>"$at_stdout" 2>>"$at_stderr" 5>&-
3021at_status=$? at_failed=false
3022$at_check_filter
3023at_fn_diff_devnull "$at_stderr" || at_failed=:
3024echo >>"$at_stdout"; $as_echo "one.bar: text/x-foo
3025one: unknown
3026two.bar: unknown
3027" | \
3028  $at_diff - "$at_stdout" || at_failed=:
3029at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:200"
3030$at_failed && at_fn_log_failure
3031$at_traceon; }
3032
3033  set +x
3034  $at_times_p && times >"$at_times_file"
3035) 5>&1 2>&1 7>&- | eval $at_tee_pipe
3036read at_status <"$at_status_file"
3037#AT_STOP_18
3038#AT_START_19
3039at_fn_group_banner 19 'testsuite.at:207' \
3040  "grouping" "                                       " 1
3041at_xfail=no
3042(
3043  $as_echo "19. $at_setup_line: testing $at_desc ..."
3044  $at_traceon
3045
3046
3047{ set +x
3048$as_echo "$at_srcdir/testsuite.at:207:
3049cat >mime.types <<'_ATEOF'
3050text/x-foo bar (string(0,bar) + printable(4,10))
3051
3052_ATEOF
3053
3054
3055bf one.bar -string foo
3056
3057bf two.baz -string bar -byte 0x10 -string TESTSTRING
3058
3059bf three -string bar -byte 0x13 -byte 0x10 -string TESTSTRING
3060
3061
3062mimeview --no-site --no-user --identify -f mime.types  one.bar two.baz three
3063"
3064at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:207"
3065( $at_check_trace;
3066cat >mime.types <<'_ATEOF'
3067text/x-foo bar (string(0,bar) + printable(4,10))
3068
3069_ATEOF
3070
3071
3072bf one.bar -string foo
3073
3074bf two.baz -string bar -byte 0x10 -string TESTSTRING
3075
3076bf three -string bar -byte 0x13 -byte 0x10 -string TESTSTRING
3077
3078
3079mimeview --no-site --no-user --identify -f mime.types  one.bar two.baz three
3080
3081) >>"$at_stdout" 2>>"$at_stderr" 5>&-
3082at_status=$? at_failed=false
3083$at_check_filter
3084at_fn_diff_devnull "$at_stderr" || at_failed=:
3085echo >>"$at_stdout"; $as_echo "one.bar: text/x-foo
3086two.baz: text/x-foo
3087three: unknown
3088" | \
3089  $at_diff - "$at_stdout" || at_failed=:
3090at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:207"
3091$at_failed && at_fn_log_failure
3092$at_traceon; }
3093
3094  set +x
3095  $at_times_p && times >"$at_times_file"
3096) 5>&1 2>&1 7>&- | eval $at_tee_pipe
3097read at_status <"$at_status_file"
3098#AT_STOP_19
3099#AT_START_20
3100at_fn_group_banner 20 'testsuite.at:214' \
3101  "error recovery" "                                 " 1
3102at_xfail=no
3103(
3104  $as_echo "20. $at_setup_line: testing $at_desc ..."
3105  $at_traceon
3106
3107
3108{ set +x
3109$as_echo "$at_srcdir/testsuite.at:214:
3110cat >mime.types <<'_ATEOF'
3111text/x-foo bar (string(0,bar) + printable(4,10))
3112   string(10,baz)
3113application/x-baz
3114
3115_ATEOF
3116
3117mimeview --no-site --no-user --debug-level=app.=trace6 -t -f mime.types
3118"
3119at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:214"
3120( $at_check_trace;
3121cat >mime.types <<'_ATEOF'
3122text/x-foo bar (string(0,bar) + printable(4,10))
3123   string(10,baz)
3124application/x-baz
3125
3126_ATEOF
3127
3128mimeview --no-site --no-user --debug-level=app.=trace6 -t -f mime.types
3129
3130) >>"$at_stdout" 2>>"$at_stderr" 5>&-
3131at_status=$? at_failed=false
3132$at_check_filter
3133echo >>"$at_stderr"; $as_echo "mimeview: mime.types:2.1: type/subtype is missing
3134mime.types:2.1: started error recovery
3135mime.types:3: finished error recovery
3136" | \
3137  $at_diff - "$at_stderr" || at_failed=:
3138at_fn_diff_devnull "$at_stdout" || at_failed=:
3139at_fn_check_status 1 $at_status "$at_srcdir/testsuite.at:214"
3140$at_failed && at_fn_log_failure
3141$at_traceon; }
3142
3143  set +x
3144  $at_times_p && times >"$at_times_file"
3145) 5>&1 2>&1 7>&- | eval $at_tee_pipe
3146read at_status <"$at_status_file"
3147#AT_STOP_20
3148#AT_START_21
3149at_fn_group_banner 21 'testsuite.at:226' \
3150  "multiple error recovery" "                        " 1
3151at_xfail=no
3152(
3153  $as_echo "21. $at_setup_line: testing $at_desc ..."
3154  $at_traceon
3155
3156
3157{ set +x
3158$as_echo "$at_srcdir/testsuite.at:226:
3159cat >mime.types <<'_ATEOF'
3160text/x-foo bar (string(0,bar) + printable(4,10))
3161   string(10,baz)
3162application/x-baz	baz
3163image/jpeg jpeg jpg jpe string(0,<FFD8FF>) &&\\
3164           (char(3,0xe0) char(3,0xe1) char(3,0xe2) char(3,0xe3)\\
3165            char(3,0xe4) char(3,0xe5) char(3,0xe6) char(3,0xe7)
3166            char(3,0xe8) char(3,0xe9) char(3,0xea) char(3,0xeb)\\
3167            char(3,0xec) char(3,0xed) char(3,0xee) char(3,0xef))
3168image/tiff                      tiff tif string(0,MM<002A>) string(0,II<2A00>)
3169
3170_ATEOF
3171
3172mimeview --no-site --no-user --debug-level=app.=trace6 -t -f mime.types
3173"
3174at_fn_check_prepare_notrace 'an embedded newline' "testsuite.at:226"
3175( $at_check_trace;
3176cat >mime.types <<'_ATEOF'
3177text/x-foo bar (string(0,bar) + printable(4,10))
3178   string(10,baz)
3179application/x-baz	baz
3180image/jpeg jpeg jpg jpe string(0,<FFD8FF>) &&\
3181           (char(3,0xe0) char(3,0xe1) char(3,0xe2) char(3,0xe3)\
3182            char(3,0xe4) char(3,0xe5) char(3,0xe6) char(3,0xe7)
3183            char(3,0xe8) char(3,0xe9) char(3,0xea) char(3,0xeb)\
3184            char(3,0xec) char(3,0xed) char(3,0xee) char(3,0xef))
3185image/tiff                      tiff tif string(0,MM<002A>) string(0,II<2A00>)
3186
3187_ATEOF
3188
3189mimeview --no-site --no-user --debug-level=app.=trace6 -t -f mime.types
3190
3191) >>"$at_stdout" 2>>"$at_stderr" 5>&-
3192at_status=$? at_failed=false
3193$at_check_filter
3194echo >>"$at_stderr"; $as_echo "mimeview: mime.types:2.1: type/subtype is missing
3195mime.types:2.1: started error recovery
3196mime.types:3: finished error recovery
3197mimeview: mime.types:6.63: syntax error
3198mime.types:6.63: started error recovery
3199mime.types:9: finished error recovery
3200" | \
3201  $at_diff - "$at_stderr" || at_failed=:
3202at_fn_diff_devnull "$at_stdout" || at_failed=:
3203at_fn_check_status 1 $at_status "$at_srcdir/testsuite.at:226"
3204$at_failed && at_fn_log_failure
3205$at_traceon; }
3206
3207  set +x
3208  $at_times_p && times >"$at_times_file"
3209) 5>&1 2>&1 7>&- | eval $at_tee_pipe
3210read at_status <"$at_status_file"
3211#AT_STOP_21
3212