[Fuego] [PATCH 14/19] parser: allow parser.py to skip processing

Daniel Sangorrin daniel.sangorrin at toshiba.co.jp
Fri May 12 08:19:55 UTC 2017


For some specs the parser.py may want to just skip. Returning
a 0 would cause an error on the execution of dataload.py. For
that reason I added another return value (3) to specify that
the parser.py didn't need to run.

Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
 engine/scripts/functions.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/engine/scripts/functions.sh b/engine/scripts/functions.sh
index 188408d..1d7bce9 100755
--- a/engine/scripts/functions.sh
+++ b/engine/scripts/functions.sh
@@ -359,13 +359,12 @@ function processing {
 
     PYTHON_ARGS="-W ignore::DeprecationWarning -W ignore::UserWarning"
     if [ -e "$TEST_HOME/parser.py" ] ; then
-        # FIXTHIS: make sure that json is generated even on failures
         run_python $PYTHON_ARGS $FUEGO_CORE/engine/tests/${TESTDIR}/parser.py && rc=0 || rc=$?
     else
         run_python $PYTHON_ARGS $FUEGO_CORE/engine/scripts/generic_parser.py $RETURN_VALUE && rc=0 || rc=$?
     fi
 
-    # return codes: 0 (everything ok), 1 (problem while parsing, see log), 2 (the results didn't satisfy the threshold)
+    # return codes: 0 (everything ok), 1 (problem while parsing, see log), 2 (the results didn't satisfy the threshold), 3 (parser does not need to run)
     if [ $rc -eq 0 ] || [ $rc -eq 2 ]; then
         # store results as a json file fro the flot plugin
         run_python $PYTHON_ARGS $FUEGO_CORE/engine/scripts/parser/dataload.py && rc=0 || echo "dataload.py didn't work properly"
@@ -377,8 +376,11 @@ function processing {
             RETURN_VALUE=1
         fi
     else
-        echo "ERROR: problem while running the parser"
-        RETURN_VALUE=1
+        if [ $rc -eq 3 ]; then
+            echo "parser.py does not need to run"
+        else
+            abort_job "ERROR: problem while running the parser"
+        fi
     fi
 
     # make a convenience link to the Jenkins console log, if the log doesn't exist
-- 
2.7.4




More information about the Fuego mailing list