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