ENH: foamRunTutorials: Enable Alltest files to be read as well as Allrun

foamRunTutorials now accepts two arguments:
-test : Preferentially execute Alltest, if present, over Allrun.
-skipFirst : Skip Alltest/Allrun at the top level to prevent recursion

Added because some tutorials are not dependent on controlDict and take
a long time.
This commit is contained in:
laurence
2012-12-13 16:07:15 +00:00
parent 0953846fa9
commit 16ef46f6d7
5 changed files with 72 additions and 4 deletions

View File

@ -37,6 +37,8 @@
# normally use "make"
make="make"
runTests=false
skipFirst=false
## set WM_NCOMPPROCS automatically when both WM_HOSTS and WM_SCHEDULER are set
#if [ -z "$WM_NCOMPPROCS" -a -n "$WM_HOSTS" -a -n "$WM_SCHEDULER" ]
@ -73,8 +75,32 @@ then
thisScript="$PWD/$thisScript"
fi
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-t | -test)
runTests=true
shift
;;
-s | -skipFirst)
skipFirst=true
shift
;;
*)
break
;;
esac
done
# If an argument is supplied do not execute ./Allrun to avoid recursion
if [ $# = 0 -a -f "./Allrun" ]
if ! $skipFirst && $runTests && [ -f "./Alltest" ]
then
# Run a special test script.
./Alltest
elif ! $skipFirst && [ -f "./Allrun" ]
then
# Specialised script.
./Allrun
@ -104,7 +130,10 @@ else
#done
FOAM_TARGETS=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs)
#$make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP="$WM_SCHEDULER $thisScript"
$make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP="$thisScript"
passArgs=$(if $runTests; then echo "-test"; fi)
$make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP="$thisScript" FOAM_ARGS="$passArgs"
fi
#------------------------------------------------------------------------------