From 23ce881ba960cf5df06d40a0dda402f1b4073e0b Mon Sep 17 00:00:00 2001 From: Jan Scotka Date: Nov 24 2017 13:38:16 +0000 Subject: [PATCH 1/3] logic moved to supporting mtf script --- diff --git a/run_mtf.sh b/run_mtf.sh index c56af6c..b68bd4c 100755 --- a/run_mtf.sh +++ b/run_mtf.sh @@ -76,29 +76,7 @@ function check_artifact { echo 'Running container tests' pushd "$WORKDIR" - -# Install test dependencies if DEPS file exist, otherwise it means that there are no -# additional depenedencies -DEPS="requirements.sh" -TOOLSRC="0" -if [ -e $DEPS ]; then - sh $DEPS - TOOLSRC="$?" -fi - -# If dependencies isntallation didn't fail, run tests via -# make test target (what is expected to exist in each container) -if [ "$TOOLSRC" -eq "0" ]; then - make test - CHECKRC="$?" - if [ "$CHECKRC" -eq "0" ]; then - EXITCODE=0 - else - EXITCODE=$MTF_EXIT_FAIL - fi -else - EXITCODE=2 -fi +/usr/share/moduleframework/tools/run_them_containers_taskotron.sh popd echo 'Saving container tests results...' From 43f9a21f0803316c6268ad782a1e4c2249eda6a8 Mon Sep 17 00:00:00 2001 From: Jan Scotka Date: Dec 06 2017 13:12:41 +0000 Subject: [PATCH 2/3] add raw log output and store them to artifacts --- diff --git a/run_mtf.sh b/run_mtf.sh index b68bd4c..23f9658 100755 --- a/run_mtf.sh +++ b/run_mtf.sh @@ -19,6 +19,8 @@ PR_LINK="$1" WORKDIR="$2" ARTIFACTSDIR="$3" +# stored raw output +RAW_LOG_NAME="raw.log" # MTF exit codes MTF_EXIT_FAIL='125' @@ -76,7 +78,10 @@ function check_artifact { echo 'Running container tests' pushd "$WORKDIR" -/usr/share/moduleframework/tools/run_them_containers_taskotron.sh +/usr/share/moduleframework/tools/run_them_containers_taskotron.sh \ + 2>&1 | tee "$RAW_LOG_NAME" +EXITCODE="${PIPESTATUS[0]}" +cp "$WORKDIR/$RAW_LOG_NAME" "$ARTIFACTSDIR/$RAW_LOG_NAME" popd echo 'Saving container tests results...' @@ -91,5 +96,5 @@ taskotron_result \ --checkname "mtf-containers" \ --outcome "$(sed -n 1p "$WORKDIR/outcome.tests")" \ --note "$(sed -n 2p "$WORKDIR/outcome.tests")" \ - --artifact "$(check_artifact "$ARTIFACTSDIR/avocado-result.tests/html/results.html" "$ARTIFACTSDIR/html/index.html")" \ + --artifact "$(check_artifact "$ARTIFACTSDIR/avocado-result.tests/html/results.html" "$ARTIFACTSDIR/$RAW_LOG_NAME")" \ --file "$WORKDIR/results.yaml" From 97e8697cfb4659dcfae8902e058789ba5a01349b Mon Sep 17 00:00:00 2001 From: Kamil Páral Date: Dec 06 2017 13:29:37 +0000 Subject: [PATCH 3/3] if raw log doesn't exist, use artifacts basedir as artifact --- diff --git a/run_mtf.sh b/run_mtf.sh index 23f9658..49cd239 100755 --- a/run_mtf.sh +++ b/run_mtf.sh @@ -65,15 +65,16 @@ function save_artifacts { cp -r /root/avocado/job-results/latest/test-results "$OUTDIR"/html/ } +## return the first artifact path that exists, or the last one otherwise function check_artifact { - # return the artifact if it exists, otherwise the fallback - local ARTIFACT="$1" - local FALLBACK="$2" - if [ -e "$ARTIFACT" ]; then - echo -n "$ARTIFACT" - else - echo -n "$FALLBACK" - fi + for ARTIFACT in "$@"; do + if [ -e "$ARTIFACT" ]; then + echo -n "$ARTIFACT" + return + fi + done + # no artifact exists, return the last path + echo -n "${@: -1}" } echo 'Running container tests' @@ -96,5 +97,7 @@ taskotron_result \ --checkname "mtf-containers" \ --outcome "$(sed -n 1p "$WORKDIR/outcome.tests")" \ --note "$(sed -n 2p "$WORKDIR/outcome.tests")" \ - --artifact "$(check_artifact "$ARTIFACTSDIR/avocado-result.tests/html/results.html" "$ARTIFACTSDIR/$RAW_LOG_NAME")" \ + --artifact "$(check_artifact "$ARTIFACTSDIR/avocado-result.tests/html/results.html" \ + "$ARTIFACTSDIR/$RAW_LOG_NAME" \ + .)" \ --file "$WORKDIR/results.yaml"