/[autoconf]/autoconf/lib/autotest/general.m4
ViewVC logotype

Diff of /autoconf/lib/autotest/general.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.143 by akim, Thu May 22 13:24:07 2003 UTC revision 1.144 by bonzini, Thu May 22 21:52:44 2003 UTC
# Line 184  at_dir=`pwd` Line 184  at_dir=`pwd`
184  # The directory the whole suite works in.  # The directory the whole suite works in.
185  # Should be absolutely to let the user `cd' at will.  # Should be absolutely to let the user `cd' at will.
186  at_suite_dir=$at_dir/$as_me.dir  at_suite_dir=$at_dir/$as_me.dir
187    # The file containing the suite.
188    at_suite_log=$at_dir/$as_me.log
189  # The file containing the location of the last AT_CHECK.  # The file containing the location of the last AT_CHECK.
190  at_check_line_file=$at_suite_dir/at-check-line  at_check_line_file=$at_suite_dir/at-check-line
191    # The file containing the exit status of the last command.
192    at_status_file=$at_suite_dir/at-status
193  # The files containing the output of the tested commands.  # The files containing the output of the tested commands.
194  at_stdout=$at_suite_dir/at-stdout  at_stdout=$at_suite_dir/at-stdout
195  at_stder1=$at_suite_dir/at-stder1  at_stder1=$at_suite_dir/at-stder1
# Line 237  do Line 241  do
241          ;;          ;;
242    
243      --clean | -c )      --clean | -c )
244          rm -rf $at_suite_dir $as_me.log          rm -rf $at_suite_dir $at_suite_log
245          exit 0          exit 0
246          ;;          ;;
247    
# Line 377  cat <<_ATEOF Line 381  cat <<_ATEOF
381    
382  Execution tuning:  Execution tuning:
383    -k, --keywords=KEYWORDS    -k, --keywords=KEYWORDS
384                   select the tests matching all the comma separated KEYWORDS                   select the tests matching all the comma separated KEYWORDS
385                   accumulates                   accumulates
386    -e, --errexit  abort as soon as a test fails; implies --debug    -e, --errexit  abort as soon as a test fails; implies --debug
387    -v, --verbose  force more detailed output    -v, --verbose  force more detailed output
388                   default for debugging scripts                   default for debugging scripts
389    -d, --debug    inhibit clean up and debug script creation    -d, --debug    inhibit clean up and debug script creation
390                   default for debugging scripts                   default for debugging scripts
391    -x, --trace    enable tests shell tracing    -x, --trace    enable tests shell tracing
392  _ATEOF  _ATEOF
393  m4_divert_pop([HELP_TUNING])dnl  m4_divert_pop([HELP_TUNING])dnl
# Line 451  _AS_PATH_WALK([$at_path], Line 455  _AS_PATH_WALK([$at_path],
455  [as_dir=`(cd "$as_dir" && pwd) 2>/dev/null`  [as_dir=`(cd "$as_dir" && pwd) 2>/dev/null`
456  test -d "$as_dir" || continue  test -d "$as_dir" || continue
457  case $PATH in  case $PATH in
458                    $as_dir                 | \                    $as_dir                 | \
459                    $as_dir$PATH_SEPARATOR* | \                    $as_dir$PATH_SEPARATOR* | \
460    *$PATH_SEPARATOR$as_dir                 | \    *$PATH_SEPARATOR$as_dir                 | \
461    *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR* ) ;;    *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR* ) ;;
462    
# Line 462  esac]) Line 466  esac])
466  export PATH  export PATH
467    
468  # Setting up the FDs.  # Setting up the FDs.
469  # 5 is stdout conditioned by verbosity.  # 5 is the log file.  Not to be overwritten if `-d'.
470  if test $at_verbose = echo; then  m4_define([AS_MESSAGE_LOG_FD], [5])
471    exec 5>&1  $at_debug_p && at_suite_log=/dev/null
472  else  exec AS_MESSAGE_LOG_FD>$at_suite_log
   exec 5>/dev/null  
 fi  
   
 # 6 is the log file.  To be preserved if `-d'.  
 m4_define([AS_MESSAGE_LOG_FD], [6])  
 if $at_debug_p; then  
   exec AS_MESSAGE_LOG_FD>/dev/null  
 else  
   exec AS_MESSAGE_LOG_FD>$as_me.log  
 fi  
