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" # normally use "make"
make="make" make="make"
runTests=false
skipFirst=false
## set WM_NCOMPPROCS automatically when both WM_HOSTS and WM_SCHEDULER are set ## 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" ] #if [ -z "$WM_NCOMPPROCS" -a -n "$WM_HOSTS" -a -n "$WM_SCHEDULER" ]
@ -73,8 +75,32 @@ then
thisScript="$PWD/$thisScript" thisScript="$PWD/$thisScript"
fi 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 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 then
# Specialised script. # Specialised script.
./Allrun ./Allrun
@ -104,7 +130,10 @@ else
#done #done
FOAM_TARGETS=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs) 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="$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 fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
application: $(FOAM_TARGETS) application: $(FOAM_TARGETS)
$(FOAM_TARGETS): $(FOAM_TARGETS):
+@(cd $@ && $(FOAM_APP)) +@(cd $@ && $(FOAM_APP) $(FOAM_ARGS))
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -68,7 +68,7 @@ logReport()
# Recursively run all tutorials # Recursively run all tutorials
foamRunTutorials cases foamRunTutorials -test -skipFirst
# Analyse all log files # Analyse all log files

View File

@ -0,0 +1,18 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication cvMesh
# Change collapseEdges to only do one iteration
cp system/collapseDict system/collapseDict.org
sed -e s/"\(maximumIterations[ \t]*\)\([0-9]*\);"/"\1 1;"/g \
system/collapseDict.org > system/collapseDict
runApplication collapseEdges -latestTime -collapseFaces
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,21 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication surfaceFeatureExtract
# Create tight-fitting background mesh
runApplication blockMesh
runApplication cvMesh
# Change collapseEdges to only do one iteration
cp system/collapseDict system/collapseDict.org
sed -e s/"\(maximumIterations[ \t]*\)\([0-9]*\);"/"\1 1;"/g \
system/collapseDict.org > system/collapseDict
runApplication collapseEdges -latestTime -collapseFaces
# ----------------------------------------------------------------- end-of-file