CONFIG: add date and paths information for tutorial Allrun script
STYLE: replace short-circuit Allrun script with Alltest
This commit is contained in:
parent
134aaee91a
commit
fcd7423fa8
@ -75,6 +75,7 @@ cleanType=auto
|
|||||||
|
|
||||||
if [ "$#" -gt 0 ]
|
if [ "$#" -gt 0 ]
|
||||||
then
|
then
|
||||||
|
unset caseDir
|
||||||
case "$1" in
|
case "$1" in
|
||||||
(- | --)
|
(- | --)
|
||||||
shift
|
shift
|
||||||
@ -102,31 +103,32 @@ then
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
-case=*)
|
-case=*)
|
||||||
caseName="${1#*=}"
|
caseDir="${1#*=}"
|
||||||
cd "$caseName" 2>/dev/null || {
|
|
||||||
echo "${0##*}: No such directory $caseName" 1>&2
|
|
||||||
exit 2
|
|
||||||
}
|
|
||||||
;;
|
;;
|
||||||
-case)
|
-case)
|
||||||
|
caseDir="$2"
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
shift
|
shift
|
||||||
cd "$1" 2>/dev/null || {
|
|
||||||
echo "${0##*}: No such directory $1" 1>&2
|
|
||||||
exit 2
|
|
||||||
}
|
|
||||||
;;
|
;;
|
||||||
-self* | -skipFirst)
|
-self* | -skipFirst)
|
||||||
skipSelf=true
|
skipSelf=true
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-*) die "unknown option: $1" ;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
cd "$1" 2>/dev/null || {
|
caseDir="$1"
|
||||||
echo "${0##*}: No such directory $1" 1>&2
|
|
||||||
exit 2
|
|
||||||
}
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
if [ -n "$caseDir" ]
|
||||||
|
then
|
||||||
|
cd "$caseDir" 2>/dev/null || {
|
||||||
|
echo "${0##*/}: No such directory $caseDir" 1>&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ unset passArgs runTests runType skipSelf
|
|||||||
|
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
|
unset caseDir
|
||||||
case "$1" in
|
case "$1" in
|
||||||
(- | --)
|
(- | --)
|
||||||
shift
|
shift
|
||||||
@ -106,19 +107,12 @@ do
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
-case=*)
|
-case=*)
|
||||||
caseName="${1#*=}"
|
caseDir="${1#*=}"
|
||||||
cd "$caseName" 2>/dev/null || {
|
|
||||||
echo "${0##*}: No such directory $caseName" 1>&2
|
|
||||||
exit 2
|
|
||||||
}
|
|
||||||
;;
|
;;
|
||||||
-case)
|
-case)
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
caseDir="$2"
|
||||||
|
[ -n "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
shift
|
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
|
# Avoid infinite recursion when invoked from an Allrun/Alltest script
|
||||||
@ -130,6 +124,14 @@ do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
if [ -n "$caseDir" ]
|
||||||
|
then
|
||||||
|
cd "$caseDir" 2>/dev/null || {
|
||||||
|
echo "${0##*/}: No such directory $caseDir" 1>&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# \\ / A nd | www.openfoam.com
|
# \\ / A nd | www.openfoam.com
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2017-2019 OpenCFD Ltd.
|
# Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
# 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' \
|
-name '*.pvs' -o -name '*.foam' -o -name '*.OpenFOAM' \
|
||||||
\) -type f -delete
|
\) -type f -delete
|
||||||
|
|
||||||
rm -f logs testLoopReport
|
rm -f logs testLoopReport log.Allrun log.Alltest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ cd "${0%/*}" || exit # Run from this directory
|
|||||||
echo "--------"
|
echo "--------"
|
||||||
|
|
||||||
# Remove old build/ directory
|
# Remove old build/ directory
|
||||||
buildDir="$WM_PROJECT_DIR/build/${WM_OPTIONS}/${PWD##*/}"
|
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
|
||||||
@ -16,7 +16,7 @@ fi
|
|||||||
removeLogs
|
removeLogs
|
||||||
|
|
||||||
echo "Cleaning tutorials ..."
|
echo "Cleaning tutorials ..."
|
||||||
foamCleanTutorials -self
|
foamCleanTutorials -self # Run recursively but avoid self
|
||||||
|
|
||||||
echo "--------"
|
echo "--------"
|
||||||
|
|
||||||
|
@ -7,11 +7,10 @@
|
|||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# Copyright (C) 2017-2019 OpenCFD Ltd.
|
# Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# 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.
|
||||||
# <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# Allrun
|
# Allrun
|
||||||
@ -22,21 +21,34 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
cd "${0%/*}" || exit # Run from this directory
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
|
||||||
usage()
|
printHelp()
|
||||||
{
|
{
|
||||||
exec 1>&2
|
|
||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
|
||||||
cat<<USAGE
|
cat<<USAGE
|
||||||
|
|
||||||
usage: ${0##*/} [OPTION]
|
Usage: ${0##*/} [OPTION]
|
||||||
|
|
||||||
options:
|
options:
|
||||||
-collect Collect logs only. Can be useful for aborted runs.
|
-collect Collect logs only. Can be useful for aborted runs.
|
||||||
|
-no-collect Run without collecting logs
|
||||||
|
-test Pass -test argument to scripts, end of option processing
|
||||||
|
-- End of option processing
|
||||||
-help print the usage
|
-help print the usage
|
||||||
|
|
||||||
Run tutorial cases and summarize the outcome as 'testLoopReport'
|
Run tutorial cases and summarize the outcome as 'testLoopReport'
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
|
exit 0 # A clean exit
|
||||||
|
}
|
||||||
|
|
||||||
|
# Report error and exit
|
||||||
|
die()
|
||||||
|
{
|
||||||
|
exec 1>&2
|
||||||
|
echo
|
||||||
|
echo "Error encountered:"
|
||||||
|
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||||
|
echo
|
||||||
|
echo "See '${0##*/} -help' for usage"
|
||||||
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,21 +59,21 @@ unset optCollect
|
|||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h | -help*)
|
('') ;;
|
||||||
usage
|
(- | --)
|
||||||
|
shift
|
||||||
|
break # Stop option parsing
|
||||||
;;
|
;;
|
||||||
-collect)
|
(-h | -help* | --help*)
|
||||||
optCollect=true
|
printHelp
|
||||||
;;
|
|
||||||
-test) # Known options to pass through
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
-*)
|
|
||||||
usage "unknown option: $1"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
break
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-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
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -69,11 +81,50 @@ done
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
. ${WM_PROJECT_DIR:?}/bin/tools/LogFunctions # Tutorial log-file functions
|
. ${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
|
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
|
fi
|
||||||
|
|
||||||
collectLogs
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -10,20 +10,7 @@
|
|||||||
# Copyright (C) 2021 OpenCFD Ltd.
|
# Copyright (C) 2021 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM.
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
#
|
|
||||||
# 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 <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# plot
|
# plot
|
||||||
|
@ -9,20 +9,7 @@
|
|||||||
# Copyright (C) 2017-2021 OpenCFD Ltd.
|
# Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM.
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
#
|
|
||||||
# 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 <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# plot
|
# plot
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd "${0%/*}" || exit # Run from this directory
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
if notTest "$@"
|
echo "--- Skipping testing of tutorials in : $PWD" 1>&2
|
||||||
then
|
|
||||||
foamRunTutorials -skipFirst
|
|
||||||
else
|
|
||||||
echo "--- Skipping testing of tutorials in : $PWD" 1>&2
|
|
||||||
fi
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
Loading…
Reference in New Issue
Block a user