2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
8 #-------------------------------------------------------------------------------
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 # foamInstallationTest
29 # Checks the machine system, the installation of OpenFOAM, and the user's
30 # personal configuration for running OpenFOAM.
32 #------------------------------------------------------------------------------
50 # which OpenFOAM application to test for the Version
53 #==============================================================================
55 #==============================================================================
59 echo "-------------------------------------------------------------------------------"
73 echo $1 |
tr -d " " |
wc -m |
tr -d " "
80 NOCHAR
=`expr $NOCHAR - 1`
81 [ $NOCHAR -ge 0 ] || NOCHAR
=0
88 echo $1 |
wc -m |
tr -d " "
95 ONELEN
=`stringLength $1`
96 LDIFF
=`expr $ONELEN - $2`
99 while [ $LDIFF -lt 0 ]
102 LDIFF
=`expr $LDIFF + 1`
106 LDIFF
=`expr $LDIFF + 4`
107 WORD
=`echo "$WORD" | cut -c${LDIFF}-`
115 EXP_ENV
=`eval "echo $1"`
116 EXP_PATH
=`eval "echo $2"`
120 if [ `length $EXP_ENV` -gt 0 ]
124 if /usr
/bin
/test -e $EXP_ENV
127 if [ "$2" != noPath
]
135 "$EXP_ENV" |
"$EXP_ENV/bin" |
"$EXP_ENV/lib")
147 echo "`fixlen "$1" 21` `fixlen "$EXP_ENV" 40` $EXISTS $ON_PATH $CRIT"
153 if [ "$2" != noPath
]
161 "$EXP_ENV" |
"$EXP_ENV/bin" |
"$EXP_ENV/lib")
173 echo "`fixlen "$1" 21` `fixlen "$EXP_ENV" 40` $EXISTS $ON_PATH $CRIT"
177 echo "`fixlen "$1" 21` --------- env variable not set --------- $3"
181 if [ "$EXISTS" = no
] ||
[ "$ON_PATH" = no
]
185 if [ "$3" = yes ] && [ "$ERROR" = true
]
187 criticalError
=`expr $criticalError + 1`
188 echo "WARNING: CRITICAL ERROR"
203 if /usr
/bin
/test ! -d "$d/$2" -a -x "$d/$2"
211 if [ ! -d "$d/$2" -a -x "$d/$2" ]
228 APP_PATH
=`findExec $PATH $1`
230 if [ ! -n $APP_PATH ]
232 echo "`fixlen "$1" 9`" "*** not installed ***"
236 echo " CRITICAL ERROR"
237 criticalError
=`expr $criticalError + 1`
245 VERSION
=`$1 -case /dev/null 2>&1 \
246 | sed -ne 's/^.*Version: *\([^ ][^ ]*\).*/\1/p'`
249 VERSION
=`$1 --version /dev/null 2>&1 \
250 | sed -ne 's/flex \([0-9][0-9.]*\).*/\1/p' `
253 VERSION
=`$1 -v 2>&1 \
254 | sed -ne 's/^gcc version \([0-9][0-9.]*\).*/\1/p' `
256 MINV1
=`echo $MIN_VERSION_GCC | cut -d. -f1`
257 MINV2
=`echo $MIN_VERSION_GCC | cut -d. -f2`
258 MINV3
=`echo $MIN_VERSION_GCC | cut -d. -f3`
260 V1
=`echo $VERSION | cut -d. -f1`
261 V2
=`echo $VERSION | cut -d. -f2`
262 V3
=`echo $VERSION | cut -d. -f3`
267 if [ $V1 -lt $MINV1 ]; then
269 elif [ $V1 -gt $MINV1 ]; then
273 if [ "$pass" = "" ] && [ "$gccOk" = "" ]; then
274 if [ $V2 -lt $MINV2 ]; then
276 elif [ $V2 -gt $MINV2 ]; then
281 if [ "$pass" = "" ] && [ "$gccOk" = "" ] && [ $V3 != "" ] && [ $MINV3 != "" ]; then
282 if [ $V3 -lt $MINV3 ]; then
287 if [ "$gccOk" != "" ]; then
288 echo "ERROR: gcc version is too old for this release of OpenFOAM"
289 echo " User version : $VERSION"
290 echo " Minimum required: $MIN_VERSION_GCC"
292 fatalError
=`expr $fatalError + 1`
298 VERSION
=`$APP_PATH --version | head -1`
301 VERSION
=`$APP_PATH --version | head -1 | cut -d" " -f4`
306 VERSION
=`$1 --version 2>&1 | grep gzip | cut -d" " -f2`
309 VERSION
=`$1 --version | head -1 | cut -d" " -f2`
314 if [ "$APP_PATH" = "$APP_SPEC" ] ||
[ ! "$2" ]
316 echo "`fixlen "$1" 9` `fixlen "$VERSION" 10` `fixlen "$APP_PATH" 58`"
318 echo "`fixlen "$1" 9` `fixlen "$VERSION" 10`"
319 echo "WARNING: Conflicting installations:"
320 echo " OpenFOAM settings : $APP_SPEC"
321 echo " current path : $APP_PATH"
324 echo " CRITICAL ERROR"
325 criticalError
=`expr $criticalError + 1`
333 checkOpenFOAMEnvironment
()
335 [ -d "$WM_PROJECT_INST_DIR" ] && [ -d "$WM_THIRD_PARTY_DIR" ] ||
{
337 echo "FATAL ERROR: OpenFOAM environment not configured."
339 echo " Please refer to the installation section of the README file:"
340 echo " <OpenFOAM installation dir>/OpenFOAM-${WM_PROJECT_VERSION}/README"
341 echo " to source the OpenFOAM environment."
350 echo "`fixlen Shell: $WIDTH` ${SHELL##*/}"
352 */csh |
*/tcsh |
*/bash |
*/ksh
)
355 echo "FATAL ERROR: Cannot identify the shell you are running."
356 echo " OpenFOAM ${WM_PROJECT_VERSION} is compatible with "
357 echo " csh, tcsh, ksh and bash."
359 fatalError
=`expr $fatalError + 1`
367 echo "`fixlen Host: $WIDTH` $HOST"
370 echo "FATAL ERROR: Cannot stat hostname."
371 echo " Contact your system administrator, "
372 echo " OpenFOAM ${WM_PROJECT_VERSION} needs a valid "
373 echo " hostname to function."
375 fatalError
=`expr $fatalError + 1`
383 Linux | LinuxAMD64 | SunOS
)
384 echo "`fixlen OS: $WIDTH` $OSTYPE version $(uname -r)"
387 echo "FATAL ERROR: Incompatible operating system \"$OSTYPE\"."
388 echo " OpenFOAM ${FWM_PROJECT_VERSION} is currently "
389 echo " available for Linux and SunOS only."
391 fatalError
=`expr $fatalError + 1`
397 #==============================================================================
399 #==============================================================================
403 #------------------------------------------------------------------------------
404 heading
"Checking basic setup..."
406 checkOpenFOAMEnvironment
412 #------------------------------------------------------------------------------
413 heading
"Checking main OpenFOAM env variables..."
414 COL1
=`fixlen Environment_variable 21`
415 COL2
=`fixlen Set_to_file_or_directory 40`
420 echo "$COL1 $COL2 $COL3 $COL5"
422 reportEnv
'$WM_PROJECT_INST_DIR' 'noPath' "yes"
423 reportEnv
'$WM_PROJECT_USER_DIR' 'noPath' "no"
424 reportEnv
'$WM_THIRD_PARTY_DIR' 'noPath' "yes"
427 #------------------------------------------------------------------------------
428 heading
"Checking the OpenFOAM env variables set on the PATH..."
430 echo "$COL1 $COL2 $COL3 $COL4 $COL5"
432 reportEnv
'$WM_PROJECT_DIR' '$PATH' "yes"
434 reportEnv
'$FOAM_APPBIN' '$PATH' "yes"
435 reportEnv
'$FOAM_SITE_APPBIN' '$PATH' "no"
436 reportEnv
'$FOAM_USER_APPBIN' '$PATH' "no"
437 reportEnv
'$WM_DIR' '$PATH' "yes"
440 #------------------------------------------------------------------------------
441 heading
"Checking the OpenFOAM env variables set on the LD_LIBRARY_PATH..."
443 echo "$COL1 $COL2 $COL3 $COL4 $COL5"
445 reportEnv
'$FOAM_LIBBIN' '$LD_LIBRARY_PATH' "yes"
446 reportEnv
'$FOAM_SITE_LIBBIN' '$LD_LIBRARY_PATH' "no"
447 reportEnv
'$FOAM_USER_LIBBIN' '$LD_LIBRARY_PATH' "no"
448 reportEnv
'$MPI_ARCH_PATH' '$LD_LIBRARY_PATH' "yes"
451 #------------------------------------------------------------------------------
452 heading
"Third party software"
453 COL1
=`fixlen Software 9`
454 COL2
=`fixlen Version 10`
455 COL3
=`fixlen Location 10`
457 echo "$COL1 $COL2 $COL3"
459 reportExecutable flex
461 reportExecutable
gzip
462 if [ "$OSTYPE" = Linux
]
466 reportExecutable gtar
468 reportExecutable
$foamTestApp "$FOAM_APPBIN/$foamTestApp"
472 #------------------------------------------------------------------------------
476 if [ $fatalError -gt 0 ]
478 echo "The system test has evoked $fatalError fatal error(s)."
480 echo "Base configuration ok."
482 if [ $criticalError -gt 0 ]
484 echo "The foam installation contains $criticalError critical error(s)."
486 echo "Critical systems ok."
488 if [ $criticalError -gt 0 ] ||
[ $fatalError -gt 0 ]
491 echo "Review the output for warning messages and consult"
492 echo "the installation guide for troubleshooting."
501 #------------------------------------------------------------------------------