foamRunTutorials: Rationalized support for the "-test" option

RunFunctions: Added "isTest()" argument parsing function
tutorials: Updated Allrun scripts to propagate the "-test" option
tutorials: Removed the lower Alltest scripts and updated the Allrun to
    use the "isTest()" function to handle test-specific operation
This commit is contained in:
Henry Weller
2016-02-15 15:49:05 +00:00
parent 3faa7e2284
commit cfa7678ba8
14 changed files with 56 additions and 98 deletions

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -94,16 +94,17 @@ do
esac esac
done done
passArgs=$(if $runTests; then echo "-test"; fi)
# 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 ! $skipFirst && $runTests && [ -f "./Alltest" ] if ! $skipFirst && $runTests && [ -f "./Alltest" ]
then then
# Run a special test script. # Run a special test script.
./Alltest ./Alltest $passArgs
elif ! $skipFirst && [ -f "./Allrun" ] elif ! $skipFirst && [ -f "./Allrun" ]
then then
# Specialised script. # Specialised script.
./Allrun ./Allrun $passArgs
elif [ -d system ] elif [ -d system ]
then then
# Normal case. # Normal case.
@ -120,20 +121,15 @@ else
( compileApplication $caseName ) ( compileApplication $caseName )
fi fi
done done
# Recurse to subdirectories
#for caseName in *
#do
# if [ -d $caseName ]
# then
# ( cd $caseName && $thisScript )
# fi
#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"
passArgs=$(if $runTests; then echo "-test"; fi) #$make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs \
# FOAM_TARGETS="$FOAM_TARGETS" \
# FOAM_APP="$WM_SCHEDULER $thisScript" FOAM_ARGS="$passArgs"
$make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP="$thisScript" FOAM_ARGS="$passArgs" $make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs \
FOAM_TARGETS="$FOAM_TARGETS" \
FOAM_APP="$thisScript" FOAM_ARGS="$passArgs"
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -28,6 +28,17 @@
# Miscellaneous functions for running tutorial cases # Miscellaneous functions for running tutorial cases
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
isTest()
{
for i in "$@"; do
if [ "$i" = "-test" ]
then
return 0
fi
done
return 1
}
getNumberOfProcessors() getNumberOfProcessors()
{ {
expandDictionary system/decomposeParDict \ expandDictionary system/decomposeParDict \

View File

@ -9,7 +9,6 @@ application=`getApplication`
runApplication $application runApplication $application
(cd validation && ./Allrun) (cd validation && ./Allrun $*)
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -9,7 +9,6 @@ application=`getApplication`
runApplication $application runApplication $application
(cd validation && ./Allrun) (cd validation && ./Allrun $*)
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -9,7 +9,6 @@ application=`getApplication`
runApplication $application runApplication $application
(cd validation && ./Allrun) (cd validation && ./Allrun $*)
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -9,7 +9,6 @@ application=`getApplication`
runApplication $application runApplication $application
(cd validation && ./Allrun) (cd validation && ./Allrun $*)
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -25,11 +25,14 @@ cloneParallelCase()
# Do the Spalart-Allmaras steady-state case # Do the Spalart-Allmaras steady-state case
(cd motorBike && foamRunTutorials) (cd motorBike && foamRunTutorials)
if ! isTest $@
then
# Clone the steady-state case to the LES case # Clone the steady-state case to the LES case
cloneParallelCase motorBike motorBikeLES cloneParallelCase motorBike motorBikeLES
# Do the LES case # Do the LES case
cp lesFiles/Allrun motorBikeLES/ cp lesFiles/Allrun motorBikeLES/
(cd motorBikeLES && foamRunTutorials) (cd motorBikeLES && foamRunTutorials)
fi
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -1,10 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Do the Spalart-Allmaras steady-state case
(cd motorBike && foamRunTutorials)
# ----------------------------------------------------------------- end-of-file

View File

@ -16,7 +16,7 @@ runParallel snappyHexMesh -overwrite
find . -type f -iname "*level*" -exec rm {} \; find . -type f -iname "*level*" -exec rm {} \;
ls -d processor* | xargs -I {} cp -r 0.org ./{}/0 $1 ls -d processor* | xargs -I {} cp -r 0.org ./{}/0
runParallel topoSet runParallel topoSet
runParallel `getApplication` runParallel `getApplication`

View File

@ -1,29 +1,32 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
# Any cases that are links to solver test cases and are run when the Allrun
# scripts of those solvers are run. This script avoids meshing these cases
# twice.
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
( (
cd blob || exit cd blob || exit
./Allrun ./Allrun $*
)
(
cd flange || exit
./Allrun
) )
( (
cd simpleShapes || exit cd simpleShapes || exit
./Allrun ./Allrun $*
)
if ! isTest $@
then
(
cd flange || exit
./Allrun $*
) )
( (
cd mixerVessel || exit cd mixerVessel || exit
./Allrun ./Allrun $*
) )
fi
exit 0
# Any cases that are links to solver test cases and are run when the Allrun
# scripts of those solvers are run.
# This dummy Allrun script avoids meshing these cases twice.
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -1,32 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# copy flange surface from resources directory
cp $FOAM_TUTORIALS/resources/geometry/flange.stl.gz constant/triSurface/
cp system/controlDict system/controlDict.org
sed -e s/"\(endTime[ \t]*\)\([0-9]*\);"/"\1 10;"/g \
-e s/"\(writeInterval[ \t]*\)\([0-9]*\);"/"\1 10;"/g \
system/controlDict.org > system/controlDict
runApplication foamyHexMesh
# 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
cp system/controlDict.org system/controlDict
cp system/collapseDict.org system/collapseDict
rm -f system/controlDict.org system/collapseDict.org
# ----------------------------------------------------------------- end-of-file

View File

@ -1,9 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Do nothing for now.
# ----------------------------------------------------------------- end-of-file

View File

@ -4,7 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
( (
cd flange || exit cd flange || exit
./Allrun ./Allrun $*
) )
exit 0 exit 0

View File

@ -3,12 +3,12 @@ cd ${0%/*} || exit 1 # Run from this directory
( (
cd throttle || exit cd throttle || exit
./Allrun ./Allrun $*
) )
( (
cd throttle3D || exit cd throttle3D || exit
./Allrun ./Allrun $*
) )
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file