[Fuego] [PATCH 07/29] functions: rewrite the way we call the parser

Bird, Timothy Tim.Bird at sony.com
Tue Jul 25 00:03:35 UTC 2017


OK.

> -----Original Message-----
> From: fuego-bounces at lists.linuxfoundation.org [mailto:fuego-
> bounces at lists.linuxfoundation.org] On Behalf Of Daniel Sangorrin
> Sent: Friday, July 21, 2017 1:02 AM
> To: fuego at lists.linuxfoundation.org
> Subject: [Fuego] [PATCH 07/29] functions: rewrite the way we call the parser
> 
> We remove the function make_run_file because the run files
> will be generated by the parser (until know there were two
> separated files). Also we removed the call to dataload.py
> because its functionality will be included in the parser.
> 
> Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
> ---
>  engine/scripts/functions.sh | 89 ++++++---------------------------------------
>  1 file changed, 11 insertions(+), 78 deletions(-)
> 
> diff --git a/engine/scripts/functions.sh b/engine/scripts/functions.sh
> index b4562bb..94dc5ca 100755
> --- a/engine/scripts/functions.sh
> +++ b/engine/scripts/functions.sh
> @@ -380,32 +380,6 @@ function processing {
>          RETURN_VALUE=1
>      fi
> 
> -    PYTHON_ARGS="-W ignore::DeprecationWarning -W
> ignore::UserWarning"
> -    if [ -e "$TEST_HOME/parser.py" ] ; then
> -        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), 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"
> -        if [ $rc -eq 0 ]; then
> -            # FIXTHIS: this should not be here
> -            ln -s "../plot.png" "$LOGDIR/plot.png" || true
> -        else
> -            "ERROR: problem while running dataload.py"
> -            RETURN_VALUE=1
> -        fi
> -    else
> -        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
>      # this code assumes that if consolelog.txt doesn't exist, this was a Jenkins
> job build,
>      # and the console log is over in the jenkins build directory.
> @@ -413,10 +387,18 @@ function processing {
>          ln -s
> "/var/lib/jenkins/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/log"
> $LOGDIR/consolelog.txt
>      fi
> 
> -    # create run.json file
> -    make_run_file $RETURN_VALUE
> +    # the parser generates a single 'run.json' file for each run
> +    PYTHON_ARGS="-W ignore::DeprecationWarning -W
> ignore::UserWarning"
> +    if [ -e "$TEST_HOME/parser.py" ] ; then
> +        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 && rc=0 || rc=$?
> +    fi
> 
> -    return $RETURN_VALUE
> +    if [ $rc -eq 1 ]; then
> +        echo "ERROR: results did not satisfy the threshold"
> +        RETURN_VALUE=1
> +    fi
>  }
> 
>  # search in testlog.txt and syslog (if use_syslog is defined in the spec)
> @@ -486,55 +468,6 @@ function call_if_present {
>      fi
>  }
> 
> -# create the run.json file
> -# this routine uses a whole lot of variables...
> -# $1: result of the test
> -function make_run_file {
> -    # calculate duration
> -    end_arr=( $(date +"%s %N") )
> -    # get end time in milliseconds since the epoch
> -    FUEGO_END_TIME="${end_arr[0]}${end_arr[1]:0:3}"
> -    DURATION=$(( $FUEGO_END_TIME - $FUEGO_START_TIME ))
> -
> -    if [ "$1" = "0" ] ; then
> -        FUEGO_RESULT_STR="SUCCESS"
> -    else
> -        FUEGO_RESULT_STR="FAILURE"
> -    fi
> -
> -    cat > $LOGDIR/run.json <<RUN_JSON_TEMPLATE
> -{
> -    "built_on": "$NODE_NAME",
> -    "cause": "unknown",
> -    "description": "unknown",
> -    "device": "$NODE_NAME",
> -    "duration": $DURATION,
> -    "fwver": "$FWVER",
> -    "files": [
> -        "devlog.txt",
> -        "syslog.before.txt",
> -        "syslog.after.txt",
> -        "testlog.txt",
> -        "consolelog.txt"
> -    ],
> -    "host": "$FUEGO_HOST",
> -    "keep_log": "true",
> -    "num": "$BUILD_NUMBER",
> -    "reboot": "$Reboot",
> -    "rebuild": "$Rebuild",
> -    "result": "$FUEGO_RESULT_STR",
> -    "start_time": $FUEGO_START_TIME,
> -    "target": "$NODE_NAME",
> -    "target_precleanup": "$Target_PreCleanup",
> -    "test_name": "$TESTDIR",
> -    "testplan": "$TESTPLAN",
> -    "test_spec": "$TESTSPEC",
> -    "timestamp": "$BUILD_TIMESTAMP",
> -    "workspace": "$WORKSPACE"
> -}
> -RUN_JSON_TEMPLATE
> -}
> -
>  # capture SIGTERM during post_test
>  # if Jenkins is trying to abort us, it sends SIGTERM multiple times
>  # but we'd rather finish up post_test than stop
> --
> 2.7.4
> 
> 
> _______________________________________________
> Fuego mailing list
> Fuego at lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego


More information about the Fuego mailing list