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=auto
586# List of the tested programs.
587at_tested='dpkg-deb
588dpkg-split'
589# As many question marks as there are digits in the last test group number.
590# Used to normalize the test group numbers so that `ls' lists them in
591# numerical order.
592at_format='?'
593# Description of all the test groups.
594at_help_all="1;deb-format.at:3;dpkg-deb options;dpkg-deb command-line;
5952;deb-format.at:8;dpkg-deb .deb format;dpkg-deb deb;
5963;deb-content.at:3;dpkg-deb .deb conffiles;dpkg-deb deb conffiles;
5974;deb-fields.at:3;dpkg-deb .deb fields;dpkg-deb deb fields;
5985;deb-split.at:3;dpkg-split options;dpkg-split command-line;
5996;deb-split.at:8;dpkg-split .deb format;dpkg-split deb-split;
600"
601# List of the all the test groups.
602at_groups_all=`$as_echo "$at_help_all" | sed 's/;.*//'`
603
604# at_fn_validate_ranges NAME...
605# -----------------------------
606# Validate and normalize the test group number contained in each variable
607# NAME. Leading zeroes are treated as decimal.
608at_fn_validate_ranges ()
609{
610  for at_grp
611  do
612    eval at_value=\$$at_grp
613    if test $at_value -lt 1 || test $at_value -gt 6; then
614      $as_echo "invalid test group: $at_value" >&2
615      exit 1
616    fi
617    case $at_value in
618      0*) # We want to treat leading 0 as decimal, like expr and test, but
619	  # AS_VAR_ARITH treats it as octal if it uses $(( )).
620	  # With XSI shells, ${at_value#${at_value%%[1-9]*}} avoids the
621	  # expr fork, but it is not worth the effort to determine if the
622	  # shell supports XSI when the user can just avoid leading 0.
623	  eval $at_grp='`expr $at_value + 0`' ;;
624    esac
625  done
626}
627
628at_prev=
629for at_option
630do
631  # If the previous option needs an argument, assign it.
632  if test -n "$at_prev"; then
633    at_option=$at_prev=$at_option
634    at_prev=
635  fi
636
637  case $at_option in
638  *=?*) at_optarg=`expr "X$at_option" : '[^=]*=\(.*\)'` ;;
639  *)    at_optarg= ;;
640  esac
641
642  # Accept the important Cygnus configure options, so we can diagnose typos.
643
644  case $at_option in
645    --help | -h )
646	at_help_p=:
647	;;
648
649    --list | -l )
650	at_list_p=:
651	;;
652
653    --version | -V )
654	at_version_p=:
655	;;
656
657    --clean | -c )
658	at_clean=:
659	;;
660
661    --color )
662	at_color=always
663	;;
664    --color=* )
665	case $at_optarg in
666	no | never | none) at_color=never ;;
667	auto | tty | if-tty) at_color=auto ;;
668	always | yes | force) at_color=always ;;
669	*) at_optname=`echo " $at_option" | sed 's/^ //; s/=.*//'`
670	   as_fn_error $? "unrecognized argument to $at_optname: $at_optarg" ;;
671	esac
672	;;
673
674    --debug | -d )
675	at_debug_p=:
676	;;
677
678    --errexit | -e )
679	at_debug_p=:
680	at_errexit_p=:
681	;;
682
683    --verbose | -v )
684	at_verbose=; at_quiet=:
685	;;
686
687    --trace | -x )
688	at_traceon='set -x'
689	at_trace_echo=echo
690	at_check_filter_trace=at_fn_filter_trace
691	;;
692
693    [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9])
694	at_fn_validate_ranges at_option
695	as_fn_append at_groups "$at_option$as_nl"
696	;;
697
698    # Ranges
699    [0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-)
700	at_range_start=`echo $at_option |tr -d X-`
701	at_fn_validate_ranges at_range_start
702	at_range=`$as_echo "$at_groups_all" | \
703	  sed -ne '/^'$at_range_start'$/,$p'`
704	as_fn_append at_groups "$at_range$as_nl"
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_range_end=`echo $at_option |tr -d X-`
709	at_fn_validate_ranges at_range_end
710	at_range=`$as_echo "$at_groups_all" | \
711	  sed -ne '1,/^'$at_range_end'$/p'`
712	as_fn_append at_groups "$at_range$as_nl"
713	;;
714
715    [0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \
716    [0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \
717    [0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \
718    [0-9][0-9][0-9]-[0-9][0-9][0-9] | \
719    [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \
720    [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] )
721	at_range_start=`expr $at_option : '\(.*\)-'`
722	at_range_end=`expr $at_option : '.*-\(.*\)'`
723	if test $at_range_start -gt $at_range_end; then
724	  at_tmp=$at_range_end
725	  at_range_end=$at_range_start
726	  at_range_start=$at_tmp
727	fi
728	at_fn_validate_ranges at_range_start at_range_end
729	at_range=`$as_echo "$at_groups_all" | \
730	  sed -ne '/^'$at_range_start'$/,/^'$at_range_end'$/p'`
731	as_fn_append at_groups "$at_range$as_nl"
732	;;
733
734    # Directory selection.
735    --directory | -C )
736	at_prev=--directory
737	;;
738    --directory=* )
739	at_change_dir=:
740	at_dir=$at_optarg
741	if test x- = "x$at_dir" ; then
742	  at_dir=./-
743	fi
744	;;
745
746    # Parallel execution.
747    --jobs | -j )
748	at_jobs=0
749	;;
750    --jobs=* | -j[0-9]* )
751	if test -n "$at_optarg"; then
752	  at_jobs=$at_optarg
753	else
754	  at_jobs=`expr X$at_option : 'X-j\(.*\)'`
755	fi
756	case $at_jobs in *[!0-9]*)
757	  at_optname=`echo " $at_option" | sed 's/^ //; s/[0-9=].*//'`
758	  as_fn_error $? "non-numeric argument to $at_optname: $at_jobs" ;;
759	esac
760	;;
761
762    # Keywords.
763    --keywords | -k )
764	at_prev=--keywords
765	;;
766    --keywords=* )
767	at_groups_selected=$at_help_all
768	at_save_IFS=$IFS
769	IFS=,
770	set X $at_optarg
771	shift
772	IFS=$at_save_IFS
773	for at_keyword
774	do
775	  at_invert=
776	  case $at_keyword in
777	  '!'*)
778	    at_invert="-v"
779	    at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'`
780	    ;;
781	  esac
782	  # It is on purpose that we match the test group titles too.
783	  at_groups_selected=`$as_echo "$at_groups_selected" |
784	      grep -i $at_invert "^[1-9][^;]*;.*[; ]$at_keyword[ ;]"`
785	done
786	# Smash the keywords.
787	at_groups_selected=`$as_echo "$at_groups_selected" | sed 's/;.*//'`
788	as_fn_append at_groups "$at_groups_selected$as_nl"
789	;;
790    --recheck)
791	at_recheck=:
792	;;
793
794    *=*)
795	at_envvar=`expr "x$at_option" : 'x\([^=]*\)='`
796	# Reject names that are not valid shell variable names.
797	case $at_envvar in
798	  '' | [0-9]* | *[!_$as_cr_alnum]* )
799	    as_fn_error $? "invalid variable name: \`$at_envvar'" ;;
800	esac
801	at_value=`$as_echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"`
802	# Export now, but save eval for later and for debug scripts.
803	export $at_envvar
804	as_fn_append at_debug_args " $at_envvar='$at_value'"
805	;;
806
807     *) $as_echo "$as_me: invalid option: $at_option" >&2
808	$as_echo "Try \`$0 --help' for more information." >&2
809	exit 1
810	;;
811  esac
812done
813
814# Verify our last option didn't require an argument
815if test -n "$at_prev"; then :
816  as_fn_error $? "\`$at_prev' requires an argument"
817fi
818
819# The file containing the suite.
820at_suite_log=$at_dir/$as_me.log
821
822# Selected test groups.
823if test -z "$at_groups$at_recheck"; then
824  at_groups=$at_groups_all
825else
826  if test -n "$at_recheck" && test -r "$at_suite_log"; then
827    at_oldfails=`sed -n '
828      /^Failed tests:$/,/^Skipped tests:$/{
829	s/^[ ]*\([1-9][0-9]*\):.*/\1/p
830      }
831      /^Unexpected passes:$/,/^## Detailed failed tests/{
832	s/^[ ]*\([1-9][0-9]*\):.*/\1/p
833      }
834      /^## Detailed failed tests/q
835      ' "$at_suite_log"`
836    as_fn_append at_groups "$at_oldfails$as_nl"
837  fi
838  # Sort the tests, removing duplicates.
839  at_groups=`$as_echo "$at_groups" | sort -nu | sed '/^$/d'`
840fi
841
842if test x"$at_color" = xalways \
843   || { test x"$at_color" = xauto && test -t 1; }; then
844  at_red=`printf '\033[0;31m'`
845  at_grn=`printf '\033[0;32m'`
846  at_lgn=`printf '\033[1;32m'`
847  at_blu=`printf '\033[1;34m'`
848  at_std=`printf '\033[m'`
849else
850  at_red= at_grn= at_lgn= at_blu= at_std=
851fi
852
853# Help message.
854if $at_help_p; then
855  cat <<_ATEOF || at_write_fail=1
856Usage: $0 [OPTION]... [VARIABLE=VALUE]... [TESTS]
857
858Run all the tests, or the selected TESTS, given by numeric ranges, and
859save a detailed log file.  Upon failure, create debugging scripts.
860
861Do not change environment variables directly.  Instead, set them via
862command line arguments.  Set \`AUTOTEST_PATH' to select the executables
863to exercise.  Each relative directory is expanded as build and source
864directories relative to the top level of this distribution.
865E.g., from within the build directory /tmp/foo-1.0, invoking this:
866
867  $ $0 AUTOTEST_PATH=bin
868
869is equivalent to the following, assuming the source directory is /src/foo-1.0:
870
871  PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH $0
872_ATEOF
873cat <<_ATEOF || at_write_fail=1
874
875Operation modes:
876  -h, --help     print the help message, then exit
877  -V, --version  print version number, then exit
878  -c, --clean    remove all the files this test suite might create and exit
879  -l, --list     describes all the tests, or the selected TESTS
880_ATEOF
881cat <<_ATEOF || at_write_fail=1
882
883Execution tuning:
884  -C, --directory=DIR
885                 change to directory DIR before starting
886      --color[=never|auto|always]
887                 disable colored test results, or enable even without terminal
888  -j, --jobs[=N]
889                 Allow N jobs at once; infinite jobs with no arg (default 1)
890  -k, --keywords=KEYWORDS
891                 select the tests matching all the comma-separated KEYWORDS
892                 multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD
893      --recheck  select all tests that failed or passed unexpectedly last time
894  -e, --errexit  abort as soon as a test fails; implies --debug
895  -v, --verbose  force more detailed output
896                 default for debugging scripts
897  -d, --debug    inhibit clean up and top-level logging
898                 default for debugging scripts
899  -x, --trace    enable tests shell tracing
900_ATEOF
901cat <<_ATEOF || at_write_fail=1
902
903Report bugs to <debian-dpkg@lists.debian.org>.
904dpkg home page: <https://wiki.debian.org/Teams/Dpkg>.
905_ATEOF
906  exit $at_write_fail
907fi
908
909# List of tests.
910if $at_list_p; then
911  cat <<_ATEOF || at_write_fail=1
912dpkg 1.19.7 test suite: dpkg tools functional test suite test groups:
913
914 NUM: FILE-NAME:LINE     TEST-GROUP-NAME
915      KEYWORDS
916
917_ATEOF
918  # Pass an empty line as separator between selected groups and help.
919  $as_echo "$at_groups$as_nl$as_nl$at_help_all" |
920    awk 'NF == 1 && FS != ";" {
921	   selected[$ 1] = 1
922	   next
923	 }
924	 /^$/ { FS = ";" }
925	 NF > 0 {
926	   if (selected[$ 1]) {
927	     printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3
928	     if ($ 4) {
929	       lmax = 79
930	       indent = "     "
931	       line = indent
932	       len = length (line)
933	       n = split ($ 4, a, " ")
934	       for (i = 1; i <= n; i++) {
935		 l = length (a[i]) + 1
936		 if (i > 1 && len + l > lmax) {
937		   print line
938		   line = indent " " a[i]
939		   len = length (line)
940		 } else {
941		   line = line " " a[i]
942		   len += l
943		 }
944	       }
945	       if (n)
946		 print line
947	     }
948	   }
949	 }' || at_write_fail=1
950  exit $at_write_fail
951fi
952if $at_version_p; then
953  $as_echo "$as_me (dpkg 1.19.7)" &&
954  cat <<\_ATEOF || at_write_fail=1
955
956Copyright (C) 2012 Free Software Foundation, Inc.
957This test suite is free software; the Free Software Foundation gives
958unlimited permission to copy, distribute and modify it.
959_ATEOF
960  exit $at_write_fail
961fi
962
963# Should we print banners?  Yes if more than one test is run.
964case $at_groups in #(
965  *$as_nl* )
966      at_print_banners=: ;; #(
967  * ) at_print_banners=false ;;
968esac
969# Text for banner N, set to a single space once printed.
970# Banner 1. testsuite.at:4
971# Category starts at test group 1.
972at_banner_text_1="Binary .deb packages"
973# Banner 2. testsuite.at:9
974# Category starts at test group 5.
975at_banner_text_2="Split .deb packages"
976
977# Take any -C into account.
978if $at_change_dir ; then
979  test x != "x$at_dir" && cd "$at_dir" \
980    || as_fn_error $? "unable to change directory"
981  at_dir=`pwd`
982fi
983
984# Load the config files for any default variable assignments.
985for at_file in atconfig atlocal
986do
987  test -r $at_file || continue
988  . ./$at_file || as_fn_error $? "invalid content: $at_file"
989done
990
991# Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix:
992: "${at_top_build_prefix=$at_top_builddir}"
993
994# Perform any assignments requested during argument parsing.
995eval "$at_debug_args"
996
997# atconfig delivers names relative to the directory the test suite is
998# in, but the groups themselves are run in testsuite-dir/group-dir.
999if test -n "$at_top_srcdir"; then
1000  builddir=../..
1001  for at_dir_var in srcdir top_srcdir top_build_prefix
1002  do
1003    eval at_val=\$at_$at_dir_var
1004    case $at_val in
1005      [\\/$]* | ?:[\\/]* ) at_prefix= ;;
1006      *) at_prefix=../../ ;;
1007    esac
1008    eval "$at_dir_var=\$at_prefix\$at_val"
1009  done
1010fi
1011
1012## -------------------- ##
1013## Directory structure. ##
1014## -------------------- ##
1015
1016# This is the set of directories and files used by this script
1017# (non-literals are capitalized):
1018#
1019# TESTSUITE         - the testsuite
1020# TESTSUITE.log     - summarizes the complete testsuite run
1021# TESTSUITE.dir/    - created during a run, remains after -d or failed test
1022# + at-groups/      - during a run: status of all groups in run
1023# | + NNN/          - during a run: meta-data about test group NNN
1024# | | + check-line  - location (source file and line) of current AT_CHECK
1025# | | + status      - exit status of current AT_CHECK
1026# | | + stdout      - stdout of current AT_CHECK
1027# | | + stder1      - stderr, including trace
1028# | | + stderr      - stderr, with trace filtered out
1029# | | + test-source - portion of testsuite that defines group
1030# | | + times       - timestamps for computing duration
1031# | | + pass        - created if group passed
1032# | | + xpass       - created if group xpassed
1033# | | + fail        - created if group failed
1034# | | + xfail       - created if group xfailed
1035# | | + skip        - created if group skipped
1036# + at-stop         - during a run: end the run if this file exists
1037# + at-source-lines - during a run: cache of TESTSUITE line numbers for extraction
1038# + 0..NNN/         - created for each group NNN, remains after -d or failed test
1039# | + TESTSUITE.log - summarizes the group results
1040# | + ...           - files created during the group
1041
1042# The directory the whole suite works in.
1043# Should be absolute to let the user `cd' at will.
1044at_suite_dir=$at_dir/$as_me.dir
1045# The file containing the suite ($at_dir might have changed since earlier).
1046at_suite_log=$at_dir/$as_me.log
1047# The directory containing helper files per test group.
1048at_helper_dir=$at_suite_dir/at-groups
1049# Stop file: if it exists, do not start new jobs.
1050at_stop_file=$at_suite_dir/at-stop
1051# The fifo used for the job dispatcher.
1052at_job_fifo=$at_suite_dir/at-job-fifo
1053
1054if $at_clean; then
1055  test -d "$at_suite_dir" &&
1056    find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
1057  rm -f -r "$at_suite_dir" "$at_suite_log"
1058  exit $?
1059fi
1060
1061# Don't take risks: use only absolute directories in PATH.
1062#
1063# For stand-alone test suites (ie. atconfig was not found),
1064# AUTOTEST_PATH is relative to `.'.
1065#
1066# For embedded test suites, AUTOTEST_PATH is relative to the top level
1067# of the package.  Then expand it into build/src parts, since users
1068# may create executables in both places.
1069AUTOTEST_PATH=`$as_echo "$AUTOTEST_PATH" | sed "s|:|$PATH_SEPARATOR|g"`
1070at_path=
1071as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1072for as_dir in $AUTOTEST_PATH $PATH
1073do
1074  IFS=$as_save_IFS
1075  test -z "$as_dir" && as_dir=.
1076    test -n "$at_path" && as_fn_append at_path $PATH_SEPARATOR
1077case $as_dir in
1078  [\\/]* | ?:[\\/]* )
1079    as_fn_append at_path "$as_dir"
1080    ;;
1081  * )
1082    if test -z "$at_top_build_prefix"; then
1083      # Stand-alone test suite.
1084      as_fn_append at_path "$as_dir"
1085    else
1086      # Embedded test suite.
1087      as_fn_append at_path "$at_top_build_prefix$as_dir$PATH_SEPARATOR"
1088      as_fn_append at_path "$at_top_srcdir/$as_dir"
1089    fi
1090    ;;
1091esac
1092  done
1093IFS=$as_save_IFS
1094
1095
1096# Now build and simplify PATH.
1097#
1098# There might be directories that don't exist, but don't redirect
1099# builtins' (eg., cd) stderr directly: Ultrix's sh hates that.
1100at_new_path=
1101as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1102for as_dir in $at_path
1103do
1104  IFS=$as_save_IFS
1105  test -z "$as_dir" && as_dir=.
1106    test -d "$as_dir" || continue
1107case $as_dir in
1108  [\\/]* | ?:[\\/]* ) ;;
1109  * ) as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` ;;
1110esac
1111case $PATH_SEPARATOR$at_new_path$PATH_SEPARATOR in
1112  *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR*) ;;
1113  $PATH_SEPARATOR$PATH_SEPARATOR) at_new_path=$as_dir ;;
1114  *) as_fn_append at_new_path "$PATH_SEPARATOR$as_dir" ;;
1115esac
1116  done
1117IFS=$as_save_IFS
1118
1119PATH=$at_new_path
1120export PATH
1121
1122# Setting up the FDs.
1123
1124
1125
1126# 5 is the log file.  Not to be overwritten if `-d'.
1127if $at_debug_p; then
1128  at_suite_log=/dev/null
1129else
1130  : >"$at_suite_log"
1131fi
1132exec 5>>"$at_suite_log"
1133
1134# Banners and logs.
1135$as_echo "## --------------------------------------------------------- ##
1136## dpkg 1.19.7 test suite: dpkg tools functional test suite. ##
1137## --------------------------------------------------------- ##"
1138{
1139  $as_echo "## --------------------------------------------------------- ##
1140## dpkg 1.19.7 test suite: dpkg tools functional test suite. ##
1141## --------------------------------------------------------- ##"
1142  echo
1143
1144  $as_echo "$as_me: command line was:"
1145  $as_echo "  \$ $0 $at_cli_args"
1146  echo
1147
1148  # If ChangeLog exists, list a few lines in case it might help determining
1149  # the exact version.
1150  if test -n "$at_top_srcdir" && test -f "$at_top_srcdir/ChangeLog"; then
1151    $as_echo "## ---------- ##
1152## ChangeLog. ##
1153## ---------- ##"
1154    echo
1155    sed 's/^/| /;10q' "$at_top_srcdir/ChangeLog"
1156    echo
1157  fi
1158
1159  {
1160cat <<_ASUNAME
1161## --------- ##
1162## Platform. ##
1163## --------- ##
1164
1165hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
1166uname -m = `(uname -m) 2>/dev/null || echo unknown`
1167uname -r = `(uname -r) 2>/dev/null || echo unknown`
1168uname -s = `(uname -s) 2>/dev/null || echo unknown`
1169uname -v = `(uname -v) 2>/dev/null || echo unknown`
1170
1171/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
1172/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
1173
1174/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
1175/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
1176/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
1177/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
1178/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
1179/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
1180/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
1181
1182_ASUNAME
1183
1184as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1185for as_dir in $PATH
1186do
1187  IFS=$as_save_IFS
1188  test -z "$as_dir" && as_dir=.
1189    $as_echo "PATH: $as_dir"
1190  done
1191IFS=$as_save_IFS
1192
1193}
1194  echo
1195
1196  # Contents of the config files.
1197  for at_file in atconfig atlocal
1198  do
1199    test -r $at_file || continue
1200    $as_echo "$as_me: $at_file:"
1201    sed 's/^/| /' $at_file
1202    echo
1203  done
1204} >&5
1205
1206
1207## ------------------------- ##
1208## Autotest shell functions. ##
1209## ------------------------- ##
1210
1211# at_fn_banner NUMBER
1212# -------------------
1213# Output banner NUMBER, provided the testsuite is running multiple groups and
1214# this particular banner has not yet been printed.
1215at_fn_banner ()
1216{
1217  $at_print_banners || return 0
1218  eval at_banner_text=\$at_banner_text_$1
1219  test "x$at_banner_text" = "x " && return 0
1220  eval "at_banner_text_$1=\" \""
1221  if test -z "$at_banner_text"; then
1222    $at_first || echo
1223  else
1224    $as_echo "$as_nl$at_banner_text$as_nl"
1225  fi
1226} # at_fn_banner
1227
1228# at_fn_check_prepare_notrace REASON LINE
1229# ---------------------------------------
1230# Perform AT_CHECK preparations for the command at LINE for an untraceable
1231# command; REASON is the reason for disabling tracing.
1232at_fn_check_prepare_notrace ()
1233{
1234  $at_trace_echo "Not enabling shell tracing (command contains $1)"
1235  $as_echo "$2" >"$at_check_line_file"
1236  at_check_trace=: at_check_filter=:
1237  : >"$at_stdout"; : >"$at_stderr"
1238}
1239
1240# at_fn_check_prepare_trace LINE
1241# ------------------------------
1242# Perform AT_CHECK preparations for the command at LINE for a traceable
1243# command.
1244at_fn_check_prepare_trace ()
1245{
1246  $as_echo "$1" >"$at_check_line_file"
1247  at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace
1248  : >"$at_stdout"; : >"$at_stderr"
1249}
1250
1251# at_fn_check_prepare_dynamic COMMAND LINE
1252# ----------------------------------------
1253# Decide if COMMAND at LINE is traceable at runtime, and call the appropriate
1254# preparation function.
1255at_fn_check_prepare_dynamic ()
1256{
1257  case $1 in
1258    *$as_nl*)
1259      at_fn_check_prepare_notrace 'an embedded newline' "$2" ;;
1260    *)
1261      at_fn_check_prepare_trace "$2" ;;
1262  esac
1263}
1264
1265# at_fn_filter_trace
1266# ------------------
1267# Remove the lines in the file "$at_stderr" generated by "set -x" and print
1268# them to stderr.
1269at_fn_filter_trace ()
1270{
1271  mv "$at_stderr" "$at_stder1"
1272  grep '^ *+' "$at_stder1" >&2
1273  grep -v '^ *+' "$at_stder1" >"$at_stderr"
1274}
1275
1276# at_fn_log_failure FILE-LIST
1277# ---------------------------
1278# Copy the files in the list on stdout with a "> " prefix, and exit the shell
1279# with a failure exit code.
1280at_fn_log_failure ()
1281{
1282  for file
1283    do $as_echo "$file:"; sed 's/^/> /' "$file"; done
1284  echo 1 > "$at_status_file"
1285  exit 1
1286}
1287
1288# at_fn_check_skip EXIT-CODE LINE
1289# -------------------------------
1290# Check whether EXIT-CODE is a special exit code (77 or 99), and if so exit
1291# the test group subshell with that same exit code. Use LINE in any report
1292# about test failure.
1293at_fn_check_skip ()
1294{
1295  case $1 in
1296    99) echo 99 > "$at_status_file"; at_failed=:
1297	$as_echo "$2: hard failure"; exit 99;;
1298    77) echo 77 > "$at_status_file"; exit 77;;
1299  esac
1300}
1301
1302# at_fn_check_status EXPECTED EXIT-CODE LINE
1303# ------------------------------------------
1304# Check whether EXIT-CODE is the EXPECTED exit code, and if so do nothing.
1305# Otherwise, if it is 77 or 99, exit the test group subshell with that same
1306# exit code; if it is anything else print an error message referring to LINE,
1307# and fail the test.
1308at_fn_check_status ()
1309{
1310  case $2 in
1311    $1 ) ;;
1312    77) echo 77 > "$at_status_file"; exit 77;;
1313    99) echo 99 > "$at_status_file"; at_failed=:
1314	$as_echo "$3: hard failure"; exit 99;;
1315    *) $as_echo "$3: exit code was $2, expected $1"
1316      at_failed=:;;
1317  esac
1318}
1319
1320# at_fn_diff_devnull FILE
1321# -----------------------
1322# Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless diff
1323# invocations.
1324at_fn_diff_devnull ()
1325{
1326  test -s "$1" || return 0
1327  $at_diff "$at_devnull" "$1"
1328}
1329
1330# at_fn_test NUMBER
1331# -----------------
1332# Parse out test NUMBER from the tail of this file.
1333at_fn_test ()
1334{
1335  eval at_sed=\$at_sed$1
1336  sed "$at_sed" "$at_myself" > "$at_test_source"
1337}
1338
1339# at_fn_create_debugging_script
1340# -----------------------------
1341# Create the debugging script $at_group_dir/run which will reproduce the
1342# current test group.
1343at_fn_create_debugging_script ()
1344{
1345  {
1346    echo "#! /bin/sh" &&
1347    echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$@"}'\''='\''"$@"'\''' &&
1348    $as_echo "cd '$at_dir'" &&
1349    $as_echo "exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d $at_debug_args $at_group \${1+\"\$@\"}" &&
1350    echo 'exit 1'
1351  } >"$at_group_dir/run" &&
1352  chmod +x "$at_group_dir/run"
1353}
1354
1355## -------------------------------- ##
1356## End of autotest shell functions. ##
1357## -------------------------------- ##
1358{
1359  $as_echo "## ---------------- ##
1360## Tested programs. ##
1361## ---------------- ##"
1362  echo
1363} >&5
1364
1365# Report what programs are being tested.
1366for at_program in : $at_tested
1367do
1368  test "$at_program" = : && continue
1369  case $at_program in
1370    [\\/]* | ?:[\\/]* ) $at_program_=$at_program ;;
1371    * )
1372    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1373for as_dir in $PATH
1374do
1375  IFS=$as_save_IFS
1376  test -z "$as_dir" && as_dir=.
1377    test -f "$as_dir/$at_program" && break
1378  done
1379IFS=$as_save_IFS
1380
1381    at_program_=$as_dir/$at_program ;;
1382  esac
1383  if test -f "$at_program_"; then
1384    {
1385      $as_echo "$at_srcdir/testsuite.at:1: $at_program_ --version"
1386      "$at_program_" --version </dev/null
1387      echo
1388    } >&5 2>&1
1389  else
1390    as_fn_error $? "cannot find $at_program" "$LINENO" 5
1391  fi
1392done
1393
1394{
1395  $as_echo "## ------------------ ##
1396## Running the tests. ##
1397## ------------------ ##"
1398} >&5
1399
1400at_start_date=`date`
1401at_start_time=`date +%s 2>/dev/null`
1402$as_echo "$as_me: starting at: $at_start_date" >&5
1403
1404# Create the master directory if it doesn't already exist.
1405as_dir="$at_suite_dir"; as_fn_mkdir_p ||
1406  as_fn_error $? "cannot create \`$at_suite_dir'" "$LINENO" 5
1407
1408# Can we diff with `/dev/null'?  DU 5.0 refuses.
1409if diff /dev/null /dev/null >/dev/null 2>&1; then
1410  at_devnull=/dev/null
1411else
1412  at_devnull=$at_suite_dir/devnull
1413  >"$at_devnull"
1414fi
1415
1416# Use `diff -u' when possible.
1417if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff"
1418then
1419  at_diff='diff -u'
1420else
1421  at_diff=diff
1422fi
1423
1424# Get the last needed group.
1425for at_group in : $at_groups; do :; done
1426
1427# Extract the start and end lines of each test group at the tail
1428# of this file
1429awk '
1430BEGIN { FS="" }
1431/^#AT_START_/ {
1432  start = NR
1433}
1434/^#AT_STOP_/ {
1435  test = substr ($ 0, 10)
1436  print "at_sed" test "=\"1," start "d;" (NR-1) "q\""
1437  if (test == "'"$at_group"'") exit
1438}' "$at_myself" > "$at_suite_dir/at-source-lines" &&
1439. "$at_suite_dir/at-source-lines" ||
1440  as_fn_error $? "cannot create test line number cache" "$LINENO" 5
1441rm -f "$at_suite_dir/at-source-lines"
1442
1443# Set number of jobs for `-j'; avoid more jobs than test groups.
1444set X $at_groups; shift; at_max_jobs=$#
1445if test $at_max_jobs -eq 0; then
1446  at_jobs=1
1447fi
1448if test $at_jobs -ne 1 &&
1449   { test $at_jobs -eq 0 || test $at_jobs -gt $at_max_jobs; }; then
1450  at_jobs=$at_max_jobs
1451fi
1452
1453# If parallel mode, don't output banners, don't split summary lines.
1454if test $at_jobs -ne 1; then
1455  at_print_banners=false
1456  at_quiet=:
1457fi
1458
1459# Set up helper dirs.
1460rm -rf "$at_helper_dir" &&
1461mkdir "$at_helper_dir" &&
1462cd "$at_helper_dir" &&
1463{ test -z "$at_groups" || mkdir $at_groups; } ||
1464as_fn_error $? "testsuite directory setup failed" "$LINENO" 5
1465
1466# Functions for running a test group.  We leave the actual
1467# test group execution outside of a shell function in order
1468# to avoid hitting zsh 4.x exit status bugs.
1469
1470# at_fn_group_prepare
1471# -------------------
1472# Prepare for running a test group.
1473at_fn_group_prepare ()
1474{
1475  # The directory for additional per-group helper files.
1476  at_job_dir=$at_helper_dir/$at_group
1477  # The file containing the location of the last AT_CHECK.
1478  at_check_line_file=$at_job_dir/check-line
1479  # The file containing the exit status of the last command.
1480  at_status_file=$at_job_dir/status
1481  # The files containing the output of the tested commands.
1482  at_stdout=$at_job_dir/stdout
1483  at_stder1=$at_job_dir/stder1
1484  at_stderr=$at_job_dir/stderr
1485  # The file containing the code for a test group.
1486  at_test_source=$at_job_dir/test-source
1487  # The file containing dates.
1488  at_times_file=$at_job_dir/times
1489
1490  # Be sure to come back to the top test directory.
1491  cd "$at_suite_dir"
1492
1493  # Clearly separate the test groups when verbose.
1494  $at_first || $at_verbose echo
1495
1496  at_group_normalized=$at_group
1497
1498  eval 'while :; do
1499    case $at_group_normalized in #(
1500    '"$at_format"'*) break;;
1501    esac
1502    at_group_normalized=0$at_group_normalized
1503  done'
1504
1505
1506  # Create a fresh directory for the next test group, and enter.
1507  # If one already exists, the user may have invoked ./run from
1508  # within that directory; we remove the contents, but not the
1509  # directory itself, so that we aren't pulling the rug out from
1510  # under the shell's notion of the current directory.
1511  at_group_dir=$at_suite_dir/$at_group_normalized
1512  at_group_log=$at_group_dir/$as_me.log
1513  if test -d "$at_group_dir"; then
1514  find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx {} \;
1515  rm -fr "$at_group_dir"/* "$at_group_dir"/.[!.] "$at_group_dir"/.??*
1516fi ||
1517    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test directory for $at_group_normalized could not be cleaned" >&5
1518$as_echo "$as_me: WARNING: test directory for $at_group_normalized could not be cleaned" >&2;}
1519  # Be tolerant if the above `rm' was not able to remove the directory.
1520  as_dir="$at_group_dir"; as_fn_mkdir_p
1521
1522  echo 0 > "$at_status_file"
1523
1524  # In verbose mode, append to the log file *and* show on
1525  # the standard output; in quiet mode only write to the log.
1526  if test -z "$at_verbose"; then
1527    at_tee_pipe='tee -a "$at_group_log"'
1528  else
1529    at_tee_pipe='cat >> "$at_group_log"'
1530  fi
1531}
1532
1533# at_fn_group_banner ORDINAL LINE DESC PAD [BANNER]
1534# -------------------------------------------------
1535# Declare the test group ORDINAL, located at LINE with group description DESC,
1536# and residing under BANNER. Use PAD to align the status column.
1537at_fn_group_banner ()
1538{
1539  at_setup_line="$2"
1540  test -n "$5" && at_fn_banner $5
1541  at_desc="$3"
1542  case $1 in
1543    [0-9])      at_desc_line="  $1: ";;
1544    [0-9][0-9]) at_desc_line=" $1: " ;;
1545    *)          at_desc_line="$1: "  ;;
1546  esac
1547  as_fn_append at_desc_line "$3$4"
1548  $at_quiet $as_echo_n "$at_desc_line"
1549  echo "#                             -*- compilation -*-" >> "$at_group_log"
1550}
1551
1552# at_fn_group_postprocess
1553# -----------------------
1554# Perform cleanup after running a test group.
1555at_fn_group_postprocess ()
1556{
1557  # Be sure to come back to the suite directory, in particular
1558  # since below we might `rm' the group directory we are in currently.
1559  cd "$at_suite_dir"
1560
1561  if test ! -f "$at_check_line_file"; then
1562    sed "s/^ */$as_me: WARNING: /" <<_ATEOF
1563      A failure happened in a test group before any test could be
1564      run. This means that test suite is improperly designed.  Please
1565      report this failure to <debian-dpkg@lists.debian.org>.
1566_ATEOF
1567    $as_echo "$at_setup_line" >"$at_check_line_file"
1568    at_status=99
1569  fi
1570  $at_verbose $as_echo_n "$at_group. $at_setup_line: "
1571  $as_echo_n "$at_group. $at_setup_line: " >> "$at_group_log"
1572  case $at_xfail:$at_status in
1573    yes:0)
1574	at_msg="UNEXPECTED PASS"
1575	at_res=xpass
1576	at_errexit=$at_errexit_p
1577	at_color=$at_red
1578	;;
1579    no:0)
1580	at_msg="ok"
1581	at_res=pass
1582	at_errexit=false
1583	at_color=$at_grn
1584	;;
1585    *:77)
1586	at_msg='skipped ('`cat "$at_check_line_file"`')'
1587	at_res=skip
1588	at_errexit=false
1589	at_color=$at_blu
1590	;;
1591    no:* | *:99)
1592	at_msg='FAILED ('`cat "$at_check_line_file"`')'
1593	at_res=fail
1594	at_errexit=$at_errexit_p
1595	at_color=$at_red
1596	;;
1597    yes:*)
1598	at_msg='expected failure ('`cat "$at_check_line_file"`')'
1599	at_res=xfail
1600	at_errexit=false
1601	at_color=$at_lgn
1602	;;
1603  esac
1604  echo "$at_res" > "$at_job_dir/$at_res"
1605  # In parallel mode, output the summary line only afterwards.
1606  if test $at_jobs -ne 1 && test -n "$at_verbose"; then
1607    $as_echo "$at_desc_line $at_color$at_msg$at_std"
1608  else
1609    # Make sure there is a separator even with long titles.
1610    $as_echo " $at_color$at_msg$at_std"
1611  fi
1612  at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg"
1613  case $at_status in
1614    0|77)
1615      # $at_times_file is only available if the group succeeded.
1616      # We're not including the group log, so the success message
1617      # is written in the global log separately.  But we also
1618      # write to the group log in case they're using -d.
1619      if test -f "$at_times_file"; then
1620	at_log_msg="$at_log_msg     ("`sed 1d "$at_times_file"`')'
1621	rm -f "$at_times_file"
1622      fi
1623      $as_echo "$at_log_msg" >> "$at_group_log"
1624      $as_echo "$at_log_msg" >&5
1625
1626      # Cleanup the group directory, unless the user wants the files
1627      # or the success was unexpected.
1628      if $at_debug_p || test $at_res = xpass; then
1629	at_fn_create_debugging_script
1630	if test $at_res = xpass && $at_errexit; then
1631	  echo stop > "$at_stop_file"
1632	fi
1633      else
1634	if test -d "$at_group_dir"; then
1635	  find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
1636	  rm -fr "$at_group_dir"
1637	fi
1638	rm -f "$at_test_source"
1639      fi
1640      ;;
1641    *)
1642      # Upon failure, include the log into the testsuite's global
1643      # log.  The failure message is written in the group log.  It
1644      # is later included in the global log.
1645      $as_echo "$at_log_msg" >> "$at_group_log"
1646
1647      # Upon failure, keep the group directory for autopsy, and create
1648      # the debugging script.  With -e, do not start any further tests.
1649      at_fn_create_debugging_script
1650      if $at_errexit; then
1651	echo stop > "$at_stop_file"
1652      fi
1653      ;;
1654  esac
1655}
1656
1657
1658## ------------ ##
1659## Driver loop. ##
1660## ------------ ##
1661
1662
1663if (set -m && set +m && set +b) >/dev/null 2>&1; then
1664  set +b
1665  at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=-
1666else
1667  at_job_control_on=: at_job_control_off=: at_job_group=
1668fi
1669
1670for at_signal in 1 2 15; do
1671  trap 'set +x; set +e
1672	$at_job_control_off
1673	at_signal='"$at_signal"'
1674	echo stop > "$at_stop_file"
1675	trap "" $at_signal
1676	at_pgids=
1677	for at_pgid in `jobs -p 2>/dev/null`; do
1678	  at_pgids="$at_pgids $at_job_group$at_pgid"
1679	done
1680	test -z "$at_pgids" || kill -$at_signal $at_pgids 2>/dev/null
1681	wait
1682	if test "$at_jobs" -eq 1 || test -z "$at_verbose"; then
1683	  echo >&2
1684	fi
1685	at_signame=`kill -l $at_signal 2>&1 || echo $at_signal`
1686	set x $at_signame
1687	test 1 -gt 2 && at_signame=$at_signal
1688	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: caught signal $at_signame, bailing out" >&5
1689$as_echo "$as_me: WARNING: caught signal $at_signame, bailing out" >&2;}
1690	as_fn_arith 128 + $at_signal && exit_status=$as_val
1691	as_fn_exit $exit_status' $at_signal
1692done
1693
1694rm -f "$at_stop_file"
1695at_first=:
1696
1697if test $at_jobs -ne 1 &&
1698     rm -f "$at_job_fifo" &&
1699     test -n "$at_job_group" &&
1700     ( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null
1701then
1702  # FIFO job dispatcher.
1703
1704  trap 'at_pids=
1705	for at_pid in `jobs -p`; do
1706	  at_pids="$at_pids $at_job_group$at_pid"
1707	done
1708	if test -n "$at_pids"; then
1709	  at_sig=TSTP
1710	  test "${TMOUT+set}" = set && at_sig=STOP
1711	  kill -$at_sig $at_pids 2>/dev/null
1712	fi
1713	kill -STOP $$
1714	test -z "$at_pids" || kill -CONT $at_pids 2>/dev/null' TSTP
1715
1716  echo
1717  # Turn jobs into a list of numbers, starting from 1.
1718  at_joblist=`$as_echo "$at_groups" | sed -n 1,${at_jobs}p`
1719
1720  set X $at_joblist
1721  shift
1722  for at_group in $at_groups; do
1723    $at_job_control_on 2>/dev/null
1724    (
1725      # Start one test group.
1726      $at_job_control_off
1727      if $at_first; then
1728	exec 7>"$at_job_fifo"
1729      else
1730	exec 6<&-
1731      fi
1732      trap 'set +x; set +e
1733	    trap "" PIPE
1734	    echo stop > "$at_stop_file"
1735	    echo >&7
1736	    as_fn_exit 141' PIPE
1737      at_fn_group_prepare
1738      if cd "$at_group_dir" &&
1739	 at_fn_test $at_group &&
1740	 . "$at_test_source"
1741      then :; else
1742	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5
1743$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;}
1744	at_failed=:
1745      fi
1746      at_fn_group_postprocess
1747      echo >&7
1748    ) &
1749    $at_job_control_off
1750    if $at_first; then
1751      at_first=false
1752      exec 6<"$at_job_fifo" 7>"$at_job_fifo"
1753    fi
1754    shift # Consume one token.
1755    if test $# -gt 0; then :; else
1756      read at_token <&6 || break
1757      set x $*
1758    fi
1759    test -f "$at_stop_file" && break
1760  done
1761  exec 7>&-
1762  # Read back the remaining ($at_jobs - 1) tokens.
1763  set X $at_joblist
1764  shift
1765  if test $# -gt 0; then
1766    shift
1767    for at_job
1768    do
1769      read at_token
1770    done <&6
1771  fi
1772  exec 6<&-
1773  wait
1774else
1775  # Run serially, avoid forks and other potential surprises.
1776  for at_group in $at_groups; do
1777    at_fn_group_prepare
1778    if cd "$at_group_dir" &&
1779       at_fn_test $at_group &&
1780       . "$at_test_source"; then :; else
1781      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5
1782$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;}
1783      at_failed=:
1784    fi
1785    at_fn_group_postprocess
1786    test -f "$at_stop_file" && break
1787    at_first=false
1788  done
1789fi
1790
1791# Wrap up the test suite with summary statistics.
1792cd "$at_helper_dir"
1793
1794# Use ?..???? when the list must remain sorted, the faster * otherwise.
1795at_pass_list=`for f in */pass; do echo $f; done | sed '/\*/d; s,/pass,,'`
1796at_skip_list=`for f in */skip; do echo $f; done | sed '/\*/d; s,/skip,,'`
1797at_xfail_list=`for f in */xfail; do echo $f; done | sed '/\*/d; s,/xfail,,'`
1798at_xpass_list=`for f in ?/xpass ??/xpass ???/xpass ????/xpass; do
1799		 echo $f; done | sed '/?/d; s,/xpass,,'`
1800at_fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do
1801		echo $f; done | sed '/?/d; s,/fail,,'`
1802
1803set X $at_pass_list $at_xpass_list $at_xfail_list $at_fail_list $at_skip_list
1804shift; at_group_count=$#
1805set X $at_xpass_list; shift; at_xpass_count=$#; at_xpass_list=$*
1806set X $at_xfail_list; shift; at_xfail_count=$#
1807set X $at_fail_list; shift; at_fail_count=$#; at_fail_list=$*
1808set X $at_skip_list; shift; at_skip_count=$#
1809
1810as_fn_arith $at_group_count - $at_skip_count && at_run_count=$as_val
1811as_fn_arith $at_xpass_count + $at_fail_count && at_unexpected_count=$as_val
1812as_fn_arith $at_xfail_count + $at_fail_count && at_total_fail_count=$as_val
1813
1814# Back to the top directory.
1815cd "$at_dir"
1816rm -rf "$at_helper_dir"
1817
1818# Compute the duration of the suite.
1819at_stop_date=`date`
1820at_stop_time=`date +%s 2>/dev/null`
1821$as_echo "$as_me: ending at: $at_stop_date" >&5
1822case $at_start_time,$at_stop_time in
1823  [0-9]*,[0-9]*)
1824    as_fn_arith $at_stop_time - $at_start_time && at_duration_s=$as_val
1825    as_fn_arith $at_duration_s / 60 && at_duration_m=$as_val
1826    as_fn_arith $at_duration_m / 60 && at_duration_h=$as_val
1827    as_fn_arith $at_duration_s % 60 && at_duration_s=$as_val
1828    as_fn_arith $at_duration_m % 60 && at_duration_m=$as_val
1829    at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
1830    $as_echo "$as_me: test suite duration: $at_duration" >&5
1831    ;;
1832esac
1833
1834echo
1835$as_echo "## ------------- ##
1836## Test results. ##
1837## ------------- ##"
1838echo
1839{
1840  echo
1841  $as_echo "## ------------- ##
1842## Test results. ##
1843## ------------- ##"
1844  echo
1845} >&5
1846
1847if test $at_run_count = 1; then
1848  at_result="1 test"
1849  at_were=was
1850else
1851  at_result="$at_run_count tests"
1852  at_were=were
1853fi
1854if $at_errexit_p && test $at_unexpected_count != 0; then
1855  if test $at_xpass_count = 1; then
1856    at_result="$at_result $at_were run, one passed"
1857  else
1858    at_result="$at_result $at_were run, one failed"
1859  fi
1860  at_result="$at_result unexpectedly and inhibited subsequent tests."
1861  at_color=$at_red
1862else
1863  # Don't you just love exponential explosion of the number of cases?
1864  at_color=$at_red
1865  case $at_xpass_count:$at_fail_count:$at_xfail_count in
1866    # So far, so good.
1867    0:0:0) at_result="$at_result $at_were successful." at_color=$at_grn ;;
1868    0:0:*) at_result="$at_result behaved as expected." at_color=$at_lgn ;;
1869
1870    # Some unexpected failures
1871    0:*:0) at_result="$at_result $at_were run,
1872$at_fail_count failed unexpectedly." ;;
1873
1874    # Some failures, both expected and unexpected
1875    0:*:1) at_result="$at_result $at_were run,
1876$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
1877    0:*:*) at_result="$at_result $at_were run,
1878$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
1879
1880    # No unexpected failures, but some xpasses
1881    *:0:*) at_result="$at_result $at_were run,
1882$at_xpass_count passed unexpectedly." ;;
1883
1884    # No expected failures, but failures and xpasses
1885    *:1:0) at_result="$at_result $at_were run,
1886$at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;;
1887    *:*:0) at_result="$at_result $at_were run,
1888$at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;;
1889
1890    # All of them.
1891    *:*:1) at_result="$at_result $at_were run,
1892$at_xpass_count passed unexpectedly,
1893$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
1894    *:*:*) at_result="$at_result $at_were run,
1895$at_xpass_count passed unexpectedly,
1896$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
1897  esac
1898
1899  if test $at_skip_count = 0 && test $at_run_count -gt 1; then
1900    at_result="All $at_result"
1901  fi
1902fi
1903
1904# Now put skips in the mix.
1905case $at_skip_count in
1906  0) ;;
1907  1) at_result="$at_result
19081 test was skipped." ;;
1909  *) at_result="$at_result
1910$at_skip_count tests were skipped." ;;
1911esac
1912
1913if test $at_unexpected_count = 0; then
1914  echo "$at_color$at_result$at_std"
1915  echo "$at_result" >&5
1916else
1917  echo "${at_color}ERROR: $at_result$at_std" >&2
1918  echo "ERROR: $at_result" >&5
1919  {
1920    echo
1921    $as_echo "## ------------------------ ##
1922## Summary of the failures. ##
1923## ------------------------ ##"
1924
1925    # Summary of failed and skipped tests.
1926    if test $at_fail_count != 0; then
1927      echo "Failed tests:"
1928      $SHELL "$at_myself" $at_fail_list --list
1929      echo
1930    fi
1931    if test $at_skip_count != 0; then
1932      echo "Skipped tests:"
1933      $SHELL "$at_myself" $at_skip_list --list
1934      echo
1935    fi
1936    if test $at_xpass_count != 0; then
1937      echo "Unexpected passes:"
1938      $SHELL "$at_myself" $at_xpass_list --list
1939      echo
1940    fi
1941    if test $at_fail_count != 0; then
1942      $as_echo "## ---------------------- ##
1943## Detailed failed tests. ##
1944## ---------------------- ##"
1945      echo
1946      for at_group in $at_fail_list
1947      do
1948	at_group_normalized=$at_group
1949
1950  eval 'while :; do
1951    case $at_group_normalized in #(
1952    '"$at_format"'*) break;;
1953    esac
1954    at_group_normalized=0$at_group_normalized
1955  done'
1956
1957	cat "$at_suite_dir/$at_group_normalized/$as_me.log"
1958	echo
1959      done
1960      echo
1961    fi
1962    if test -n "$at_top_srcdir"; then
1963      sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
1964## ${at_top_build_prefix}config.log ##
1965_ASBOX
1966      sed 's/^/| /' ${at_top_build_prefix}config.log
1967      echo
1968    fi
1969  } >&5
1970
1971  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
1972## $as_me.log was created. ##
1973_ASBOX
1974
1975  echo
1976  if $at_debug_p; then
1977    at_msg='per-test log files'
1978  else
1979    at_msg="\`${at_testdir+${at_testdir}/}$as_me.log'"
1980  fi
1981  $as_echo "Please send $at_msg and all information you think might help:
1982
1983   To: <debian-dpkg@lists.debian.org>
1984   Subject: [dpkg 1.19.7] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}
1985
1986You may investigate any problem if you feel able to do so, in which
1987case the test suite provides a good starting point.  Its output may
1988be found below \`${at_testdir+${at_testdir}/}$as_me.dir'.
1989"
1990  exit 1
1991fi
1992
1993exit 0
1994
1995## ------------- ##
1996## Actual tests. ##
1997## ------------- ##
1998#AT_START_1
1999at_fn_group_banner 1 'deb-format.at:3' \
2000  "dpkg-deb options" "                               " 1
2001at_xfail=no
2002(
2003  $as_echo "1. $at_setup_line: testing $at_desc ..."
2004  $at_traceon
2005
2006
2007{ set +x
2008$as_echo "$at_srcdir/deb-format.at:5: dpkg-deb --help"
2009at_fn_check_prepare_trace "deb-format.at:5"
2010( $at_check_trace; dpkg-deb --help
2011) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2012at_status=$? at_failed=false
2013$at_check_filter
2014at_fn_diff_devnull "$at_stderr" || at_failed=:
2015echo stdout:; cat "$at_stdout"
2016at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:5"
2017$at_failed && at_fn_log_failure
2018$at_traceon; }
2019
2020  set +x
2021  $at_times_p && times >"$at_times_file"
2022) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2023read at_status <"$at_status_file"
2024#AT_STOP_1
2025#AT_START_2
2026at_fn_group_banner 2 'deb-format.at:8' \
2027  "dpkg-deb .deb format" "                           " 1
2028at_xfail=no
2029(
2030  $as_echo "2. $at_setup_line: testing $at_desc ..."
2031  $at_traceon
2032
2033
2034
2035
2036  mkdir -p 'pkg-deb-format/DEBIAN'
2037
2038  cat >'pkg-deb-format/DEBIAN/control' <<CTRL_TEMPL
2039Package: pkg-deb-format
2040Version: 0.0-1
2041Section: test
2042Priority: extra
2043Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2044Architecture: all
2045Description: test package
2046CTRL_TEMPL
2047
2048
2049  sed -i -e 's/^Description:.*$/& - deb format support/' 'pkg-deb-format/DEBIAN/control'
2050
2051cat >pkg-deb-format/file-templ <<'_ATEOF'
2052test
2053_ATEOF
2054
2055{ set +x
2056$as_echo "$at_srcdir/deb-format.at:16:
2057# Initialize the template package
2058mv pkg-deb-format pkg-templ
2059chmod -R u+w pkg-templ
2060find pkg-templ | xargs touch -t 197001010100.00
2061dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null
2062
2063# Extract the base members
2064ar x pkg-templ.deb
2065gzip -c control.tar >control.tar.gz
2066gzip -c data.tar >data.tar.gz
2067xz -c control.tar >control.tar.xz
2068xz -c data.tar >data.tar.xz
2069bzip2 -c data.tar >data.tar.bz2
2070lzma -c data.tar >data.tar.lzma
2071touch _ignore
2072touch unknown
2073"
2074at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:16"
2075( $at_check_trace;
2076# Initialize the template package
2077mv pkg-deb-format pkg-templ
2078chmod -R u+w pkg-templ
2079find pkg-templ | xargs touch -t 197001010100.00
2080dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null
2081
2082# Extract the base members
2083ar x pkg-templ.deb
2084gzip -c control.tar >control.tar.gz
2085gzip -c data.tar >data.tar.gz
2086xz -c control.tar >control.tar.xz
2087xz -c data.tar >data.tar.xz
2088bzip2 -c data.tar >data.tar.bz2
2089lzma -c data.tar >data.tar.lzma
2090touch _ignore
2091touch unknown
2092
2093) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2094at_status=$? at_failed=false
2095$at_check_filter
2096at_fn_diff_devnull "$at_stderr" || at_failed=:
2097at_fn_diff_devnull "$at_stdout" || at_failed=:
2098at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:16"
2099$at_failed && at_fn_log_failure
2100$at_traceon; }
2101
2102
2103{ set +x
2104$as_echo "$at_srcdir/deb-format.at:35:
2105# Test debian-binary with 2.x versions
2106cp pkg-templ.deb pkg-version-2x.deb
2107echo 2.999 >debian-binary
2108ar rc pkg-version-2x.deb debian-binary
2109ar t pkg-version-2x.deb
2110ar x pkg-templ.deb debian-binary
2111# XXX: Ideally we would have no need to strip trailing spaces.
2112dpkg-deb -I pkg-version-2x.deb | sed -e 's/ *\$//'
2113"
2114at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:35"
2115( $at_check_trace;
2116# Test debian-binary with 2.x versions
2117cp pkg-templ.deb pkg-version-2x.deb
2118echo 2.999 >debian-binary
2119ar rc pkg-version-2x.deb debian-binary
2120ar t pkg-version-2x.deb
2121ar x pkg-templ.deb debian-binary
2122# XXX: Ideally we would have no need to strip trailing spaces.
2123dpkg-deb -I pkg-version-2x.deb | sed -e 's/ *$//'
2124
2125) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2126at_status=$? at_failed=false
2127$at_check_filter
2128at_fn_diff_devnull "$at_stderr" || at_failed=:
2129echo >>"$at_stdout"; $as_echo "debian-binary
2130control.tar
2131data.tar
2132 new Debian package, version 2.999.
2133 size 20674 bytes: control archive=10240 bytes.
2134     193 bytes,     7 lines      control
2135 Package: pkg-deb-format
2136 Version: 0.0-1
2137 Section: test
2138 Priority: extra
2139 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2140 Architecture: all
2141 Description: test package - deb format support
2142" | \
2143  $at_diff - "$at_stdout" || at_failed=:
2144at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:35"
2145$at_failed && at_fn_log_failure
2146$at_traceon; }
2147
2148
2149{ set +x
2150$as_echo "$at_srcdir/deb-format.at:59:
2151# Test debian-binary with extra lines
2152cp pkg-templ.deb pkg-magic-extra.deb
2153echo \"extra line\" >>debian-binary
2154ar rc pkg-magic-extra.deb debian-binary
2155ar t pkg-magic-extra.deb
2156ar x pkg-templ.deb debian-binary
2157# XXX: Ideally we would have no need to strip trailing spaces.
2158dpkg-deb -I pkg-magic-extra.deb | sed -e 's/ *\$//'
2159"
2160at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:59"
2161( $at_check_trace;
2162# Test debian-binary with extra lines
2163cp pkg-templ.deb pkg-magic-extra.deb
2164echo "extra line" >>debian-binary
2165ar rc pkg-magic-extra.deb debian-binary
2166ar t pkg-magic-extra.deb
2167ar x pkg-templ.deb debian-binary
2168# XXX: Ideally we would have no need to strip trailing spaces.
2169dpkg-deb -I pkg-magic-extra.deb | sed -e 's/ *$//'
2170
2171) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2172at_status=$? at_failed=false
2173$at_check_filter
2174at_fn_diff_devnull "$at_stderr" || at_failed=:
2175echo >>"$at_stdout"; $as_echo "debian-binary
2176control.tar
2177data.tar
2178 new Debian package, version 2.0.
2179 size 20684 bytes: control archive=10240 bytes.
2180     193 bytes,     7 lines      control
2181 Package: pkg-deb-format
2182 Version: 0.0-1
2183 Section: test
2184 Priority: extra
2185 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2186 Architecture: all
2187 Description: test package - deb format support
2188" | \
2189  $at_diff - "$at_stdout" || at_failed=:
2190at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:59"
2191$at_failed && at_fn_log_failure
2192$at_traceon; }
2193
2194
2195{ set +x
2196$as_echo "$at_srcdir/deb-format.at:83:
2197# Test missing debian-binary member
2198cp pkg-templ.deb pkg-missing-magic.deb
2199ar d pkg-missing-magic.deb debian-binary
2200ar t pkg-missing-magic.deb
2201dpkg-deb -I pkg-missing-magic.deb
2202"
2203at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:83"
2204( $at_check_trace;
2205# Test missing debian-binary member
2206cp pkg-templ.deb pkg-missing-magic.deb
2207ar d pkg-missing-magic.deb debian-binary
2208ar t pkg-missing-magic.deb
2209dpkg-deb -I pkg-missing-magic.deb
2210
2211) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2212at_status=$? at_failed=false
2213$at_check_filter
2214echo >>"$at_stderr"; $as_echo "dpkg-deb: error: file 'pkg-missing-magic.deb' is not a Debian binary archive (try dpkg-split?)
2215" | \
2216  $at_diff - "$at_stderr" || at_failed=:
2217echo >>"$at_stdout"; $as_echo "control.tar
2218data.tar
2219" | \
2220  $at_diff - "$at_stdout" || at_failed=:
2221at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:83"
2222$at_failed && at_fn_log_failure
2223$at_traceon; }
2224
2225
2226{ set +x
2227$as_echo "$at_srcdir/deb-format.at:94:
2228# Test missing control member
2229cp pkg-templ.deb pkg-missing-control.deb
2230ar d pkg-missing-control.deb control.tar
2231ar t pkg-missing-control.deb
2232dpkg-deb -I pkg-missing-control.deb
2233"
2234at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:94"
2235( $at_check_trace;
2236# Test missing control member
2237cp pkg-templ.deb pkg-missing-control.deb
2238ar d pkg-missing-control.deb control.tar
2239ar t pkg-missing-control.deb
2240dpkg-deb -I pkg-missing-control.deb
2241
2242) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2243at_status=$? at_failed=false
2244$at_check_filter
2245echo >>"$at_stderr"; $as_echo "dpkg-deb: error: archive 'pkg-missing-control.deb' has premature member 'data.tar' before 'control.tar', giving up
2246" | \
2247  $at_diff - "$at_stderr" || at_failed=:
2248echo >>"$at_stdout"; $as_echo "debian-binary
2249data.tar
2250" | \
2251  $at_diff - "$at_stdout" || at_failed=:
2252at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:94"
2253$at_failed && at_fn_log_failure
2254$at_traceon; }
2255
2256
2257{ set +x
2258$as_echo "$at_srcdir/deb-format.at:105:
2259# Test missing data member
2260cp pkg-templ.deb pkg-missing-data.deb
2261ar d pkg-missing-data.deb data.tar
2262ar t pkg-missing-data.deb
2263dpkg-deb -c pkg-missing-data.deb
2264"
2265at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:105"
2266( $at_check_trace;
2267# Test missing data member
2268cp pkg-templ.deb pkg-missing-data.deb
2269ar d pkg-missing-data.deb data.tar
2270ar t pkg-missing-data.deb
2271dpkg-deb -c pkg-missing-data.deb
2272
2273) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2274at_status=$? at_failed=false
2275$at_check_filter
2276echo >>"$at_stderr"; $as_echo "dpkg-deb: error: unexpected end of file in archive member header in pkg-missing-data.deb
2277" | \
2278  $at_diff - "$at_stderr" || at_failed=:
2279echo >>"$at_stdout"; $as_echo "debian-binary
2280control.tar
2281" | \
2282  $at_diff - "$at_stdout" || at_failed=:
2283at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:105"
2284$at_failed && at_fn_log_failure
2285$at_traceon; }
2286
2287
2288{ set +x
2289$as_echo "$at_srcdir/deb-format.at:116:
2290# Test mixed member (index 1)
2291cp pkg-templ.deb pkg-mixed-1-member.deb
2292ar ra debian-binary pkg-mixed-1-member.deb unknown
2293ar t pkg-mixed-1-member.deb
2294dpkg-deb -I pkg-mixed-1-member.deb
2295"
2296at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:116"
2297( $at_check_trace;
2298# Test mixed member (index 1)
2299cp pkg-templ.deb pkg-mixed-1-member.deb
2300ar ra debian-binary pkg-mixed-1-member.deb unknown
2301ar t pkg-mixed-1-member.deb
2302dpkg-deb -I pkg-mixed-1-member.deb
2303
2304) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2305at_status=$? at_failed=false
2306$at_check_filter
2307echo >>"$at_stderr"; $as_echo "dpkg-deb: error: archive 'pkg-mixed-1-member.deb' has premature member 'unknown' before 'control.tar', giving up
2308" | \
2309  $at_diff - "$at_stderr" || at_failed=:
2310echo >>"$at_stdout"; $as_echo "debian-binary
2311unknown
2312control.tar
2313data.tar
2314" | \
2315  $at_diff - "$at_stdout" || at_failed=:
2316at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:116"
2317$at_failed && at_fn_log_failure
2318$at_traceon; }
2319
2320
2321{ set +x
2322$as_echo "$at_srcdir/deb-format.at:129:
2323# Test mixed member (index 2)
2324cp pkg-templ.deb pkg-mixed-2-member.deb
2325ar ra control.tar pkg-mixed-2-member.deb unknown
2326ar t pkg-mixed-2-member.deb
2327dpkg-deb -c pkg-mixed-2-member.deb
2328"
2329at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:129"
2330( $at_check_trace;
2331# Test mixed member (index 2)
2332cp pkg-templ.deb pkg-mixed-2-member.deb
2333ar ra control.tar pkg-mixed-2-member.deb unknown
2334ar t pkg-mixed-2-member.deb
2335dpkg-deb -c pkg-mixed-2-member.deb
2336
2337) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2338at_status=$? at_failed=false
2339$at_check_filter
2340echo >>"$at_stderr"; $as_echo "dpkg-deb: error: archive 'pkg-mixed-2-member.deb' has premature member 'unknown' before 'data.tar', giving up
2341" | \
2342  $at_diff - "$at_stderr" || at_failed=:
2343echo >>"$at_stdout"; $as_echo "debian-binary
2344control.tar
2345unknown
2346data.tar
2347" | \
2348  $at_diff - "$at_stdout" || at_failed=:
2349at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:129"
2350$at_failed && at_fn_log_failure
2351$at_traceon; }
2352
2353
2354{ set +x
2355$as_echo "$at_srcdir/deb-format.at:142:
2356# Test swapped control and data members
2357cp pkg-templ.deb pkg-swap-members.deb
2358ar ma data.tar pkg-swap-members.deb control.tar
2359ar t pkg-swap-members.deb
2360dpkg-deb -I pkg-swap-members.deb
2361"
2362at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:142"
2363( $at_check_trace;
2364# Test swapped control and data members
2365cp pkg-templ.deb pkg-swap-members.deb
2366ar ma data.tar pkg-swap-members.deb control.tar
2367ar t pkg-swap-members.deb
2368dpkg-deb -I pkg-swap-members.deb
2369
2370) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2371at_status=$? at_failed=false
2372$at_check_filter
2373echo >>"$at_stderr"; $as_echo "dpkg-deb: error: archive 'pkg-swap-members.deb' has premature member 'data.tar' before 'control.tar', giving up
2374" | \
2375  $at_diff - "$at_stderr" || at_failed=:
2376echo >>"$at_stdout"; $as_echo "debian-binary
2377data.tar
2378control.tar
2379" | \
2380  $at_diff - "$at_stdout" || at_failed=:
2381at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:142"
2382$at_failed && at_fn_log_failure
2383$at_traceon; }
2384
2385
2386{ set +x
2387$as_echo "$at_srcdir/deb-format.at:154:
2388# Test extra member
2389cp pkg-templ.deb pkg-extra-member.deb
2390ar q pkg-extra-member.deb unknown
2391ar t pkg-extra-member.deb
2392# XXX: Ideally we would have no need to strip trailing spaces.
2393dpkg-deb -I pkg-extra-member.deb | sed -e 's/ *\$//'
2394"
2395at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:154"
2396( $at_check_trace;
2397# Test extra member
2398cp pkg-templ.deb pkg-extra-member.deb
2399ar q pkg-extra-member.deb unknown
2400ar t pkg-extra-member.deb
2401# XXX: Ideally we would have no need to strip trailing spaces.
2402dpkg-deb -I pkg-extra-member.deb | sed -e 's/ *$//'
2403
2404) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2405at_status=$? at_failed=false
2406$at_check_filter
2407at_fn_diff_devnull "$at_stderr" || at_failed=:
2408echo >>"$at_stdout"; $as_echo "debian-binary
2409control.tar
2410data.tar
2411unknown
2412 new Debian package, version 2.0.
2413 size 20732 bytes: control archive=10240 bytes.
2414     193 bytes,     7 lines      control
2415 Package: pkg-deb-format
2416 Version: 0.0-1
2417 Section: test
2418 Priority: extra
2419 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2420 Architecture: all
2421 Description: test package - deb format support
2422" | \
2423  $at_diff - "$at_stdout" || at_failed=:
2424at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:154"
2425$at_failed && at_fn_log_failure
2426$at_traceon; }
2427
2428
2429{ set +x
2430$as_echo "$at_srcdir/deb-format.at:177:
2431# Test _ member
2432cp pkg-templ.deb pkg-under-member.deb
2433ar ra debian-binary pkg-under-member.deb _ignore
2434ar t pkg-under-member.deb
2435# XXX: Ideally we would have no need to strip trailing spaces.
2436dpkg-deb -I pkg-under-member.deb | sed -e 's/ *\$//'
2437"
2438at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:177"
2439( $at_check_trace;
2440# Test _ member
2441cp pkg-templ.deb pkg-under-member.deb
2442ar ra debian-binary pkg-under-member.deb _ignore
2443ar t pkg-under-member.deb
2444# XXX: Ideally we would have no need to strip trailing spaces.
2445dpkg-deb -I pkg-under-member.deb | sed -e 's/ *$//'
2446
2447) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2448at_status=$? at_failed=false
2449$at_check_filter
2450at_fn_diff_devnull "$at_stderr" || at_failed=:
2451echo >>"$at_stdout"; $as_echo "debian-binary
2452_ignore
2453control.tar
2454data.tar
2455 new Debian package, version 2.0.
2456 size 20732 bytes: control archive=10240 bytes.
2457     193 bytes,     7 lines      control
2458 Package: pkg-deb-format
2459 Version: 0.0-1
2460 Section: test
2461 Priority: extra
2462 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2463 Architecture: all
2464 Description: test package - deb format support
2465" | \
2466  $at_diff - "$at_stdout" || at_failed=:
2467at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:177"
2468$at_failed && at_fn_log_failure
2469$at_traceon; }
2470
2471
2472{ set +x
2473$as_echo "$at_srcdir/deb-format.at:200:
2474# Test data.tar.bad member
2475dd if=/dev/zero of=data.tar.bad bs=1K count=4 status=none
2476ar rc pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad
2477ar t pkg-data-bad.deb
2478dpkg-deb -c pkg-data-bad.deb
2479"
2480at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:200"
2481( $at_check_trace;
2482# Test data.tar.bad member
2483dd if=/dev/zero of=data.tar.bad bs=1K count=4 status=none
2484ar rc pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad
2485ar t pkg-data-bad.deb
2486dpkg-deb -c pkg-data-bad.deb
2487
2488) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2489at_status=$? at_failed=false
2490$at_check_filter
2491echo >>"$at_stderr"; $as_echo "dpkg-deb: error: archive 'pkg-data-bad.deb' uses unknown compression for member 'data.tar.bad', giving up
2492" | \
2493  $at_diff - "$at_stderr" || at_failed=:
2494echo >>"$at_stdout"; $as_echo "debian-binary
2495control.tar.gz
2496data.tar.bad
2497" | \
2498  $at_diff - "$at_stdout" || at_failed=:
2499at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:200"
2500$at_failed && at_fn_log_failure
2501$at_traceon; }
2502
2503
2504{ set +x
2505$as_echo "$at_srcdir/deb-format.at:212:
2506# Test control.tar member
2507ar rc pkg-control-none.deb debian-binary control.tar data.tar
2508ar t pkg-control-none.deb
2509# XXX: Ideally we would have no need to strip trailing spaces.
2510dpkg-deb -I pkg-control-none.deb | sed -e 's/ *\$//'
2511"
2512at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:212"
2513( $at_check_trace;
2514# Test control.tar member
2515ar rc pkg-control-none.deb debian-binary control.tar data.tar
2516ar t pkg-control-none.deb
2517# XXX: Ideally we would have no need to strip trailing spaces.
2518dpkg-deb -I pkg-control-none.deb | sed -e 's/ *$//'
2519
2520) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2521at_status=$? at_failed=false
2522$at_check_filter
2523at_fn_diff_devnull "$at_stderr" || at_failed=:
2524echo >>"$at_stdout"; $as_echo "debian-binary
2525control.tar
2526data.tar
2527 new Debian package, version 2.0.
2528 size 20672 bytes: control archive=10240 bytes.
2529     193 bytes,     7 lines      control
2530 Package: pkg-deb-format
2531 Version: 0.0-1
2532 Section: test
2533 Priority: extra
2534 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2535 Architecture: all
2536 Description: test package - deb format support
2537" | \
2538  $at_diff - "$at_stdout" || at_failed=:
2539at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:212"
2540$at_failed && at_fn_log_failure
2541$at_traceon; }
2542
2543
2544{ set +x
2545$as_echo "$at_srcdir/deb-format.at:233:
2546# Test control.tar.xz member
2547ar rc pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz
2548ar t pkg-control-xz.deb
2549dpkg-deb -c pkg-control-xz.deb
2550"
2551at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:233"
2552( $at_check_trace;
2553# Test control.tar.xz member
2554ar rc pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz
2555ar t pkg-control-xz.deb
2556dpkg-deb -c pkg-control-xz.deb
2557
2558) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2559at_status=$? at_failed=false
2560$at_check_filter
2561at_fn_diff_devnull "$at_stderr" || at_failed=:
2562echo >>"$at_stdout"; $as_echo "debian-binary
2563control.tar.xz
2564data.tar.xz
2565drwxr-xr-x root/root         0 1970-01-01 00:00 ./
2566-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
2567" | \
2568  $at_diff - "$at_stdout" || at_failed=:
2569at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:233"
2570$at_failed && at_fn_log_failure
2571$at_traceon; }
2572
2573
2574{ set +x
2575$as_echo "$at_srcdir/deb-format.at:245:
2576# Test data.tar member
2577ar rc pkg-data-none.deb debian-binary control.tar.gz data.tar
2578ar t pkg-data-none.deb
2579dpkg-deb -c pkg-data-none.deb
2580"
2581at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:245"
2582( $at_check_trace;
2583# Test data.tar member
2584ar rc pkg-data-none.deb debian-binary control.tar.gz data.tar
2585ar t pkg-data-none.deb
2586dpkg-deb -c pkg-data-none.deb
2587
2588) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2589at_status=$? at_failed=false
2590$at_check_filter
2591at_fn_diff_devnull "$at_stderr" || at_failed=:
2592echo >>"$at_stdout"; $as_echo "debian-binary
2593control.tar.gz
2594data.tar
2595drwxr-xr-x root/root         0 1970-01-01 00:00 ./
2596-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
2597" | \
2598  $at_diff - "$at_stdout" || at_failed=:
2599at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:245"
2600$at_failed && at_fn_log_failure
2601$at_traceon; }
2602
2603
2604{ set +x
2605$as_echo "$at_srcdir/deb-format.at:257:
2606# Test data.tar.gz member
2607ar rc pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz
2608ar t pkg-data-gz.deb
2609dpkg-deb -c pkg-data-gz.deb
2610"
2611at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:257"
2612( $at_check_trace;
2613# Test data.tar.gz member
2614ar rc pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz
2615ar t pkg-data-gz.deb
2616dpkg-deb -c pkg-data-gz.deb
2617
2618) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2619at_status=$? at_failed=false
2620$at_check_filter
2621at_fn_diff_devnull "$at_stderr" || at_failed=:
2622echo >>"$at_stdout"; $as_echo "debian-binary
2623control.tar.gz
2624data.tar.gz
2625drwxr-xr-x root/root         0 1970-01-01 00:00 ./
2626-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
2627" | \
2628  $at_diff - "$at_stdout" || at_failed=:
2629at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:257"
2630$at_failed && at_fn_log_failure
2631$at_traceon; }
2632
2633
2634{ set +x
2635$as_echo "$at_srcdir/deb-format.at:269:
2636# Test data.tar.xz member
2637ar rc pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz
2638ar t pkg-data-xz.deb
2639dpkg-deb -c pkg-data-xz.deb
2640"
2641at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:269"
2642( $at_check_trace;
2643# Test data.tar.xz member
2644ar rc pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz
2645ar t pkg-data-xz.deb
2646dpkg-deb -c pkg-data-xz.deb
2647
2648) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2649at_status=$? at_failed=false
2650$at_check_filter
2651at_fn_diff_devnull "$at_stderr" || at_failed=:
2652echo >>"$at_stdout"; $as_echo "debian-binary
2653control.tar.gz
2654data.tar.xz
2655drwxr-xr-x root/root         0 1970-01-01 00:00 ./
2656-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
2657" | \
2658  $at_diff - "$at_stdout" || at_failed=:
2659at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:269"
2660$at_failed && at_fn_log_failure
2661$at_traceon; }
2662
2663
2664{ set +x
2665$as_echo "$at_srcdir/deb-format.at:281:
2666# Test data.tar.bz2 member
2667ar rc pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2
2668ar t pkg-data-bz2.deb
2669dpkg-deb -c pkg-data-bz2.deb
2670"
2671at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:281"
2672( $at_check_trace;
2673# Test data.tar.bz2 member
2674ar rc pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2
2675ar t pkg-data-bz2.deb
2676dpkg-deb -c pkg-data-bz2.deb
2677
2678) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2679at_status=$? at_failed=false
2680$at_check_filter
2681at_fn_diff_devnull "$at_stderr" || at_failed=:
2682echo >>"$at_stdout"; $as_echo "debian-binary
2683control.tar.gz
2684data.tar.bz2
2685drwxr-xr-x root/root         0 1970-01-01 00:00 ./
2686-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
2687" | \
2688  $at_diff - "$at_stdout" || at_failed=:
2689at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:281"
2690$at_failed && at_fn_log_failure
2691$at_traceon; }
2692
2693
2694{ set +x
2695$as_echo "$at_srcdir/deb-format.at:293:
2696# Test data.tar.lzma member
2697ar rc pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma
2698ar t pkg-data-lzma.deb
2699dpkg-deb -c pkg-data-lzma.deb
2700"
2701at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:293"
2702( $at_check_trace;
2703# Test data.tar.lzma member
2704ar rc pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma
2705ar t pkg-data-lzma.deb
2706dpkg-deb -c pkg-data-lzma.deb
2707
2708) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2709at_status=$? at_failed=false
2710$at_check_filter
2711at_fn_diff_devnull "$at_stderr" || at_failed=:
2712echo >>"$at_stdout"; $as_echo "debian-binary
2713control.tar.gz
2714data.tar.lzma
2715drwxr-xr-x root/root         0 1970-01-01 00:00 ./
2716-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
2717" | \
2718  $at_diff - "$at_stdout" || at_failed=:
2719at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:293"
2720$at_failed && at_fn_log_failure
2721$at_traceon; }
2722
2723
2724{ set +x
2725$as_echo "$at_srcdir/deb-format.at:305:
2726# Test non-uniform data.tar/control.tar member compression
2727ar rc pkg-mixed-comp.deb debian-binary control.tar.xz data.tar.gz
2728ar t pkg-mixed-comp.deb
2729# XXX: Ideally we would have no need to strip trailing spaces.
2730dpkg-deb -I pkg-mixed-comp.deb | sed -e 's/ *\$//'
2731dpkg-deb -c pkg-mixed-comp.deb
2732"
2733at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:305"
2734( $at_check_trace;
2735# Test non-uniform data.tar/control.tar member compression
2736ar rc pkg-mixed-comp.deb debian-binary control.tar.xz data.tar.gz
2737ar t pkg-mixed-comp.deb
2738# XXX: Ideally we would have no need to strip trailing spaces.
2739dpkg-deb -I pkg-mixed-comp.deb | sed -e 's/ *$//'
2740dpkg-deb -c pkg-mixed-comp.deb
2741
2742) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2743at_status=$? at_failed=false
2744$at_check_filter
2745at_fn_diff_devnull "$at_stderr" || at_failed=:
2746echo >>"$at_stdout"; $as_echo "debian-binary
2747control.tar.xz
2748data.tar.gz
2749 new Debian package, version 2.0.
2750 size 682 bytes: control archive=336 bytes.
2751     193 bytes,     7 lines      control
2752 Package: pkg-deb-format
2753 Version: 0.0-1
2754 Section: test
2755 Priority: extra
2756 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2757 Architecture: all
2758 Description: test package - deb format support
2759drwxr-xr-x root/root         0 1970-01-01 00:00 ./
2760-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
2761" | \
2762  $at_diff - "$at_stdout" || at_failed=:
2763at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:305"
2764$at_failed && at_fn_log_failure
2765$at_traceon; }
2766
2767
2768  set +x
2769  $at_times_p && times >"$at_times_file"
2770) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2771read at_status <"$at_status_file"
2772#AT_STOP_2
2773#AT_START_3
2774at_fn_group_banner 3 'deb-content.at:3' \
2775  "dpkg-deb .deb conffiles" "                        " 1
2776at_xfail=no
2777(
2778  $as_echo "3. $at_setup_line: testing $at_desc ..."
2779  $at_traceon
2780
2781
2782
2783
2784  mkdir -p 'pkg-conff-dupe/DEBIAN'
2785
2786  cat >'pkg-conff-dupe/DEBIAN/control' <<CTRL_TEMPL
2787Package: pkg-conff-dupe
2788Version: 0.0-1
2789Section: test
2790Priority: extra
2791Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2792Architecture: all
2793Description: test package
2794CTRL_TEMPL
2795
2796
2797  mkdir -p 'pkg-conff-dupe/DEBIAN'
2798
2799  cat >'pkg-conff-dupe/DEBIAN/conffiles' <<CTRL_TEMPL
2800/test-conffile-1
2801/test-conffile-2
2802/test-conffile-1
2803CTRL_TEMPL
2804
2805cat >pkg-conff-dupe/test-conffile-1 <<'_ATEOF'
2806test init
2807_ATEOF
2808
2809cat >pkg-conff-dupe/test-conffile-2 <<'_ATEOF'
2810test init
2811_ATEOF
2812
2813{ set +x
2814$as_echo "$at_srcdir/deb-content.at:14:
2815# Duplicate conffile entries should produce a warning.
2816dpkg-deb -b pkg-conff-dupe
2817"
2818at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:14"
2819( $at_check_trace;
2820# Duplicate conffile entries should produce a warning.
2821dpkg-deb -b pkg-conff-dupe
2822
2823) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2824at_status=$? at_failed=false
2825$at_check_filter
2826echo >>"$at_stderr"; $as_echo "dpkg-deb: warning: conffile name '/test-conffile-1' is duplicated
2827dpkg-deb: warning: ignoring 1 warning about the control file(s)
2828" | \
2829  $at_diff - "$at_stderr" || at_failed=:
2830echo stdout:; cat "$at_stdout"
2831at_fn_check_status 0 $at_status "$at_srcdir/deb-content.at:14"
2832$at_failed && at_fn_log_failure
2833$at_traceon; }
2834
2835
2836
2837  mkdir -p 'pkg-conff-noel/DEBIAN'
2838
2839  cat >'pkg-conff-noel/DEBIAN/control' <<CTRL_TEMPL
2840Package: pkg-conff-noel
2841Version: 0.0-1
2842Section: test
2843Priority: extra
2844Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2845Architecture: all
2846Description: test package
2847CTRL_TEMPL
2848
2849printf "/test-conffile-1" >"pkg-conff-noel/DEBIAN/conffiles"
2850cat >pkg-conff-noel/test-conffile-1 <<'_ATEOF'
2851test init
2852_ATEOF
2853
2854{ set +x
2855$as_echo "$at_srcdir/deb-content.at:25:
2856# Conffiles need a final newline to guarantee there's been no accidental
2857# file truncation.
2858dpkg-deb -b pkg-conff-noel pkg-conff-noel.deb
2859"
2860at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:25"
2861( $at_check_trace;
2862# Conffiles need a final newline to guarantee there's been no accidental
2863# file truncation.
2864dpkg-deb -b pkg-conff-noel pkg-conff-noel.deb
2865
2866) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2867at_status=$? at_failed=false
2868$at_check_filter
2869echo >>"$at_stderr"; $as_echo "dpkg-deb: error: conffile name '/test-conffile-1' is too long, or missing final newline
2870" | \
2871  $at_diff - "$at_stderr" || at_failed=:
2872echo stdout:; cat "$at_stdout"
2873at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:25"
2874$at_failed && at_fn_log_failure
2875$at_traceon; }
2876
2877
2878
2879  mkdir -p 'pkg-deb-newline/DEBIAN'
2880
2881  cat >'pkg-deb-newline/DEBIAN/control' <<CTRL_TEMPL
2882Package: pkg-deb-newline
2883Version: 0.0-1
2884Section: test
2885Priority: extra
2886Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2887Architecture: all
2888Description: test package
2889CTRL_TEMPL
2890
2891touch 'pkg-deb-newline/file
2892newline'
2893{ set +x
2894$as_echo "$at_srcdir/deb-content.at:35:
2895# Cannot create package with newlines in filenames.
2896dpkg-deb -b pkg-deb-newline
2897"
2898at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:35"
2899( $at_check_trace;
2900# Cannot create package with newlines in filenames.
2901dpkg-deb -b pkg-deb-newline
2902
2903) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2904at_status=$? at_failed=false
2905$at_check_filter
2906echo >>"$at_stderr"; $as_echo "dpkg-deb: error: newline not allowed in pathname './file
2907newline'
2908" | \
2909  $at_diff - "$at_stderr" || at_failed=:
2910echo stdout:; cat "$at_stdout"
2911at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:35"
2912$at_failed && at_fn_log_failure
2913$at_traceon; }
2914
2915
2916  set +x
2917  $at_times_p && times >"$at_times_file"
2918) 5>&1 2>&1 7>&- | eval $at_tee_pipe
2919read at_status <"$at_status_file"
2920#AT_STOP_3
2921#AT_START_4
2922at_fn_group_banner 4 'deb-fields.at:3' \
2923  "dpkg-deb .deb fields" "                           " 1
2924at_xfail=no
2925(
2926  $as_echo "4. $at_setup_line: testing $at_desc ..."
2927  $at_traceon
2928
2929
2930
2931
2932  mkdir -p 'pkg-package-type-void/DEBIAN'
2933
2934  cat >'pkg-package-type-void/DEBIAN/control' <<CTRL_TEMPL
2935Package: pkg-package-type-void
2936Version: 0.0-1
2937Section: test
2938Priority: extra
2939Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2940Architecture: all
2941Description: test package
2942CTRL_TEMPL
2943
2944{ set +x
2945$as_echo "$at_srcdir/deb-fields.at:7:
2946dpkg-deb -b pkg-package-type-void
2947# Test absence of Package-Type field.
2948test -z \"\$(dpkg-deb -f pkg-package-type-void.deb Package-Type)\"
2949"
2950at_fn_check_prepare_notrace 'a $(...) command substitution' "deb-fields.at:7"
2951( $at_check_trace;
2952dpkg-deb -b pkg-package-type-void
2953# Test absence of Package-Type field.
2954test -z "$(dpkg-deb -f pkg-package-type-void.deb Package-Type)"
2955
2956) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2957at_status=$? at_failed=false
2958$at_check_filter
2959at_fn_diff_devnull "$at_stderr" || at_failed=:
2960echo stdout:; cat "$at_stdout"
2961at_fn_check_status 0 $at_status "$at_srcdir/deb-fields.at:7"
2962$at_failed && at_fn_log_failure
2963$at_traceon; }
2964
2965
2966
2967  mkdir -p 'pkg-package-type-use/DEBIAN'
2968
2969  cat >'pkg-package-type-use/DEBIAN/control' <<CTRL_TEMPL
2970Package: pkg-package-type-use
2971Version: 0.0-1
2972Section: test
2973Priority: extra
2974Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
2975Architecture: all
2976Description: test package
2977CTRL_TEMPL
2978
2979
2980  sed -i -e '/^Package:/aPackage-Type: udeb' 'pkg-package-type-use/DEBIAN/control'
2981
2982{ set +x
2983$as_echo "$at_srcdir/deb-fields.at:15:
2984dpkg-deb -b pkg-package-type-use
2985# Test presence of Package-Type field.
2986test -n \"\$(dpkg-deb -f pkg-package-type-use.deb Package-Type)\"
2987"
2988at_fn_check_prepare_notrace 'a $(...) command substitution' "deb-fields.at:15"
2989( $at_check_trace;
2990dpkg-deb -b pkg-package-type-use
2991# Test presence of Package-Type field.
2992test -n "$(dpkg-deb -f pkg-package-type-use.deb Package-Type)"
2993
2994) >>"$at_stdout" 2>>"$at_stderr" 5>&-
2995at_status=$? at_failed=false
2996$at_check_filter
2997at_fn_diff_devnull "$at_stderr" || at_failed=:
2998echo stdout:; cat "$at_stdout"
2999at_fn_check_status 0 $at_status "$at_srcdir/deb-fields.at:15"
3000$at_failed && at_fn_log_failure
3001$at_traceon; }
3002
3003
3004  set +x
3005  $at_times_p && times >"$at_times_file"
3006) 5>&1 2>&1 7>&- | eval $at_tee_pipe
3007read at_status <"$at_status_file"
3008#AT_STOP_4
3009#AT_START_5
3010at_fn_group_banner 5 'deb-split.at:3' \
3011  "dpkg-split options" "                             " 2
3012at_xfail=no
3013(
3014  $as_echo "5. $at_setup_line: testing $at_desc ..."
3015  $at_traceon
3016
3017
3018{ set +x
3019$as_echo "$at_srcdir/deb-split.at:5: dpkg-split --help"
3020at_fn_check_prepare_trace "deb-split.at:5"
3021( $at_check_trace; dpkg-split --help
3022) >>"$at_stdout" 2>>"$at_stderr" 5>&-
3023at_status=$? at_failed=false
3024$at_check_filter
3025at_fn_diff_devnull "$at_stderr" || at_failed=:
3026echo stdout:; cat "$at_stdout"
3027at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:5"
3028$at_failed && at_fn_log_failure
3029$at_traceon; }
3030
3031  set +x
3032  $at_times_p && times >"$at_times_file"
3033) 5>&1 2>&1 7>&- | eval $at_tee_pipe
3034read at_status <"$at_status_file"
3035#AT_STOP_5
3036#AT_START_6
3037at_fn_group_banner 6 'deb-split.at:8' \
3038  "dpkg-split .deb format" "                         " 2
3039at_xfail=no
3040(
3041  $as_echo "6. $at_setup_line: testing $at_desc ..."
3042  $at_traceon
3043
3044
3045
3046
3047  mkdir -p 'pkg-split/DEBIAN'
3048
3049  cat >'pkg-split/DEBIAN/control' <<CTRL_TEMPL
3050Package: pkg-split
3051Version: 0.0-1
3052Section: test
3053Priority: extra
3054Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
3055Architecture: all
3056Description: test package
3057CTRL_TEMPL
3058
3059
3060  sed -i -e 's/^Description:.*$/& - normal package to be split/' 'pkg-split/DEBIAN/control'
3061
3062{ set +x
3063$as_echo "$at_srcdir/deb-split.at:14:
3064# Initialize the template package
3065chmod -R u+w pkg-split
3066# XXX: Some environments set SIGPIPE to ignore which we cannot reset, and 'yes'
3067# does check print error conditions, so we ignore its error message here.
3068yes 2>/dev/null | dd of=pkg-split/data-file bs=1024 count=1024 status=none
3069find pkg-split | xargs touch -t 197001010100.00
3070dpkg-deb --root-owner-group -Znone -b pkg-split >/dev/null
3071"
3072at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:14"
3073( $at_check_trace;
3074# Initialize the template package
3075chmod -R u+w pkg-split
3076# XXX: Some environments set SIGPIPE to ignore which we cannot reset, and 'yes'
3077# does check print error conditions, so we ignore its error message here.
3078yes 2>/dev/null | dd of=pkg-split/data-file bs=1024 count=1024 status=none
3079find pkg-split | xargs touch -t 197001010100.00
3080dpkg-deb --root-owner-group -Znone -b pkg-split >/dev/null
3081
3082) >>"$at_stdout" 2>>"$at_stderr" 5>&-
3083at_status=$? at_failed=false
3084$at_check_filter
3085at_fn_diff_devnull "$at_stderr" || at_failed=:
3086at_fn_diff_devnull "$at_stdout" || at_failed=:
3087at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:14"
3088$at_failed && at_fn_log_failure
3089$at_traceon; }
3090
3091
3092{ set +x
3093$as_echo "$at_srcdir/deb-split.at:24:
3094# Test splitting a package (in 3 parts: 400 KiB + 400 KiB + 224 KiB)
3095dpkg-split -S 400 -s pkg-split.deb pkg-split-part
3096test -f pkg-split-part.1of3.deb
3097test -f pkg-split-part.2of3.deb
3098test -f pkg-split-part.3of3.deb
3099"
3100at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:24"
3101( $at_check_trace;
3102# Test splitting a package (in 3 parts: 400 KiB + 400 KiB + 224 KiB)
3103dpkg-split -S 400 -s pkg-split.deb pkg-split-part
3104test -f pkg-split-part.1of3.deb
3105test -f pkg-split-part.2of3.deb
3106test -f pkg-split-part.3of3.deb
3107
3108) >>"$at_stdout" 2>>"$at_stderr" 5>&-
3109at_status=$? at_failed=false
3110$at_check_filter
3111at_fn_diff_devnull "$at_stderr" || at_failed=:
3112echo >>"$at_stdout"; $as_echo "Splitting package pkg-split into 3 parts: 1 2 3 done
3113" | \
3114  $at_diff - "$at_stdout" || at_failed=:
3115at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:24"
3116$at_failed && at_fn_log_failure
3117$at_traceon; }
3118
3119
3120DEB_SPLIT_MD5SUM=c669258de88761bf90ad6621bdffd6f1
3121DEB_SPLIT_LENGTH=1065152
3122
3123{ set +x
3124$as_echo "$at_srcdir/deb-split.at:36:
3125# Test getting information about the split parts (parsing verification)
3126dpkg-split -I pkg-split-part.1of3.deb
3127dpkg-split -I pkg-split-part.2of3.deb
3128dpkg-split -I pkg-split-part.3of3.deb
3129"
3130at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:36"
3131( $at_check_trace;
3132# Test getting information about the split parts (parsing verification)
3133dpkg-split -I pkg-split-part.1of3.deb
3134dpkg-split -I pkg-split-part.2of3.deb
3135dpkg-split -I pkg-split-part.3of3.deb
3136
3137) >>"$at_stdout" 2>>"$at_stderr" 5>&-
3138at_status=$? at_failed=false
3139$at_check_filter
3140at_fn_diff_devnull "$at_stderr" || at_failed=:
3141echo >>"$at_stdout"; $as_echo "pkg-split-part.1of3.deb:
3142    Part format version:            2.1
3143    Part of package:                pkg-split
3144        ... version:                0.0-1
3145        ... architecture:           all
3146        ... MD5 checksum:           $DEB_SPLIT_MD5SUM
3147        ... length:                 $DEB_SPLIT_LENGTH bytes
3148        ... split every:            408576 bytes
3149    Part number:                    1/3
3150    Part length:                    408576 bytes
3151    Part offset:                    0 bytes
3152    Part file size (used portion):  408780 bytes
3153
3154pkg-split-part.2of3.deb:
3155    Part format version:            2.1
3156    Part of package:                pkg-split
3157        ... version:                0.0-1
3158        ... architecture:           all
3159        ... MD5 checksum:           $DEB_SPLIT_MD5SUM
3160        ... length:                 $DEB_SPLIT_LENGTH bytes
3161        ... split every:            408576 bytes
3162    Part number:                    2/3
3163    Part length:                    408576 bytes
3164    Part offset:                    408576 bytes
3165    Part file size (used portion):  408780 bytes
3166
3167pkg-split-part.3of3.deb:
3168    Part format version:            2.1
3169    Part of package:                pkg-split
3170        ... version:                0.0-1
3171        ... architecture:           all
3172        ... MD5 checksum:           $DEB_SPLIT_MD5SUM
3173        ... length:                 $DEB_SPLIT_LENGTH bytes
3174        ... split every:            408576 bytes
3175    Part number:                    3/3
3176    Part length:                    248000 bytes
3177    Part offset:                    817152 bytes
3178    Part file size (used portion):  248204 bytes
3179
3180" | \
3181  $at_diff - "$at_stdout" || at_failed=:
3182at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:36"
3183$at_failed && at_fn_log_failure
3184$at_traceon; }
3185
3186
3187{ set +x
3188$as_echo "$at_srcdir/deb-split.at:82:
3189# Test joining the split parts back together
3190dpkg-split -o pkg-joined.deb -j pkg-split-part.*.deb
3191cmp pkg-split.deb pkg-joined.deb
3192"
3193at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:82"
3194( $at_check_trace;
3195# Test joining the split parts back together
3196dpkg-split -o pkg-joined.deb -j pkg-split-part.*.deb
3197cmp pkg-split.deb pkg-joined.deb
3198
3199) >>"$at_stdout" 2>>"$at_stderr" 5>&-
3200at_status=$? at_failed=false
3201$at_check_filter
3202at_fn_diff_devnull "$at_stderr" || at_failed=:
3203echo >>"$at_stdout"; $as_echo "Putting package pkg-split together from 3 parts: 1 2 3 done
3204" | \
3205  $at_diff - "$at_stdout" || at_failed=:
3206at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:82"
3207$at_failed && at_fn_log_failure
3208$at_traceon; }
3209
3210
3211  set +x
3212  $at_times_p && times >"$at_times_file"
3213) 5>&1 2>&1 7>&- | eval $at_tee_pipe
3214read at_status <"$at_status_file"
3215#AT_STOP_6
3216