From f21ca124a9194027fa4c807b963929818d5f06ac Mon Sep 17 00:00:00 2001 From: Jan Scotka Date: Jul 04 2017 08:23:55 +0000 Subject: [PATCH 1/3] added possibility to generate main index.html for cumulative test results --- diff --git a/run_mtf.sh b/run_mtf.sh index f9cbed6..1c02244 100755 --- a/run_mtf.sh +++ b/run_mtf.sh @@ -19,11 +19,51 @@ MODULENAME="$1" MODULENAME_STREAM_VERSION="$2" WORKDIR="$3" ARTIFACTSDIR="$4" +# Generate main index.page +HEADER=' + + + + Taskotron cumulative results for Modularity testing framework subtests + + + + +
+ + + + + + + +' +FOOTER=' +
ResultLink to subtest
+
+ + +' # MTF exit codes MTF_EXIT_FAIL='125' MTF_EXIT_SKIP='126' +function write_to_index { + local FUNC=$1 + local TEXT=$2 + local OUTFILE="$ARTIFACTSDIR/index.html" + if echo $FUNC | grep header; then + echo "$HEADER" > $OUTFILE + elif echo $FUNC | grep footer; then + echo "$FOOTER" >> $OUTFILE + elif echo $FUNC | grep body; then + echo "$TEXT" >> $OUTFILE + fi +} + function save_outcome { local EXITCODE="$1" local OUTFILE="$2" @@ -67,6 +107,32 @@ function get_artifact { fi } +function generate_html_table_row { + local EXITCODE="$1" + local URLLINK="$2" + local RES="PASS" + local RES_CLASS="success" + if [ "$EXITCODE" -eq 0 ]; then + true + elif [ "$EXITCODE" -eq "$MTF_EXIT_FAIL" ]; then + RES="FAIL" + RES_CLASS="danger even" + elif [ "$EXITCODE" -eq "$MTF_EXIT_SKIP" ]; then + RES="SKIP" + RES_CLASS="warning" + else + return 1 + fi + echo " + + $RES + $URLLINK + +" + return 0 +} + +write_to_index header # run module lint echo 'Running MTF with module lint...' /usr/share/moduleframework/tools/run-them.sh "$MODULENAME" "$MODULENAME_STREAM_VERSION" pdc lint @@ -75,6 +141,7 @@ EXITCODE="$?" echo 'Saving module lint results...' save_outcome "$EXITCODE" "$WORKDIR/outcome.modulelint" save_artifacts "$EXITCODE" "$ARTIFACTSDIR/avocado-result.modulelint" +write_to_index body "`generate_html_table_row $EXITCODE $ARTIFACTSDIR/avocado-result.modulelint/html/results.html`" # run module tests echo 'Running MTF with module tests...' @@ -84,7 +151,9 @@ EXITCODE="$?" echo 'Saving module tests results...' save_outcome "$EXITCODE" "$WORKDIR/outcome.tests" save_artifacts "$EXITCODE" "$ARTIFACTSDIR/avocado-result.tests" +write_to_index body "`generate_html_table_row $EXITCODE $ARTIFACTSDIR/avocado-result.tests/html/results.html`" +write_to_index footer # generate overall outcome if grep -q FAILED "$WORKDIR"/outcome.*; then echo "FAILED" > "$WORKDIR/outcome.overall" @@ -118,3 +187,4 @@ taskotron_result \ # save results as an artifact, for debugging cp "$WORKDIR/results.yaml" "$ARTIFACTSDIR" + From e45d532ea8eccdedef4bae41d104e49aa705ea7a Mon Sep 17 00:00:00 2001 From: Jan Scotka Date: Jul 04 2017 08:25:41 +0000 Subject: [PATCH 2/3] made HEADER adn FOOTER local --- diff --git a/run_mtf.sh b/run_mtf.sh index 1c02244..d5b3f45 100755 --- a/run_mtf.sh +++ b/run_mtf.sh @@ -19,8 +19,13 @@ MODULENAME="$1" MODULENAME_STREAM_VERSION="$2" WORKDIR="$3" ARTIFACTSDIR="$4" -# Generate main index.page -HEADER=' + +# MTF exit codes +MTF_EXIT_FAIL='125' +MTF_EXIT_SKIP='126' + +function write_to_index { + local HEADER=' @@ -40,18 +45,12 @@ HEADER=' Link to subtest ' -FOOTER=' + local FOOTER=' ' - -# MTF exit codes -MTF_EXIT_FAIL='125' -MTF_EXIT_SKIP='126' - -function write_to_index { local FUNC=$1 local TEXT=$2 local OUTFILE="$ARTIFACTSDIR/index.html" From 1756a70fb19964c894aca9c8fa2f79f99f9dee91 Mon Sep 17 00:00:00 2001 From: Jan Scotka Date: Jul 04 2017 09:52:42 +0000 Subject: [PATCH 3/3] fix class attrib for table -> colours visible --- diff --git a/run_mtf.sh b/run_mtf.sh index d5b3f45..6415987 100755 --- a/run_mtf.sh +++ b/run_mtf.sh @@ -39,7 +39,7 @@ function write_to_index {

Taskotron cumulative results for Modularity testing framework subtests

- +