Files
mercury/samples/tests/handle_options
Tyson Dowd d64781a3d7 Add a testing architecture for the samples directory.
Estimated hours taken: 15

Add a testing architecture for the samples directory.
The tests are in the "tests" subdirectory of the samples
directory.  This keeps them close to the samples, but not close
enough to clutter up the samples.
It also means you don't have to worry about the issue of exactly where
the developer has checked out the CVS tests module.

samples/c_interface/simpler_c_calls_mercury/Mmakefile:
	Update this example to generate a .a file
	instead of directly using $(mercury_lib.os)

samples/tests/*:
	Test cases for all the samples.
2000-02-14 05:28:45 +00:00

85 lines
1.6 KiB
Plaintext

usage="\
Usage: $0 [options]
Options:
-f <mcflags>, --flags <mcflags>
Pass EXTRA_MCFLAGS=<mcflags> as an option to \`mmake check'.
-m <mgnucflags>, --mgnucflags <mgnucflags>
Pass EXTRA_MGNUCFLAGS=<mgnucflags> as an option to \`mmake check'.
-c <cflags>, --cflags <cflags>
Pass EXTRA_CFLAGS=<cflags> as an option to \`mmake check'.
-l <mlflags>, --mlflags <mlflags>
Pass EXTRA_MLFLAGS=<mlflags> 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=""
mgnucflagsopt=""
cflagsopt=""
mlflagsopt=""
gradeopt=""
fflag=""
mflag=""
cflag=""
lflag=""
gflag=""
while [ $# -gt 0 ]; do
case "$1" in
-f|--flags)
fflag="-f '$2'"
flagsopt="EXTRA_MCFLAGS='$2'"
shift ;;
-m|--mgnucflags)
mflag="-m '$2'"
mgnucflagsopt="EXTRA_MGNUCFLAGS='$2'"
shift ;;
-c|--cflags)
cflag="-c '$2'"
cflagsopt="EXTRA_CFLAGS='$2'"
shift ;;
-l|--mlflags)
lflag="-l '$2'"
mlflagsopt="EXTRA_MLFLAGS='$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
mmakeopts="$jfactor $flagsopt $mgnucflagsopt $cflagsopt $mlflagsopt $gradeopt"
runtestopts="$jfactor $mflag $cflag $lflag $fflag $gflag"