Files
mercury/tests/handle_options
Tyson Dowd bc1e28d8d5 Fix bugs in the scripts for running tests.
Estimated hours taken: 6

Fix bugs in the scripts for running tests.

tests/handle_options:
	Quote EXTRA_CFLAGS and EXTRA_MCFLAGS so that we can use
	eval in runtests.

tests/Mmake.common:
	Set MGNUCFLAGS using $(EXTRA_MGNUFLAGS) and $(EXTRA_CFLAGS)

tests/*/runtests:
	Don't pass empty strings as arguments to mmake, as this can
	tickle bugs in make.
	Try
		make -f foo.123 ""
	on a CASE machine or hydra (not kryten, it has a different
	version of gnu-make). It will chop the `23' from that string.
	So when using `make -f mmake.$$', only the single digit pids
	work, which is fairly limiting.
1997-03-18 06:01:27 +00:00

64 lines
1.1 KiB
Plaintext

usage="\
Usage: $0 [options]
Options:
-f <mcflags>, --flags <mcflags>
Pass EXTRA_MCFLAGS=<mcflags> as an option to \`mmake check'.
-c <cflags>, --cflags <cflags>
Pass EXTRA_CFLAGS=<cflags> as an option to \`mmake check'.
-g <grade>, --grade <grade>
Pass GRADE=<grade> as an option to \`mmake check'.
-j <num-jobs>, --jobs <num-jobs>
Run using <num-jobs> different parallel processes.
"
jfactor=""
flagsopt=""
cflagsopt=""
gradeopt=""
fflag=""
cflag=""
gflag=""
while [ $# -gt 0 ]; do
case "$1" in
-c|--cflags)
cflag="-c '$2'"
cflagsopt="EXTRA_CFLAGS='$2'"
shift ;;
-f|--flags)
fflag="-f '$2'"
flagsopt="EXTRA_MCFLAGS='$2'"
shift ;;
-g|--grade)
gflag="-g $2"
gradeopt="GRADE=$2"
shift ;;
-j|--jobs)
jfactor="-j$2"; shift ;;
-j*)
jfactor="-j` expr $1 : '-j\(.*\)' `" ;;
--jobs*)
jfactor="--jobs` expr $1 : '--jobs\(.*\)' `" ;;
--)
shift; break ;;
-*)
echo "$0: unknown option \`$1'" 1>&2
echo "$usage" 1>&2
exit 1 ;;
*)
break ;;
esac
shift
done
if [ $# -ne 0 ]; then
echo "$0: unexpected argument(s) \`$*'" 1>&2
echo "$usage" 1>&2
exit 1
fi