Newer
Older
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# Allrun
#
# Description
# Run tutorial cases and summarize the outcome as 'testLoopReport'
#
#------------------------------------------------------------------------------
cd "${0%/*}" || exit # Run from this directory
printHelp()
Usage: ${0##*/} [OPTION]
options:
-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
Run tutorial cases and summarize the outcome as 'testLoopReport'
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
}
#------------------------------------------------------------------------------
unset optCollect
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
('') ;;
(- | --)
shift
break # Stop option parsing
(-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
#------------------------------------------------------------------------------
. ${WM_PROJECT_DIR:?}/bin/tools/LogFunctions # Tutorial log-file functions
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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
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 ]
echo "Collecting log files - disabled"
else
# Collect log files as 'testLoopReport'
collectLogs
#------------------------------------------------------------------------------