diff --git a/bin/foamCleanTutorials b/bin/foamCleanTutorials
index 7f63ff43ee..2c897a3d7e 100755
--- a/bin/foamCleanTutorials
+++ b/bin/foamCleanTutorials
@@ -75,6 +75,7 @@ cleanType=auto
if [ "$#" -gt 0 ]
then
+ unset caseDir
case "$1" in
(- | --)
shift
@@ -102,31 +103,32 @@ then
;;
-case=*)
- caseName="${1#*=}"
- cd "$caseName" 2>/dev/null || {
- echo "${0##*}: No such directory $caseName" 1>&2
- exit 2
- }
+ caseDir="${1#*=}"
;;
-case)
+ caseDir="$2"
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
shift
- cd "$1" 2>/dev/null || {
- echo "${0##*}: No such directory $1" 1>&2
- exit 2
- }
;;
-self* | -skipFirst)
skipSelf=true
;;
+
+ -*) die "unknown option: $1" ;;
+
*)
- cd "$1" 2>/dev/null || {
- echo "${0##*}: No such directory $1" 1>&2
- exit 2
- }
+ caseDir="$1"
;;
esac
shift
+
+ if [ -n "$caseDir" ]
+ then
+ cd "$caseDir" 2>/dev/null || {
+ echo "${0##*/}: No such directory $caseDir" 1>&2
+ exit 2
+ }
+ fi
fi
diff --git a/bin/foamRunTutorials b/bin/foamRunTutorials
index aee01174a8..a12f907db0 100755
--- a/bin/foamRunTutorials
+++ b/bin/foamRunTutorials
@@ -78,6 +78,7 @@ unset passArgs runTests runType skipSelf
while [ "$#" -gt 0 ]
do
+ unset caseDir
case "$1" in
(- | --)
shift
@@ -106,19 +107,12 @@ do
;;
-case=*)
- caseName="${1#*=}"
- cd "$caseName" 2>/dev/null || {
- echo "${0##*}: No such directory $caseName" 1>&2
- exit 2
- }
+ caseDir="${1#*=}"
;;
-case)
- [ "$#" -ge 2 ] || die "'$1' option requires an argument"
+ caseDir="$2"
+ [ -n "$#" -ge 2 ] || die "'$1' option requires an argument"
shift
- cd "$1" 2>/dev/null || {
- echo "${0##*}: No such directory $1" 1>&2
- exit 2
- }
;;
# Avoid infinite recursion when invoked from an Allrun/Alltest script
@@ -130,6 +124,14 @@ do
;;
esac
shift
+
+ if [ -n "$caseDir" ]
+ then
+ cd "$caseDir" 2>/dev/null || {
+ echo "${0##*/}: No such directory $caseDir" 1>&2
+ exit 2
+ }
+ fi
done
diff --git a/bin/tools/LogFunctions b/bin/tools/LogFunctions
index 4bac22234b..74d979707f 100644
--- a/bin/tools/LogFunctions
+++ b/bin/tools/LogFunctions
@@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
-# Copyright (C) 2017-2019 OpenCFD Ltd.
+# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -114,7 +114,7 @@ removeLogs()
-name '*.pvs' -o -name '*.foam' -o -name '*.OpenFOAM' \
\) -type f -delete
- rm -f logs testLoopReport
+ rm -f logs testLoopReport log.Allrun log.Alltest
}
diff --git a/tutorials/Allclean b/tutorials/Allclean
index 56f343f88e..0f406d18df 100755
--- a/tutorials/Allclean
+++ b/tutorials/Allclean
@@ -6,7 +6,7 @@ cd "${0%/*}" || exit # Run from this directory
echo "--------"
# Remove old build/ directory
-buildDir="$WM_PROJECT_DIR/build/${WM_OPTIONS}/${PWD##*/}"
+buildDir="${WM_PROJECT_DIR}/build/${WM_OPTIONS}/${PWD##*/}"
if [ -d "$buildDir" ]
then
echo "Removing old build directory: $buildDir" 1>&2
@@ -16,7 +16,7 @@ fi
removeLogs
echo "Cleaning tutorials ..."
-foamCleanTutorials -self
+foamCleanTutorials -self # Run recursively but avoid self
echo "--------"
diff --git a/tutorials/Allrun b/tutorials/Allrun
index fdcc8f4a1b..969585f220 100755
--- a/tutorials/Allrun
+++ b/tutorials/Allrun
@@ -7,11 +7,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
-# Copyright (C) 2017-2019 OpenCFD Ltd.
+# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# Allrun
@@ -22,21 +21,34 @@
#------------------------------------------------------------------------------
cd "${0%/*}" || exit # Run from this directory
-usage()
+printHelp()
{
- exec 1>&2
- while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<&2
+ echo
+ echo "Error encountered:"
+ while [ "$#" -ge 1 ]; do echo " $1"; shift; done
+ echo
+ echo "See '${0##*/} -help' for usage"
+ echo
exit 1
}
@@ -47,21 +59,21 @@ unset optCollect
while [ "$#" -gt 0 ]
do
case "$1" in
- -h | -help*)
- usage
+ ('') ;;
+ (- | --)
+ shift
+ break # Stop option parsing
;;
- -collect)
- optCollect=true
- ;;
- -test) # Known options to pass through
- break
- ;;
- -*)
- usage "unknown option: $1"
- ;;
- *)
- break
+ (-h | -help* | --help*)
+ printHelp
;;
+
+ -collect) optCollect=true ;;
+ -no-collect) optCollect=false ;;
+ -test) break;; # Pass-thru option, and stop option parsing
+
+ -*) die "unknown option: $1" ;;
+ *) break;; # Pass-thru arguments
esac
shift
done
@@ -69,11 +81,50 @@ done
#------------------------------------------------------------------------------
. ${WM_PROJECT_DIR:?}/bin/tools/LogFunctions # Tutorial log-file functions
-if [ -z "$optCollect" ]
+printRunHeader()
+{
+ echo "========================================"
+ date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
+ echo "$@: ${WM_PROJECT_DIR##*/}"
+ echo " $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
+ echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
+ echo "========================================"
+}
+
+printRunEnviron()
+{
+ echo "PATH:$PATH" | sed 's/::*/\n /g'
+ echo ==
+ if [ -n "$DYLD_LIBRARY_PATH" ]
+ then
+ echo "DYLD_LIBRARY_PATH:$DYLD_LIBRARY_PATH" | sed 's/::*/\n /g'
+ echo ==
+ fi
+ if [ -n "$LD_LIBRARY_PATH" ]
+ then
+ echo "LD_LIBRARY_PATH:$LD_LIBRARY_PATH" | sed 's/::*/\n /g'
+ echo ==
+ fi
+}
+
+
+if [ "$optCollect" != true ]
then
- foamRunTutorials -skipFirst $* # Run recursively
+ printRunHeader "Starting run" | tee log.Allrun
+ printRunEnviron | tee -a log.Allrun
+
+ foamRunTutorials -self $* # Run recursively but avoid self
+
+ printRunHeader "Finishing run" | tee -a log.Allrun
+fi
+
+if [ "$optCollect" = false ]
+then
+ echo "Collecting log files - disabled"
+else
+ # Collect log files as 'testLoopReport'
+ collectLogs
fi
-collectLogs
#------------------------------------------------------------------------------
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/plot b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/plot
index 8e3dd2c449..d4cc841205 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/plot
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/plot
@@ -10,20 +10,7 @@
# Copyright (C) 2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM.
-#
-# OpenFOAM is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OpenFOAM. If not, see .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# plot
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/jouleHeatingSolid/plot b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/jouleHeatingSolid/plot
index 594f80bd23..8110c84600 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/jouleHeatingSolid/plot
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/jouleHeatingSolid/plot
@@ -9,20 +9,7 @@
# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM.
-#
-# OpenFOAM is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OpenFOAM. If not, see .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# plot
diff --git a/tutorials/incompressible/adjointOptimisationFoam/Allrun b/tutorials/incompressible/adjointOptimisationFoam/Alltest
similarity index 55%
rename from tutorials/incompressible/adjointOptimisationFoam/Allrun
rename to tutorials/incompressible/adjointOptimisationFoam/Alltest
index 918d9a51a3..0258ca10a1 100755
--- a/tutorials/incompressible/adjointOptimisationFoam/Allrun
+++ b/tutorials/incompressible/adjointOptimisationFoam/Alltest
@@ -1,13 +1,7 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
-. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
-if notTest "$@"
-then
- foamRunTutorials -skipFirst
-else
- echo "--- Skipping testing of tutorials in : $PWD" 1>&2
-fi
+echo "--- Skipping testing of tutorials in : $PWD" 1>&2
#------------------------------------------------------------------------------