473    
474  # Banners and logs.  # Banners and logs.
475  AS_BOX(m4_defn([AT_TESTSUITE_NAME])[.])  AS_BOX(m4_defn([AT_TESTSUITE_NAME])[.])
# Line 535  do Line 529  do
529  done  done
530    
531  {  {
532    AS_BOX([Silently running the tests.])    AS_BOX([Running the tests.])
533  } >&AS_MESSAGE_LOG_FD  } >&AS_MESSAGE_LOG_FD
534    
535  at_start_date=`date`  at_start_date=`date`
# Line 575  do Line 569  do
569    cd $at_suite_dir    cd $at_suite_dir
570    
571    case $at_group in    case $at_group in
572      banner-*) ;;      banner-*)
573          at_group_log=$at_suite_log
574          ;;
575    
576      *)      *)
577       # Skip tests we already run (using --keywords makes it easy to get        # Skip tests we already run (using --keywords makes it easy to get
578       # duplication).        # duplication).
579       case " $at_pass_test $at_skip_test $at_fail_test " in        case " $at_pass_test $at_skip_test $at_fail_test " in
580         *" $at_group "* ) continue;;          *" $at_group "* ) continue;;
581       esac        esac
582    
583       # Normalize the test group number.        # Normalize the test group number.
584       at_group_normalized=`expr "00000$at_group" : ".*\($at_format\)"`        at_group_normalized=`expr "00000$at_group" : ".*\($at_format\)"`
585    
586       # Create a fresh directory for the next test group, and enter.        # Create a fresh directory for the next test group, and enter.
587       at_group_dir=$at_suite_dir/$at_group_normalized        at_group_dir=$at_suite_dir/$at_group_normalized
588       rm -rf $at_group_dir        at_group_log=$at_group_dir/$as_me.log
589       mkdir $at_group_dir ||        rm -rf $at_group_dir
590         AS_ERROR([cannot create $at_group_dir])        mkdir $at_group_dir ||
591       cd $at_group_dir          AS_ERROR([cannot create $at_group_dir])
592      ;;        cd $at_group_dir
593          ;;
594    esac    esac
595    
596    at_status=0    echo 0 > $at_status_file
597    
598    # Clearly separate the test groups when verbose.    # Clearly separate the test groups when verbose.
599    test $at_group_count != 0 && $at_verbose    test $at_group_count != 0 && $at_verbose
600    
601      # In verbose mode, append to the log file *and* show on
602      # the standard output; in quiet mode only write to the log
603      if test $at_verbose = echo; then
604        at_tee_pipe="tee -a $at_group_log"
605      else
606        at_tee_pipe="cat >> $at_group_log"
607      fi
608    
609    case $at_group in    case $at_group in
610  dnl Test groups inserted here (TESTS).  dnl Test groups inserted here (TESTS).
611  m4_divert_pop([TESTS])[]dnl  m4_divert_pop([TESTS])[]dnl
# Line 626  _ATEOF Line 634  _ATEOF
634        fi        fi
635        at_group_count=`expr 1 + $at_group_count`        at_group_count=`expr 1 + $at_group_count`
636        $at_verbose $ECHO_N "$at_group. $at_setup_line: $ECHO_C"        $at_verbose $ECHO_N "$at_group. $at_setup_line: $ECHO_C"
637          echo $ECHO_N "$at_group. $at_setup_line: $ECHO_C" >> $at_group_log
638        case $at_status in        case $at_status in
639          0)  at_msg="ok"          0)  at_msg="ok"
640              at_pass_list="$at_pass_list $at_group"              at_pass_list="$at_pass_list $at_group"
             # Cleanup the group directory, unless the user wants the files.  
             $at_debug_p || rm -rf $at_group_dir  
641              ;;              ;;
642          77) at_msg="ok (skipped near \``cat $at_check_line_file`')"          77) at_msg="ok (skipped near \``cat $at_check_line_file`')"
643              at_skip_list="$at_skip_list $at_group"              at_skip_list="$at_skip_list $at_group"
             # Cleanup the group directory, unless the user wants the files.  
             $at_debug_p || rm -rf $at_group_dir  
644              ;;              ;;
645          *)  at_msg="FAILED near \``cat $at_check_line_file`'"          *)  at_msg="FAILED near \``cat $at_check_line_file`'"
646              at_fail_list="$at_fail_list $at_group"              at_fail_list="$at_fail_list $at_group"
             # Up failure, keep the group directory for autopsy.  
             # Create the debugging script.  
             {  
               echo "#! /bin/sh"  
               echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$[@]"}'\''='\''"$[@]"'\'''  
               echo "cd $at_dir"  
               echo 'exec ${CONFIG_SHELL-'"$SHELL"'}' "$[0]" \  
                    '-v -d' "$at_debug_args" "$at_group" '${1+"$[@]"}'  
               echo 'exit 1'  
             } >$at_group_dir/run  
             chmod +x $at_group_dir/run  
