Sean Wilson has uploaded this change for review. ( https://gem5-review.googlesource.com/3791

Change subject: tests: Re-write jenkins scripts to parse test output for failures
......................................................................

tests: Re-write jenkins scripts to parse test output for failures

Change-Id: Ic9adb25a7fa3bfdafa42e3ce3c2b23ce8446666a
Signed-off-by: Sean Wilson <[email protected]>
---
M tests/jenkins/continuous.sh
M tests/jenkins/presubmit.sh
2 files changed, 56 insertions(+), 28 deletions(-)



diff --git a/tests/jenkins/continuous.sh b/tests/jenkins/continuous.sh
index daa2040..82fb1b0 100755
--- a/tests/jenkins/continuous.sh
+++ b/tests/jenkins/continuous.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
@@ -36,36 +36,50 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 # Authors: Andreas Sandberg
+#          Sean Wilson

 set -e
+set -o pipefail
+
+# Use ccache with the default directory for caching
+export PATH="/usr/lib/ccache:$PATH"
+
+export LOGFILE="continuous-output"
+rm -f "${LOGFILE}"

 cd git/jenkins-gem5-prod

 BUILD_JOBS=4

 GEM5_ARCH="ALPHA ARM MIPS NULL POWER SPARC X86"
-GEM5_MODE=opt
+GEM5_VARIANT="opt"

 TARGETS=
 for A in ${GEM5_ARCH}; do
-    TARGETS="${TARGETS} build/${A}/gem5.${GEM5_MODE}"
+    TARGETS="${TARGETS} build/${A}/gem5.${GEM5_VARIANT}"
 done

-TEST_TARGETS=
+export TEST_TARGETS=""
 for A in ${GEM5_ARCH}; do
-    TEST_TARGETS="${TEST_TARGETS} build/${A}/tests/${GEM5_MODE}/quick"
+    TEST_TARGETS="${TEST_TARGETS} build/${A}/tests/${GEM5_VARIANT}\
+/quick/"
 done

+runtests () {
+       scons --ignore-style ${TARGETS} -j${BUILD_JOBS} &>> "${LOGFILE}"

-scons --ignore-style $TARGETS -j${BUILD_JOBS}
+    # Run the tests and check for a failure, return "0" for success
+    scons --ignore-style ${TEST_TARGETS} -j${BUILD_JOBS} |\
+    tee -a "${LOGFILE}" | grep 'FAILED!' | wc -l

-if [ "$?" = "0" ]; then
-  echo "SUCCESS"
-  cd ../..
-  exit 0
+       exit 0
+}
+
+# Check that there were zero failed tests and the subcommand was successful
+if [ "$(runtests 2>> ${LOGFILE})" = "0" -a "$?" = "0" ]; then
+    echo "SUCCESS"
+    exit 0
 else
-  echo "FAIL"
-  cd ../..
-  exit 1
+    echo "FAIL"
+    exit 1
 fi
-
diff --git a/tests/jenkins/presubmit.sh b/tests/jenkins/presubmit.sh
index d5eaaa6..79a9648 100755
--- a/tests/jenkins/presubmit.sh
+++ b/tests/jenkins/presubmit.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
@@ -36,36 +36,50 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 # Authors: Andreas Sandberg
+#          Sean Wilson

 set -e
+set -o pipefail
+
+# Use ccache with the default directory for caching
+export PATH="/usr/lib/ccache:$PATH"
+
+export LOGFILE="presubmit-output"
+rm -f "${LOGFILE}"

 cd git/jenkins-gem5-prod

 BUILD_JOBS=4

-GEM5_ARCH="ALPHA ARM MIPS NULL POWER SPARC X86"
-GEM5_MODE=opt
+GEM5_ARCH="ARM NULL X86"
+GEM5_VARIANT="opt"

 TARGETS=
 for A in ${GEM5_ARCH}; do
-    TARGETS="${TARGETS} build/${A}/gem5.${GEM5_MODE}"
+    TARGETS="${TARGETS} build/${A}/gem5.${GEM5_VARIANT}"
 done

-TEST_TARGETS=
+export TEST_TARGETS=""
 for A in ${GEM5_ARCH}; do
-    TEST_TARGETS="${TEST_TARGETS} build/${A}/tests/${GEM5_MODE}/quick"
+    TEST_TARGETS="${TEST_TARGETS} build/${A}/tests/${GEM5_VARIANT}\
+/quick/se/00.hello"
 done

+runtests () {
+       scons --ignore-style ${TARGETS} -j${BUILD_JOBS} &>> "${LOGFILE}"

-scons --ignore-style $TARGETS -j${BUILD_JOBS}
+    # Run the tests and check for a failure, return "0" for success
+    scons --ignore-style ${TEST_TARGETS} -j${BUILD_JOBS} |\
+    tee -a "${LOGFILE}" | grep 'FAILED!' | wc -l

+       exit 0
+}

-if [ "$?" = "0" ]; then
-  echo "SUCCESS"
-  cd ../..
-  exit 0
+# Check that there were zero failed tests and the subcommand was successful
+if [ "$(runtests 2>> ${LOGFILE})" = "0" -a "$?" = "0" ]; then
+    echo "SUCCESS"
+    exit 0
 else
-  echo "FAIL"
-  cd ../..
-  exit 1
+    echo "FAIL"
+    exit 1
 fi

--
To view, visit https://gem5-review.googlesource.com/3791
To unsubscribe, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9adb25a7fa3bfdafa42e3ce3c2b23ce8446666a
Gerrit-Change-Number: 3791
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Wilson <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to