mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: foamRunTutorials -dry-run option
- for tracing tutorials execution
This commit is contained in:
@ -44,6 +44,7 @@ options:
|
|||||||
-serial Prefer Allrun-serial if available
|
-serial Prefer Allrun-serial if available
|
||||||
-parallel Prefer Allrun-parallel if available
|
-parallel Prefer Allrun-parallel if available
|
||||||
-test Prefer Alltest script, pass -test argument to scripts
|
-test Prefer Alltest script, pass -test argument to scripts
|
||||||
|
-dry-run Only report which script to run
|
||||||
-self Avoid initial Allrun / Alltest scripts
|
-self Avoid initial Allrun / Alltest scripts
|
||||||
(prevent infinite recursion)
|
(prevent infinite recursion)
|
||||||
-help Print the usage
|
-help Print the usage
|
||||||
@ -75,7 +76,7 @@ die()
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
unset passArgs runTest runType skipSelf
|
unset optDryRun passArgs runTest runType skipSelf
|
||||||
|
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
@ -95,7 +96,7 @@ do
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
-test)
|
-test)
|
||||||
passArgs="-test"
|
passArgs="$passArgs${passArgs:+ }$1"
|
||||||
runTest=true
|
runTest=true
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -107,6 +108,11 @@ do
|
|||||||
echo "$0: unknown setting: $1" 1>&2
|
echo "$0: unknown setting: $1" 1>&2
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-dry-run)
|
||||||
|
passArgs="$passArgs${passArgs:+ }$1"
|
||||||
|
optDryRun="(dry-run) "
|
||||||
|
;;
|
||||||
|
|
||||||
-case=*)
|
-case=*)
|
||||||
caseDir="${1#*=}"
|
caseDir="${1#*=}"
|
||||||
;;
|
;;
|
||||||
@ -142,7 +148,12 @@ then
|
|||||||
# Use specialized script(s)
|
# Use specialized script(s)
|
||||||
if [ -n "$runTest" ] && [ -f ./Alltest ]
|
if [ -n "$runTest" ] && [ -f ./Alltest ]
|
||||||
then
|
then
|
||||||
./Alltest $passArgs $*
|
if [ -n "$optDryRun" ]
|
||||||
|
then
|
||||||
|
echo "${optDryRun} Alltest: $PWD" 1>&2
|
||||||
|
else
|
||||||
|
./Alltest $passArgs $*
|
||||||
|
fi
|
||||||
exit "$?"
|
exit "$?"
|
||||||
elif [ -f ./Allrun-optional ]
|
elif [ -f ./Allrun-optional ]
|
||||||
then
|
then
|
||||||
@ -154,7 +165,12 @@ then
|
|||||||
allRun="Allrun-$runType"
|
allRun="Allrun-$runType"
|
||||||
if [ -f ./"$allRun" ]
|
if [ -f ./"$allRun" ]
|
||||||
then
|
then
|
||||||
./"$allRun" $passArgs $*
|
if [ -n "$optDryRun" ]
|
||||||
|
then
|
||||||
|
echo "${optDryRun} $allRun: $PWD" 1>&2
|
||||||
|
else
|
||||||
|
./"$allRun" $passArgs $*
|
||||||
|
fi
|
||||||
exit "$?"
|
exit "$?"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -164,7 +180,12 @@ then
|
|||||||
do
|
do
|
||||||
if [ -f ./"$allRun" ]
|
if [ -f ./"$allRun" ]
|
||||||
then
|
then
|
||||||
./"$allRun" $passArgs $*
|
if [ -n "$optDryRun" ]
|
||||||
|
then
|
||||||
|
echo "${optDryRun} $allRun: $PWD" 1>&2
|
||||||
|
else
|
||||||
|
./"$allRun" $passArgs $*
|
||||||
|
fi
|
||||||
exit "$?"
|
exit "$?"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -174,23 +195,35 @@ fi
|
|||||||
if [ -d system ]
|
if [ -d system ]
|
||||||
then
|
then
|
||||||
# Run normal case with blockMesh and the application
|
# Run normal case with blockMesh and the application
|
||||||
runApplication blockMesh
|
if [ -n "$optDryRun" ]
|
||||||
runApplication $(getApplication)
|
then
|
||||||
|
echo "${optDryRun} blockMesh + application: $PWD" 1>&2
|
||||||
|
else
|
||||||
|
runApplication blockMesh
|
||||||
|
runApplication $(getApplication)
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
# Loop over sub-directories and compile any applications
|
# Compile any applications in sub-directories
|
||||||
for caseName in *
|
for caseName in *
|
||||||
do
|
do
|
||||||
if [ -d "$caseName/Make" ]
|
if [ -d "$caseName/Make" ]
|
||||||
then
|
then
|
||||||
( compileApplication "$caseName" )
|
if [ -n "$optDryRun" ]
|
||||||
|
then
|
||||||
|
echo "${optDryRun} compile $caseName" 1>&2
|
||||||
|
else
|
||||||
|
( compileApplication "$caseName" )
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Loop over sub-directories
|
||||||
subdirs=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs)
|
subdirs=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs)
|
||||||
|
|
||||||
# Run all cases which have not already been run
|
# Run all cases which have not already been run
|
||||||
"$make" -k -f "${WM_PROJECT_DIR:?}"/bin/tools/MakefileDirs \
|
"$make" ${optDryRun:+--no-print-directory} \
|
||||||
|
-k -f "${WM_PROJECT_DIR:?}"/bin/tools/MakefileDirs \
|
||||||
FOAM_TARGETS="$subdirs" \
|
FOAM_TARGETS="$subdirs" \
|
||||||
FOAM_APP="$thisScript" \
|
FOAM_APP="$thisScript" \
|
||||||
FOAM_ARGS="$passArgs ${runType:+--run=$runType} $*"
|
FOAM_ARGS="$passArgs ${runType:+--run=$runType} $*"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd "${0%/*}" || exit # Run from this directory
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
. ${WM_PROJECT_DIR:?}/bin/tools/LogFunctions # Tutorial log-file functions
|
. "${WM_PROJECT_DIR:?}"/bin/tools/LogFunctions # Tutorial log-file functions
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
echo "--------"
|
echo "--------"
|
||||||
@ -10,7 +10,7 @@ buildDir="${WM_PROJECT_DIR}/build/${WM_OPTIONS}/${PWD##*/}"
|
|||||||
if [ -d "$buildDir" ]
|
if [ -d "$buildDir" ]
|
||||||
then
|
then
|
||||||
echo "Removing old build directory: $buildDir" 1>&2
|
echo "Removing old build directory: $buildDir" 1>&2
|
||||||
rm -rf $buildDir
|
rm -rf -- "$buildDir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
removeLogs
|
removeLogs
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd "${0%/*}" || exit # Run from this directory
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
. ${WM_PROJECT_DIR:?}/bin/tools/LogFunctions # Tutorial log-file functions
|
. "${WM_PROJECT_DIR:?}"/bin/tools/LogFunctions # Tutorial log-file functions
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Collect log files as 'testLoopReport'
|
# Collect log files as 'testLoopReport'
|
||||||
|
|||||||
Reference in New Issue
Block a user