647              ;;              ;;
648        esac        esac
649        echo $at_msg        echo $at_msg
650        at_log_msg="$at_group. $at_setup_line: $at_msg"        at_log_msg="$at_group. $at_setup_line: $at_msg"
651        # If the group failed, $at_times_file is not available.        case $at_status in
652        test -f $at_times_file &&          0|77)
653          at_log_msg="$at_log_msg (`sed 1d $at_times_file`)"            # $at_times_file is only available if the group succeeded or was skipped.
654        echo "$at_log_msg" >&AS_MESSAGE_LOG_FD            # We're not including the group log, so the success message is written
655        $at_errexit_p && test -n "$at_fail_list" && break            # in the global log separately.  But we also write to the group log in
656              # case they're using -d.
657              at_log_msg="$at_log_msg       (`sed 1d $at_times_file`)"
658              echo "$at_log_msg" >> $at_group_log
659              echo "$at_log_msg" >&AS_MESSAGE_LOG_FD
660    
661              # Cleanup the group directory, unless the user wants the files.
662              $at_debug_p || rm -rf $at_group_dir
663              ;;
664            *)
665              # Upon failure, include the log into the testsuite's global log.
666              # The failure message is written in the group log and then included
667              # in the global log.
668              echo "$at_log_msg" >> $at_group_log
669              cat $at_group_log >&AS_MESSAGE_LOG_FD
670    
671              # Upon failure, keep the group directory for autopsy, and
672              # create the debugging script.
673              {
674                echo "#! /bin/sh"
675                echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$[@]"}'\''='\''"$[@]"'\'''
676                echo "cd $at_dir"
677                echo 'exec ${CONFIG_SHELL-'"$SHELL"'}' "$[0]" \
678                     '-v -d' "$at_debug_args" "$at_group" '${1+"$[@]"}'
679                echo 'exit 1'
680              } >$at_group_dir/run
681              chmod +x $at_group_dir/run
682              $at_errexit_p && break
683              ;;
684          esac
685        ;;        ;;
686    esac    esac
687  done  done
688    
689  # Back to the top directory, in particular because we might  # Back to the top directory.
 # rerun the suite verbosely.  
690  cd $at_dir  cd $at_dir
691    
692  # Compute the duration of the suite.  # Compute the duration of the suite.
# Line 697  elif test $at_debug_p = false; then Line 719  elif test $at_debug_p = false; then
719      AS_BOX([ERROR: Suite unsuccessful, $at_fail_count of $at_group_count tests failed.])      AS_BOX([ERROR: Suite unsuccessful, $at_fail_count of $at_group_count tests failed.])
720    fi    fi
721    
   # Normalize the names so that `ls' lists them in order.  
722    echo 'You may investigate any problem if you feel able to do so, in which'    echo 'You may investigate any problem if you feel able to do so, in which'
723    echo 'case the test suite provides a good starting point.'    echo 'case the test suite provides a good starting point.'
724    echo    echo
725    echo 'Now, failed tests will be executed again, verbosely, and logged'    echo 'Failed tests have been logged in the file '$as_me'.log.'
   echo 'in the file '$as_me'.log.'  
