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