From 2068c67a3335bf95f7da22300cc7a9448c63827a Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Tue, 9 Mar 2010 17:16:23 +0100 Subject: [PATCH] ENH: 'wclean all' now uses either Allwclean or Allclean files if present. --- bin/foamCleanTutorials | 25 +++++++++++++--------- tutorials/Allclean | 32 +--------------------------- tutorials/Allrun | 19 +++++++---------- tutorials/Alltest | 4 +--- wmake/wclean | 48 +++++++++++++++++++++++------------------- wmake/wcleanAll | 4 ++-- wmake/wmake | 3 ++- 7 files changed, 55 insertions(+), 80 deletions(-) diff --git a/bin/foamCleanTutorials b/bin/foamCleanTutorials index 1e022460c1d..a837be69861 100755 --- a/bin/foamCleanTutorials +++ b/bin/foamCleanTutorials @@ -27,8 +27,8 @@ # foamCleanTutorials # # Description -# Run either Allclean or default cleanCase in current directory -# and all its subdirectories. +# Run either Allwclean, Allclean or default cleanCase in current directory +# and all its subdirectories. # #------------------------------------------------------------------------------ @@ -41,24 +41,29 @@ then thisScript="$PWD/$thisScript" fi -# If an argument is supplied do not execute ./Allclean to avoid recursion -if [ $# = 0 -a -f Allclean ] +# If an argument is supplied do not execute ./Allwclean or ./Allclean +# (to avoid recursion) +if [ $# -eq 0 -a -f Allwclean ] then - # Specialised script. + # Specialized script + ./Allwclean +elif [ $# -eq 0 -a -f Allclean ] +then + # Specialized script ./Allclean elif [ -d system ] then - # Normal case. + # Normal case cleanCase elif [ -d Make ] then - # Normal application. + # Normal application cleanApplication else - # Recurse to subdirectories - for caseDir in * + # Recurse into subdirectories + for caseName in * do - ( cd $caseDir 2>/dev/null && $thisScript ) + ( cd $caseName 2>/dev/null && $thisScript ) done fi diff --git a/tutorials/Allclean b/tutorials/Allclean index 57f63c776cc..f63088cbb75 100755 --- a/tutorials/Allclean +++ b/tutorials/Allclean @@ -1,35 +1,4 @@ #!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. -# \\/ M anipulation | -#------------------------------------------------------------------------------ -# 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 2 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, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# Script -# Allclean -# -# Description -# -#------------------------------------------------------------------------------ - cd ${0%/*} || exit 1 # run from this directory echo "--------" @@ -43,4 +12,5 @@ rm logs testLoopReport > /dev/null 2>&1 foamCleanTutorials cases echo "--------" + # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/Allrun b/tutorials/Allrun index bfc2241656e..b4e449dff62 100755 --- a/tutorials/Allrun +++ b/tutorials/Allrun @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -29,7 +29,6 @@ # Description # #------------------------------------------------------------------------------ - cd ${0%/*} || exit 1 # run from this directory # Source tutorial run functions @@ -38,9 +37,9 @@ cd ${0%/*} || exit 1 # run from this directory # logReport <logfile> # Extracts useful info from log file. logReport () { - case=`dirname $1 | sed s/"\(.*\)\.\/"/""/g` + caseName=`dirname $1 | sed s/"\(.*\)\.\/"/""/g` app=`echo $1 | sed s/"\(.*\)\."/""/g` - appAndCase="Application $app - case $case" + appAndCase="Application $app - case $caseName" fatalError=`grep "FOAM FATAL" $1` UxSS=`grep -E "Ux[:| ]*solution singularity" $1` @@ -51,11 +50,9 @@ logReport () { if [ "$fatalError" ] then echo "$appAndCase: ** FOAM FATAL ERROR **" - return elif [ "$UxSS" -a "$UySS" -a "$UzSS" ] then echo "$appAndCase: ** Solution singularity **" - return elif [ "$completed" ] then completionTime=`tail -10 $log | grep Execution | cut -d= -f2 | sed 's/^[ \t]*//'` @@ -64,7 +61,6 @@ logReport () { completionTime="in $completionTime" fi echo "$appAndCase: completed $completionTime" - return else echo "$appAndCase: unconfirmed completion" fi @@ -78,17 +74,18 @@ foamRunTutorials cases # Analyse all log files rm testLoopReport > /dev/null 2>&1 & touch testLoopReport -for application in * +for appDir in * do - if [ -d $application ] + if [ -d $appDir ] then - cd $application + ( + cd $appDir for log in `find . -name "log.*" | xargs ls -rt` do logReport $log >> ../testLoopReport done echo "" >> ../testLoopReport - cd .. + ) fi done diff --git a/tutorials/Alltest b/tutorials/Alltest index 5aaacba2aca..b2965f0fee4 100755 --- a/tutorials/Alltest +++ b/tutorials/Alltest @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -30,7 +30,6 @@ # quickly tests the tutorials and writes out the scheme/solver information # #------------------------------------------------------------------------------ - cd ${0%/*} || exit 1 # run from this directory usage() { @@ -225,5 +224,4 @@ do echo "" >> $SOLVERS_FILE done - # ----------------------------------------------------------------- end-of-file diff --git a/wmake/wclean b/wmake/wclean index 4c2970c3636..1cc63ad02fb 100755 --- a/wmake/wclean +++ b/wmake/wclean @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -27,8 +27,8 @@ # wclean # # Description -# Clean up the wmake control directory Make and remove the include -# directories generated for libraries. +# Clean up the wmake control directory Make/\$WM_OPTIONS and remove the +# lnInclude directories generated for libraries. # #------------------------------------------------------------------------------ Script=${0##*/} @@ -36,18 +36,23 @@ Script=${0##*/} usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<<USAGE -usage: $Script [dir] - $Script target [dir [MakeDir]] -Clean up the wmake control directory Make and remove the include -directories generated for libraries. +Usage: $Script [OPTION] [dir] + $Script [OPTION] target [dir [MakeDir]] + +options: + -help print the usage + +Clean up the wmake control directory Make/\$WM_OPTIONS and remove the +lnInclude directories generated for libraries. The targets correspond to a subset of the 'wmake' special targets: all all subdirectories - exe cleans dir/Make - lib cleans dir/Make and dir/lnInclude - libso cleans dir/Make and dir/lnInclude - libo cleans dir/Make and dir/lnInclude + (NB: any Allwclean or Allclean files will be used if they exist) + exe clean dir/Make + lib clean dir/Make and dir/lnInclude + libo clean dir/Make and dir/lnInclude + libso clean dir/Make and dir/lnInclude USAGE exit 1 @@ -77,16 +82,11 @@ then makeOption=$1 fi - if [ $# -ge 2 ] - then - dir=$2 - fi + # specified directory name: + [ $# -ge 2 ] && dir=$2 - # alternative name for the Make sub-directory - if [ $# -ge 3 ] - then - MakeDir=$3 - fi + # specified alternative name for the Make sub-directory: + [ $# -ge 3 ] && MakeDir=$3 if [ "$dir" ] then @@ -106,7 +106,11 @@ fi if [ "$makeOption" = all ] then - if [ -e Allclean ] + if [ -e Allwclean ] # consistent with Allwmake + then + ./Allwclean + exit $? + elif [ -e Allclean ] # often used for tutorial cases then ./Allclean exit $? @@ -141,7 +145,7 @@ rm -rf $MakeDir/$WM_OPTIONS $MakeDir/classes 2>/dev/null find . -name "*.dep" -exec rm {} \; case "$makeOption" in -lib | libso | libo ) +lib | libo | libso ) rm -rf lnInclude 2>/dev/null ;; esac diff --git a/wmake/wcleanAll b/wmake/wcleanAll index 9aaf87762ac..94a0ad76bb7 100755 --- a/wmake/wcleanAll +++ b/wmake/wcleanAll @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -62,6 +62,6 @@ find . -depth -type d \( -name lnInclude -o -name ii_files -o -name Templates.DB echo "Removing misc files" find . \( -name exe -o -name log -o -name so_locations \) -exec rm {} \; -( cd tutorials && ./Allclean ) +tutorials/Allclean #------------------------------------------------------------------------------ diff --git a/wmake/wmake b/wmake/wmake index 6689fef099e..504af95a385 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -48,7 +48,8 @@ The 'target' is a Makefile target: e.g., Make/linux64GccDPOpt/fvMesh.o or a special target: - all all subdirectories (NB: any Allwmake files will be used if they exist) + all all subdirectories + (NB: any Allwmake files will be used if they exist) exe build statically linked executable lib build statically linked archive lib (.a) libo build statically linked lib (.o) -- GitLab