726    
727    {    {
728      echo      echo
# Line 720  elif test $at_debug_p = false; then Line 740  elif test $at_debug_p = false; then
740        $SHELL $[0] $at_skip_list --list        $SHELL $[0] $at_skip_list --list
741        echo        echo
742      fi      fi
     echo  
   
     AS_BOX([Verbosely re-running the failing tests.])  
     echo  
   } >&AS_MESSAGE_LOG_FD  
   
   exec AS_MESSAGE_LOG_FD>/dev/null  
   $SHELL $[0] -v -d $at_debug_args $at_fail_list 2>&1 | tee -a $as_me.log  
   exec AS_MESSAGE_LOG_FD>>$as_me.log  
   
   {  
     echo  
743      if test -n "$at_top_srcdir"; then      if test -n "$at_top_srcdir"; then
744        AS_BOX([Configuration logs.])        AS_BOX([Configuration logs.])
745        echo        echo
# Line 789  m4_append([AT_groups_all], [ ]m4_defn([A Line 797  m4_append([AT_groups_all], [ ]m4_defn([A
797  m4_divert_push([TESTS])dnl  m4_divert_push([TESTS])dnl
798    AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1    AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1
799      at_setup_line='m4_defn([AT_line])'      at_setup_line='m4_defn([AT_line])'
     $at_verbose "AT_ordinal. m4_defn([AT_line]): testing $1..."  
800      $at_quiet $ECHO_N "m4_format([[%3d: %-18s]],      $at_quiet $ECHO_N "m4_format([[%3d: %-18s]],
801                         AT_ordinal, m4_defn([AT_line]))[]$ECHO_C"                         AT_ordinal, m4_defn([AT_line]))[]$ECHO_C"
802      (      (
803          echo "AT_ordinal. m4_defn([AT_line]): testing $1..."
804        $at_traceon        $at_traceon
805  ])  ])
806    
# Line 812  m4_define([AT_CLEANUP], Line 820  m4_define([AT_CLEANUP],
820  at_help_all=$at_help_all'm4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords], [m4_defn([AT_keywords])]);  at_help_all=$at_help_all'm4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords], [m4_defn([AT_keywords])]);
821  '  '
822  )dnl  )dnl
823      $at_times_skip || times >$at_times_file        $at_traceoff
824      )        $at_times_skip || times >$at_times_file
825      at_status=$?      ) AS_MESSAGE_LOG_FD>&1 2>&1 | eval $at_tee_pipe
826        at_status=`cat $at_status_file`
827      ;;      ;;
828    
829  m4_divert_pop([TESTS])dnl Back to KILL.  m4_divert_pop([TESTS])dnl Back to KILL.
# Line 919  $2[]_ATEOF Line 928  $2[]_ATEOF
928  #  #
929  m4_define([AT_CHECK],  m4_define([AT_CHECK],
930  [$at_traceoff  [$at_traceoff
931  $at_verbose "AT_LINE: AS_ESCAPE([$1])"  echo "AT_LINE: AS_ESCAPE([$1])"
932  echo AT_LINE >$at_check_line_file  echo AT_LINE >$at_check_line_file
933  ( $at_traceon; $1 ) >$at_stdout 2>$at_stder1  ( $at_traceon; $1 ) >$at_stdout 2>$at_stder1
934  at_status=$?  at_status=$?
# Line 928  grep -v '^ *+' $at_stder1 >$at_stderr Line 937  grep -v '^ *+' $at_stder1 >$at_stderr
937  at_failed=false  at_failed=false
938  dnl Check stderr.  dnl Check stderr.
939  m4_case([$4],  m4_case([$4],
940          stderr, [(echo stderr:; tee stderr <$at_stderr) >&5],          stderr, [echo stderr:; tee stderr <$at_stderr],
941          ignore, [(echo stderr:; cat $at_stderr) >&5],          ignore, [echo stderr:; cat $at_stderr],
942          experr, [$at_diff experr $at_stderr >&5 || at_failed=:],          experr, [$at_diff experr $at_stderr || at_failed=:],
943          [],     [$at_diff $at_devnull $at_stderr >&5 || at_failed=:],          [],     [$at_diff $at_devnull $at_stderr || at_failed=:],
944          [echo >>$at_stderr; echo "AS_ESCAPE([$4])" | $at_diff - $at_stderr >&5 || at_failed=:])          [echo >>$at_stderr; echo "AS_ESCAPE([$4])" | $at_diff - $at_stderr || at_failed=:])
945  dnl Check stdout.  dnl Check stdout.
946  m4_case([$3],  m4_case([$3],
947          stdout, [(echo stdout:; tee stdout <$at_stdout) >&5],          stdout, [echo stdout:; tee stdout <$at_stdout],
948          ignore, [(echo stdout:; cat $at_stdout) >&5],          ignore, [echo stdout:; cat $at_stdout],
949          expout, [$at_diff expout $at_stdout >&5 || at_failed=:],          expout, [$at_diff expout $at_stdout || at_failed=:],
950          [],     [$at_diff $at_devnull $at_stdout >&5 || at_failed=:],          [],     [$at_diff $at_devnull $at_stdout || at_failed=:],
951          [echo >>$at_stdout; echo "AS_ESCAPE([$3])" | $at_diff - $at_stdout >&5 || at_failed=:])          [echo >>$at_stdout; echo "AS_ESCAPE([$3])" | $at_diff - $at_stdout || at_failed=:])
952  dnl Check exit val.  Don't `skip' if we are precisely checking $? = 77.  dnl Check exit val.  Don't `skip' if we are precisely checking $? = 77.
953  case $at_status in  case $at_status in
954  m4_case([$2],  m4_case([$2],
955    [77],    [77],
956      [],      [],
957      [   77) exit 77;;      [   77) echo 77 > $at_status_file
958                exit 77;;
959  ])dnl  ])dnl
960  m4_case([$2],  m4_case([$2],
961    [ignore],    [ignore],
962      [   *);;],      [   *);;],
963      [   m4_default([$2], [0])) ;;      [   m4_default([$2], [0])) ;;
964     *) $at_verbose "AT_LINE: exit code was $at_status, expected m4_default([$2], [0])" >&2     *) echo "AT_LINE: exit code was $at_status, expected m4_default([$2], [0])"
965        at_failed=:;;])        at_failed=:;;])
966  esac  esac
967  AS_IF($at_failed, [$5], [$6])  AS_IF($at_failed, [$5
968  $at_failed && exit 1    echo 1 > $at_status_file
969      exit 1], [$6])
970  $at_traceon  $at_traceon
971  ])# AT_CHECK  ])# AT_CHECK

Legend:
Removed from v.1.143  
changed lines
  Added in v.1.144

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26