*** sanity.sh.orig	Wed Jun 28 16:03:20 2000
--- sanity.sh	Wed Jun 28 17:30:04 2000
***************
*** 18,25 ****
  #
  # Original Author: K. Richard Pixley
  
! # usage: sanity.sh [-r] @var{cvs-to-test} @var{tests-to-run}
  # -r means to test remote instead of local cvs.
  # @var{tests-to-run} are the names of the tests to run; if omitted run all
  # tests.
  
--- 18,29 ----
  #
  # Original Author: K. Richard Pixley
  
! # usage: sanity.sh [-r] [--startwith testname] [--keep] \
! #        @var{cvs-to-test} @var{tests-to-run}
  # -r means to test remote instead of local cvs.
+ # --keep means don't blow away contents of tmp directory. (doesn't work)
+ # --startwith "testname" means to skip all the tests prior to the specified
+ #                        test
  # @var{tests-to-run} are the names of the tests to run; if omitted run all
  # tests.
  
***************
*** 61,84 ****
  
  echo 'This test should produce no other output than this line, and a final "OK".'
  
! if test x"$1" = x"-r"; then
! 	shift
! 	remote=yes
! else
! 	remote=no
! fi
  
  # The --keep option will eventually cause all the tests to leave around the
  # contents of the /tmp directory; right now only some implement it.  Not
  # useful if you are running more than one test.
  # FIXME: need some real option parsing so this doesn't depend on the order
  # in which they are specified.
! if test x"$1" = x"--keep"; then
!   shift
!   keep=yes
! else
!   keep=no
! fi
  
  # Use full path for CVS executable, so that CVS_SERVER gets set properly
  # for remote.
--- 65,114 ----
  
  echo 'This test should produce no other output than this line, and a final "OK".'
  
! #
! # allow options to sanity.sh to come in any order
! #
! 
! # defaults 
  
  # The --keep option will eventually cause all the tests to leave around the
  # contents of the /tmp directory; right now only some implement it.  Not
  # useful if you are running more than one test.
  # FIXME: need some real option parsing so this doesn't depend on the order
  # in which they are specified.
! keep=no
! remote=no
! startwith=""
! reached_start="yes"
! 
! options_left=yes;
! while [ "$options_left" = "yes" ]
! do
! 	# if the next arg does not begin wtih a dash...
! 	if ( ! echo "$1" | grep '^[-]' > /dev/null 2>&1 )
! 	then
! 		options_left=no
! 	else
! 		# it does begin with a dash.
! 		case x"$1" in
! 		"x-r")	shift
! 			remote=yes
! 			;;
! 
! 		"x--keep")shift 
! 			  keep=yes
! 			;;
! 
! 		"x--startwith")
! 			# skip all the tests preceding the specified test
! 			shift
! 			startwith="$1"
! 			reached_start=no
! 			shift
! 			;;
! 		esac
! 	fi
! done
  
  # Use full path for CVS executable, so that CVS_SERVER gets set properly
  # for remote.
***************
*** 734,741 ****
--- 764,785 ----
  dotest 1 "${testcvs} init" ''
  dotest 1a "${testcvs} init" ''
  
+ # reached_start is used with "--startwith" option to know if
+ # it's time to stop skipping tests.
+ #
+ 
  ### The big loop
  for what in $tests; do
+ 	if [ "$startwith" != "" -a "$reached_start" = "no" ]
+ 	then
+ 		if [ "$startwith" = "$what" ]
+ 		then
+ 			reached_start=yes
+ 		fi
+ 	fi	
+ 
+ 	if [ "$reached_start" = "yes" ]
+ 	then
  	case $what in
  	basica)
  	  # Similar in spirit to some of the basic1, and basic2
***************
*** 21103,21108 ****
--- 21147,21155 ----
  	   echo $what is not the name of a test -- ignored
  	   ;;
  	esac
+ 	else
+ 		echo "Skipping test $what" 1>&2
+ 	fi # endif for --> if [ "$reached_start" = "yes" ]
  done
  
  echo "OK, all tests completed."
