2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright held by original author
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 the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # 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, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 # foamInstallationTest
30 # Checks the machine system, the installation of OpenFOAM, and the user's
31 # personal configuration for running OpenFOAM.
33 #------------------------------------------------------------------------------
37 SUPPLIED_VERSION_GCC
=4.3.3
52 if [ ! -n $USER_NAME ]; then
56 #==============================================================================
58 #==============================================================================
61 echo "-------------------------------------------------------------------------------"
78 echo $1 |
tr -d " " |
wc -m |
tr -d " "
84 NOCHAR
=`expr $NOCHAR - 1`
85 if [ $NOCHAR -eq -1 ]; then
93 echo $1 |
wc -m |
tr -d " "
99 ONELEN
=`stringLength $1`
100 LDIFF
=`expr $ONELEN - $2`
101 if [ $LDIFF -le 1 ]; then
102 while [ $LDIFF -lt 0 ] ; do
104 LDIFF
=`expr $LDIFF + 1`
108 LDIFF
=`expr $LDIFF + 4`
109 WORD
=`echo "$WORD" | cut -c${LDIFF}-`
116 EXP_ENV
=`eval "echo $1"`
117 EXP_PATH
=`eval "echo $2"`
121 if [ `length $EXP_ENV` -gt 0 ] ; then
124 if /usr
/bin
/test -e $EXP_ENV ; then
126 if [ "$2" != noPath
]; then
135 -o "$e" = "${EXP_ENV}/bin" \
136 -o "${EXP_ENV}/lib" = "$e" \
148 echo "`fixlen "$1" 21` `fixlen "$EXP_ENV" 40` $EXISTS $ON_PATH $CRIT"
151 if [ -e "$EXP_ENV" ] ; then
153 if [ "$2" != noPath
]; then
162 -o "$e" = "${EXP_ENV}/bin" \
163 -o "${EXP_ENV}/lib" = "$e" \
175 echo "`fixlen "$1" 21` `fixlen "$EXP_ENV" 40` $EXISTS $ON_PATH $CRIT"
179 echo "`fixlen "$1" 21` --------- env variable not set --------- $3"
183 if [ "$EXISTS" = no
] ||
[ "$ON_PATH" = no
]; then
186 if [ "$3" = yes ] && [ "$ERROR" = true
]; then
187 CRITICALERROR
=`expr $CRITICALERROR + 1`
188 echo "WARNING: CRITICAL ERROR"
202 if /usr
/bin
/test ! -d "$d/$2" -a -x "$d/$2" ; then
209 if [ ! -d "$d/$2" -a -x "$d/$2" ]; then
222 reportExecutable
() {
224 APP_PATH
=`findExec $PATH $1`
226 if [ ! -n $APP_PATH ];then
227 echo "`fixlen "$1" 9`" "*** not installed ***"
231 echo " CRITICAL ERROR"
232 CRITICALERROR
=`expr $CRITICALERROR + 1`
235 echo " CRITICAL ERROR"
236 CRITICALERROR
=`expr $CRITICALERROR + 1`
249 | \grep ' Version:' \
250 | sed -e 's/.*Version:/Version:/' \
254 VERSION
=`$1 -v 2>&1 \
255 | grep 'gcc version' \
257 if [ ! "$VERSION" = "$SUPPLIED_VERSION_GCC" ]; then
258 echo "WARNING: gcc version does not match gcc supplied" \
259 "with this release of OpenFOAM"
260 echo " Supplied version: $SUPPLIED_VERSION_GCC"
261 echo " User version : $VERSION"
262 echo " Minimum required: $MIN_VERSION_GCC"
267 VERSION
=`$APP_PATH --version | head -1`
270 VERSION
=`$APP_PATH --version | head -1 | cut -d" " -f4`
275 VERSION
=`$1 --version 2>&1 | grep gzip | cut -d" " -f2`
278 VERSION
=`$1 --version | head -1 | cut -d" " -f2`
283 if [ "$APP_PATH" = "$APP_SPEC" ] ||
[ ! "$2" ]; then
284 echo "`fixlen "$1" 9` `fixlen "$VERSION" 10` `fixlen "$APP_PATH" 58`"
286 echo "`fixlen "$1" 9` `fixlen "$VERSION" 10`"
287 echo "WARNING: Conflicting installations:"
288 echo " OpenFOAM settings : $APP_SPEC"
289 echo " current path : $APP_PATH"
292 echo " CRITICAL ERROR"
293 CRITICALERROR
=`expr $CRITICALERROR + 1`
296 echo " CRITICAL ERROR"
297 CRITICALERROR
=`expr $CRITICALERROR + 1`
312 PINGTEST
=`/usr/sbin/ping $1 2>&1`
313 if [ "`echo $PINGTEST | grep alive`" != "" ] ; then
315 elif [ "`echo $PINGTEST | grep 'unknown host'`" != "" ] ; then
316 RESULT
="No_entry_for_\"$1\"_in_/etc/hosts"
318 RESULT
="Networking_cannot_reach_$1"
322 PINGTEST
=`/bin/ping -w 3 -c 1 $1 2>&1`
323 if [ "`echo $PINGTEST | grep '1 received'`" != "" ] ; then
325 elif [ "`echo $PINGTEST | grep 'unknown host'`" != "" ] ; then
326 RESULT
="No_entry_for_\"$1\"_in_/etc/hosts"
328 RESULT
="Networking_cannot_reach_$1"
333 echo "`fixlen "Pinging_
$1" 25` `fixlen "$RESULT" 45` `fixlen "$2" 5`"
335 if [ "$2" = yes ] && [ "$RESULT" != Successful
]; then
336 CRITICALERROR
=`expr $CRITICALERROR + 1`
337 echo "WARNING: CRITICAL ERROR"
344 telnet -e A
$1 $2 <<EOF
352 if [ -x "/usr/bin/telnet" ] ||
[ -x "/bin/telnet" ] ; then
353 RESULT
=`telnetPortTest $1 $2 2>&1 | egrep "onnect.* [t|r]"`
354 if [ "`echo $RESULT | grep 'Connected to'`" ] ; then
356 elif [ "`echo $RESULT | grep 'Connection refused'`" ] ; then
357 RESULT
='Unsuccessful_connection_refused*'
362 RESULT
='No_telnet_installed:_cannot_check*'
368 checkTelnetPort
$HOST_NAME 222
369 echo "`fixlen "Test_rsh
:" 25` `fixlen "$RESULT" 45` "yes""
370 if [ "$RESULT" != Successful
]; then
371 SSHRSHOK
=`expr $SSHRSHOK + 1`
377 checkTelnetPort
$HOST_NAME 22
378 echo "`fixlen "Test_ssh
:" 25` `fixlen "$RESULT" 45` "yes""
379 if [ "$RESULT" != Successful
]; then
380 SSHRSHOK
=`expr $SSHRSHOK + 1`
385 checkOpenFOAMEnvironment
() {
386 [ -d "$WM_PROJECT_INST_DIR" ] && [ -d "$WM_THIRD_PARTY_DIR" ] ||
{
388 echo "FATAL ERROR: OpenFOAM environment not configured."
390 echo " Please refer to the installation section of the README file:"
391 echo " <OpenFOAM installation dir>/OpenFOAM-${FOAM_VERSION}/README"
392 echo " to source the OpenFOAM environment."
402 # USER_CONFIG_TYPE="cshrc"
403 echo "`fixlen "Shell
:" $WIDTH` ${SHELL##*/}"
406 # USER_CONFIG_TYPE="bashrc"
407 echo "`fixlen "Shell
:" $WIDTH` ${SHELL##*/}"
410 # USER_CONFIG_TYPE=""
411 echo "`fixlen "Shell
:" $WIDTH` ${SHELL##*/}"
412 echo "FATAL ERROR: Cannot identify the shell you are running."
413 echo " OpenFOAM ${FOAM_VERSION} is compatible with "
414 echo " csh, tcsh, ksh and bash."
416 FATALERROR
=`expr $FATALERROR + 1`;;
422 if [ ! "$HOST_NAME" ]; then
423 echo "`fixlen "Host
:" $WIDTH` ${HOST_NAME}"
424 echo "FATAL ERROR: Cannot stat hostname."
425 echo " Contact your system administrator, "
426 echo " OpenFOAM ${FOAM_VERSION} needs a valid "
427 echo " hostname to function."
429 FATALERROR
=`expr $FATALERROR + 1`
431 echo "`fixlen "Host
:" $WIDTH` ${HOST_NAME}"
438 Linux | LinuxAMD64 | SunOS
)
439 echo "`fixlen "OS
:" $WIDTH` ${OS} version $(uname -r)"
442 echo "FATAL ERROR: Incompatible operating system \"$OS\"."
443 echo " OpenFOAM ${FOAM_VERSION} is currently "
444 echo " available for Linux and SunOS only."
446 FATALERROR
=`expr $FATALERROR + 1`
452 #==============================================================================
454 #==============================================================================
458 #------------------------------------------------------------------------------
459 heading
"Checking basic setup..."
461 checkOpenFOAMEnvironment
467 #------------------------------------------------------------------------------
468 heading
"Checking main OpenFOAM env variables..."
469 COL1
=`fixlen "Environment_variable" 21`
470 COL2
=`fixlen "Set_to_file_or_directory" 40`
475 echo "$COL1 $COL2 $COL3 $COL5"
477 reportEnv
'$WM_PROJECT_INST_DIR' 'noPath' "yes"
478 reportEnv
'$WM_PROJECT_USER_DIR' 'noPath' "no"
479 reportEnv
'$WM_THIRD_PARTY_DIR' 'noPath' "yes"
482 #------------------------------------------------------------------------------
483 heading
"Checking the OpenFOAM env variables set on the PATH..."
485 echo "$COL1 $COL2 $COL3 $COL4 $COL5"
487 reportEnv
'$WM_PROJECT_DIR' '$PATH' "yes"
489 reportEnv
'$FOAM_APPBIN' '$PATH' "yes"
490 reportEnv
'$FOAM_SITE_APPBIN' '$PATH' "no"
491 reportEnv
'$FOAM_USER_APPBIN' '$PATH' "no"
492 reportEnv
'$WM_DIR' '$PATH' "yes"
495 #------------------------------------------------------------------------------
496 heading
"Checking the OpenFOAM env variables set on the LD_LIBRARY_PATH..."
498 echo "$COL1 $COL2 $COL3 $COL4 $COL5"
500 reportEnv
'$FOAM_LIBBIN' '$LD_LIBRARY_PATH' "yes"
501 reportEnv
'$FOAM_SITE_LIBBIN' '$LD_LIBRARY_PATH' "no"
502 reportEnv
'$FOAM_USER_LIBBIN' '$LD_LIBRARY_PATH' "no"
503 reportEnv
'$MPI_ARCH_PATH' '$LD_LIBRARY_PATH' "yes"
506 #------------------------------------------------------------------------------
507 heading
"Third party software"
508 COL1
=`fixlen "Software" 9`
509 COL2
=`fixlen "Version" 10`
510 COL3
=`fixlen "Location" 10`
512 echo "$COL1 $COL2 $COL3"
514 reportExecutable gcc
"${WM_COMPILER_DIR}/bin/gcc"
515 reportExecutable
gzip
516 if [ "$OS" = Linux
] ; then
519 reportExecutable gtar
521 reportExecutable icoFoam
"${FOAM_APPBIN}/icoFoam"
525 #------------------------------------------------------------------------------
529 if [ $FATALERROR -gt 0 ] ; then
530 echo "The system test has evoked $FATALERROR fatal error(s)."
532 echo "Base configuration ok."
535 if [ $CRITICALERROR -gt 0 ]; then
536 echo "The foam installation contains $CRITICALERROR critical error(s)."
538 echo "Critical systems ok."
541 if [ $CRITICALERROR -gt 0 ] ||
[ $FATALERROR -gt 0 ]; then
542 echo "Review the output for warning messages and consult "
543 echo "the installation guide for trouble shooting."
553 #------------------------------------------------------------------------------