From 3e452ffcdbb2d26ebc06f58e436f9de687128db3 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 20 Feb 2018 12:54:44 +0100
Subject: [PATCH] TUT: test mode not respected (closes #710)

- now replaced 'if ! isTest' with 'if notTest' for most cases.
---
 bin/tools/RunFunctions                            | 15 ++++++++++++---
 tutorials/combustion/XiFoam/RAS/Allrun            |  2 +-
 tutorials/combustion/chemFoam/gri/Allrun          |  2 +-
 tutorials/combustion/chemFoam/h2/Allrun           |  2 +-
 tutorials/combustion/chemFoam/ic8h18/Allrun       |  2 +-
 tutorials/combustion/chemFoam/ic8h18_TDAC/Allrun  |  2 +-
 tutorials/combustion/chemFoam/nc7h16/Allrun       |  2 +-
 .../fireFoam/LES/compartmentFire/Allrun           |  2 +-
 .../reactingFoam/RAS/SandiaD_LTS/Allrun           |  4 ++--
 .../laminar/helmholtzResonance/Allrun             |  2 +-
 tutorials/compressible/sonicLiquidFoam/Allrun     |  2 +-
 .../buoyantSimpleFoam/buoyantCavity/Allrun        |  2 +-
 .../boundaryWallFunctionsProfile/Allrun           |  2 +-
 .../lumpedPointMotion/building/Allrun             |  2 +-
 .../lumpedPointMotion/building/Allrun.move        |  2 +-
 .../pimpleFoam/LES/vortexShed/Allrun              |  2 +-
 .../incompressible/pisoFoam/LES/motorBike/Allrun  |  2 +-
 tutorials/mesh/foamyHexMesh/Allrun                |  2 +-
 .../multiphase/interFoam/RAS/damBreak/Allrun      |  2 +-
 .../multiphase/interFoam/laminar/damBreak/Allrun  |  2 +-
 .../interFoam/laminar/vofToLagrangian/Allrun      |  2 +-
 .../RAS/wallBoiling/Allrun                        |  2 +-
 .../RAS/wallBoilingIATE/Allrun                    |  2 +-
 .../schemes/divergenceExample/Allrun              |  2 +-
 24 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions
index d9712dea2c..f7909c7518 100644
--- a/bin/tools/RunFunctions
+++ b/bin/tools/RunFunctions
@@ -3,7 +3,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-#    \\/     M anipulation  | Copyright (C) 2015-2017 OpenCFD Ltd.
+#    \\/     M anipulation  | Copyright (C) 2015-2018 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM, licensed under GNU General Public License
@@ -24,7 +24,7 @@
 #------------------------------------------------------------------------------
 
 #
-# Look for '-parallel' in the argument list.
+# Check presence of '-parallel' in the argument list.
 #
 isParallel()
 {
@@ -34,7 +34,7 @@ isParallel()
 
 
 #
-# Look for '-test' in the argument list.
+# Check presence of '-test' in the argument list.
 #
 isTest()
 {
@@ -42,6 +42,15 @@ isTest()
     return 1
 }
 
+#
+# Check absence of '-test' in the argument list.
+#
+notTest()
+{
+    for i; do [ "$i" = "-test" ] && return 1; done
+    return 0
+}
+
 
 #
 # Extract 'numberOfSubdomains' from system/decomposeParDict
diff --git a/tutorials/combustion/XiFoam/RAS/Allrun b/tutorials/combustion/XiFoam/RAS/Allrun
index 6871fc1cc2..18ba9615c0 100755
--- a/tutorials/combustion/XiFoam/RAS/Allrun
+++ b/tutorials/combustion/XiFoam/RAS/Allrun
@@ -20,7 +20,7 @@ setCombustionProperties()
 # Do moriyoshiHomogeneous
 ( cd moriyoshiHomogeneous && foamRunTutorials )
 
-if ! isTest $@
+if notTest $@
 then
     # Clone case for second phase
     cloneCase moriyoshiHomogeneous moriyoshiHomogeneousPart2
diff --git a/tutorials/combustion/chemFoam/gri/Allrun b/tutorials/combustion/chemFoam/gri/Allrun
index 822fbd8972..ef926b994c 100755
--- a/tutorials/combustion/chemFoam/gri/Allrun
+++ b/tutorials/combustion/chemFoam/gri/Allrun
@@ -9,7 +9,7 @@ runApplication chemkinToFoam \
 
 runApplication $(getApplication)
 
-if ! isTest $@
+if notTest $@
 then
     (cd validation && ./Allrun $*)
 fi
diff --git a/tutorials/combustion/chemFoam/h2/Allrun b/tutorials/combustion/chemFoam/h2/Allrun
index d0f65aed57..5afa0c541e 100755
--- a/tutorials/combustion/chemFoam/h2/Allrun
+++ b/tutorials/combustion/chemFoam/h2/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1                        # Run from this directory
 
 runApplication $(getApplication)
 
-if ! isTest $@
+if notTest $@
 then
     (cd validation && ./Allrun $*)
 fi
diff --git a/tutorials/combustion/chemFoam/ic8h18/Allrun b/tutorials/combustion/chemFoam/ic8h18/Allrun
index d0f65aed57..5afa0c541e 100755
--- a/tutorials/combustion/chemFoam/ic8h18/Allrun
+++ b/tutorials/combustion/chemFoam/ic8h18/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1                        # Run from this directory
 
 runApplication $(getApplication)
 
-if ! isTest $@
+if notTest $@
 then
     (cd validation && ./Allrun $*)
 fi
diff --git a/tutorials/combustion/chemFoam/ic8h18_TDAC/Allrun b/tutorials/combustion/chemFoam/ic8h18_TDAC/Allrun
index d0f65aed57..5afa0c541e 100755
--- a/tutorials/combustion/chemFoam/ic8h18_TDAC/Allrun
+++ b/tutorials/combustion/chemFoam/ic8h18_TDAC/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1                        # Run from this directory
 
 runApplication $(getApplication)
 
-if ! isTest $@
+if notTest $@
 then
     (cd validation && ./Allrun $*)
 fi
diff --git a/tutorials/combustion/chemFoam/nc7h16/Allrun b/tutorials/combustion/chemFoam/nc7h16/Allrun
index d0f65aed57..5afa0c541e 100755
--- a/tutorials/combustion/chemFoam/nc7h16/Allrun
+++ b/tutorials/combustion/chemFoam/nc7h16/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1                        # Run from this directory
 
 runApplication $(getApplication)
 
-if ! isTest $@
+if notTest $@
 then
     (cd validation && ./Allrun $*)
 fi
diff --git a/tutorials/combustion/fireFoam/LES/compartmentFire/Allrun b/tutorials/combustion/fireFoam/LES/compartmentFire/Allrun
index 7916c6e143..b8fad2b17f 100755
--- a/tutorials/combustion/fireFoam/LES/compartmentFire/Allrun
+++ b/tutorials/combustion/fireFoam/LES/compartmentFire/Allrun
@@ -21,7 +21,7 @@ runParallel $(getApplication)
 paraFoam -touch
 paraFoam -touch -region panelRegion
 
-if ! isTest $@
+if notTest $@
 then
     (cd validation && ./createGraphs)
 fi
diff --git a/tutorials/combustion/reactingFoam/RAS/SandiaD_LTS/Allrun b/tutorials/combustion/reactingFoam/RAS/SandiaD_LTS/Allrun
index 37f0be5d56..7ba247920b 100755
--- a/tutorials/combustion/reactingFoam/RAS/SandiaD_LTS/Allrun
+++ b/tutorials/combustion/reactingFoam/RAS/SandiaD_LTS/Allrun
@@ -8,8 +8,8 @@ application=$(getApplication)
 restore0Dir
 
 runApplication chemkinToFoam \
-               chemkin/grimech30.dat chemkin/thermo30.dat chemkin/transportProperties \
-               constant/reactionsGRI constant/thermo.compressibleGasGRI
+    chemkin/grimech30.dat chemkin/thermo30.dat chemkin/transportProperties \
+    constant/reactionsGRI constant/thermo.compressibleGasGRI
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/helmholtzResonance/Allrun b/tutorials/compressible/rhoPimpleFoam/laminar/helmholtzResonance/Allrun
index 63008fb093..a8473e2070 100755
--- a/tutorials/compressible/rhoPimpleFoam/laminar/helmholtzResonance/Allrun
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/helmholtzResonance/Allrun
@@ -29,7 +29,7 @@ run resolved
 # Run with the plenum modelled by a boundary condition
 run modelled
 
-if ! isTest $@
+if notTest $@
 then
     # Plot a comparison of the pressure in the neck
     cat << EOF | gnuplot -persist
diff --git a/tutorials/compressible/sonicLiquidFoam/Allrun b/tutorials/compressible/sonicLiquidFoam/Allrun
index 81160eeefc..539103fadd 100755
--- a/tutorials/compressible/sonicLiquidFoam/Allrun
+++ b/tutorials/compressible/sonicLiquidFoam/Allrun
@@ -26,7 +26,7 @@ setDecompressionTankFine()
 # Do decompressionTank
 ( cd decompressionTank && foamRunTutorials )
 
-if ! isTest $@
+if notTest $@
 then
     # Clone case
     cloneCase decompressionTank decompressionTankFine
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/Allrun
index e36ed26058..4c6c679c3f 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/Allrun
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/Allrun
@@ -6,7 +6,7 @@ runApplication blockMesh
 runApplication $(getApplication)
 runApplication -s sample  postProcess -latestTime -func sample
 
-if ! istest $@
+if notTest $@
 then
     runApplication validation/createGraphs
 fi
diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
index 03f8f41f8f..4f1949fd46 100755
--- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
+++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
@@ -32,7 +32,7 @@ do
     rm -rf logs
 done
 
-if ! isTest $@
+if notTest $@
 then
     # create validation plot
     # Test if gnuplot exists on the system
diff --git a/tutorials/incompressible/lumpedPointMotion/building/Allrun b/tutorials/incompressible/lumpedPointMotion/building/Allrun
index b922844f84..6fe2bac652 100755
--- a/tutorials/incompressible/lumpedPointMotion/building/Allrun
+++ b/tutorials/incompressible/lumpedPointMotion/building/Allrun
@@ -75,7 +75,7 @@ copyParallelPointDisplacement()
 # Do steady-state case
 (cd steady && foamRunTutorials)
 
-if ! isTest $@
+if notTest $@
 then
     latestTime=$(cd steady && foamListTimes -noZero -latestTime -processor)
 
diff --git a/tutorials/incompressible/lumpedPointMotion/building/Allrun.move b/tutorials/incompressible/lumpedPointMotion/building/Allrun.move
index bed249580f..3f539c8c7e 100755
--- a/tutorials/incompressible/lumpedPointMotion/building/Allrun.move
+++ b/tutorials/incompressible/lumpedPointMotion/building/Allrun.move
@@ -51,7 +51,7 @@ linkParallelCase()
 # Do steady-state case
 (cd steady && ./Allrun.pre)
 
-if ! isTest $@
+if notTest $@
 then
     # Copy/link the steady-state case to movement
     linkParallelCase steady movement
diff --git a/tutorials/incompressible/pimpleFoam/LES/vortexShed/Allrun b/tutorials/incompressible/pimpleFoam/LES/vortexShed/Allrun
index f708e6cfc0..5f0721f590 100755
--- a/tutorials/incompressible/pimpleFoam/LES/vortexShed/Allrun
+++ b/tutorials/incompressible/pimpleFoam/LES/vortexShed/Allrun
@@ -15,7 +15,7 @@ runParallel $(getApplication)
 
 # Run noise tool for both point and surface
 
-if ! isTest $@
+if notTest $@
 then
     runParallel -s point noise -dict system/noiseDict-point
 
diff --git a/tutorials/incompressible/pisoFoam/LES/motorBike/Allrun b/tutorials/incompressible/pisoFoam/LES/motorBike/Allrun
index 9f48464dc2..cb72a01227 100755
--- a/tutorials/incompressible/pisoFoam/LES/motorBike/Allrun
+++ b/tutorials/incompressible/pisoFoam/LES/motorBike/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1                        # Run from this directory
 # Do the Spalart-Allmaras steady-state case
 (cd motorBike && foamRunTutorials)
 
-if ! isTest $@
+if notTest $@
 then
     # Clone the steady-state case to the LES case
     cloneParallelCase motorBike motorBikeLES
diff --git a/tutorials/mesh/foamyHexMesh/Allrun b/tutorials/mesh/foamyHexMesh/Allrun
index d8d59bb661..dd1c7d2c41 100755
--- a/tutorials/mesh/foamyHexMesh/Allrun
+++ b/tutorials/mesh/foamyHexMesh/Allrun
@@ -9,7 +9,7 @@ cd ${0%/*} || exit 1                        # Run from this directory
 ( cd blob && ./Allrun $* )
 ( cd simpleShapes && ./Allrun $* )
 
-if ! isTest $@
+if notTest $@
 then
     ( cd flange && ./Allrun $* )
     ( cd mixerVessel && ./Allrun $* )
diff --git a/tutorials/multiphase/interFoam/RAS/damBreak/Allrun b/tutorials/multiphase/interFoam/RAS/damBreak/Allrun
index aab521bd82..156eceb207 100755
--- a/tutorials/multiphase/interFoam/RAS/damBreak/Allrun
+++ b/tutorials/multiphase/interFoam/RAS/damBreak/Allrun
@@ -25,7 +25,7 @@ setDamBreakFine ()
 (cd damBreak && foamRunTutorials)
 
 
-if ! isTest $@
+if notTest $@
 then
     # Clone case
     cloneCase damBreak damBreakFine
diff --git a/tutorials/multiphase/interFoam/laminar/damBreak/Allrun b/tutorials/multiphase/interFoam/laminar/damBreak/Allrun
index 91244246c5..7380914b2a 100755
--- a/tutorials/multiphase/interFoam/laminar/damBreak/Allrun
+++ b/tutorials/multiphase/interFoam/laminar/damBreak/Allrun
@@ -24,7 +24,7 @@ setDamBreakFine ()
 # Do damBreak
 (cd damBreak && foamRunTutorials)
 
-if ! isTest $@
+if notTest $@
 then
     # Clone case
     cloneCase damBreak damBreakFine
diff --git a/tutorials/multiphase/interFoam/laminar/vofToLagrangian/Allrun b/tutorials/multiphase/interFoam/laminar/vofToLagrangian/Allrun
index a7486bdf95..2d0315eac3 100755
--- a/tutorials/multiphase/interFoam/laminar/vofToLagrangian/Allrun
+++ b/tutorials/multiphase/interFoam/laminar/vofToLagrangian/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1                        # Run from this directory
 
 (cd eulerianInjection && ./Allrun $*)
 
-if ! isTest $@
+if notTest $@
 then
     # Note: particle data only available if running complete case
     (cd lagrangianParticleInjection && ./Allrun $*)
diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/Allrun b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/Allrun
index 001a60c8fd..d3afcad67d 100755
--- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/Allrun
+++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1                        # Run from this directory
 runApplication blockMesh
 runApplication $(getApplication)
 
-if ! isTest $@
+if notTest $@
 then
     foamDictionary system/controlDict -entry endTime -set 5
     foamDictionary 2/T.liquid -entry boundaryField.wall2.q -set 'uniform 1e5'
diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/Allrun b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/Allrun
index 001a60c8fd..d3afcad67d 100755
--- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/Allrun
+++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1                        # Run from this directory
 runApplication blockMesh
 runApplication $(getApplication)
 
-if ! isTest $@
+if notTest $@
 then
     foamDictionary system/controlDict -entry endTime -set 5
     foamDictionary 2/T.liquid -entry boundaryField.wall2.q -set 'uniform 1e5'
diff --git a/tutorials/verificationAndValidation/schemes/divergenceExample/Allrun b/tutorials/verificationAndValidation/schemes/divergenceExample/Allrun
index 19627902c5..e7448449c2 100755
--- a/tutorials/verificationAndValidation/schemes/divergenceExample/Allrun
+++ b/tutorials/verificationAndValidation/schemes/divergenceExample/Allrun
@@ -18,7 +18,7 @@ do
 
     runApplication -s ${schemeTag} scalarTransportFoam
 
-    if ! isTest $params
+    if notTest $params
     then
         # Save the line plot
         mv postProcessing/sample1/100/line1_T.xy line1_T_${schemeTag}.xy
-- 
GitLab