summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Simon Möller <jsmoeller@linuxfoundation.org>2018-10-02 19:30:20 +0200
committerJan-Simon Möller <jsmoeller@linuxfoundation.org>2018-10-02 19:30:34 +0200
commitfae09f60bfc400fa7f67a8b5e67286beb086bcf3 (patch)
treeebfc7a7c5a27817e88b6b0d75ccbce8dd9686a77
parenta30c5cbe2cd374d529bf92f3f79ce4ffb4db3c42 (diff)
Add the long ptest job and enhance the short job
Change-Id: I42dd644656a47fd9ba3b35a25e848535f61ca0a9 Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
-rwxr-xr-xcommon/scripts/ptest-lava-wrapper-all.sh35
-rwxr-xr-xcommon/scripts/ptest-lava-wrapper.sh7
-rw-r--r--test-suites/yocto-ptest-full.yaml7
3 files changed, 47 insertions, 2 deletions
diff --git a/common/scripts/ptest-lava-wrapper-all.sh b/common/scripts/ptest-lava-wrapper-all.sh
new file mode 100755
index 0000000..48348bc
--- /dev/null
+++ b/common/scripts/ptest-lava-wrapper-all.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# Check if ptest packages are installed
+command -v ptest-runner >/dev/null 2>&1
+if [ $? -ne 0 ] ; then
+ lava-test-case ptest-installed --result SKIP
+else
+ # Run ptests for specified packages
+ lava-test-set start ptest-full
+ UNIT_LOG=$(ptest-runner 2> results.log )
+ if [ $? -eq 0 ] ; then
+ # grep: Get only the ptests results, no log
+ # sed 1: replace spaces by hyphens
+ # sed 2: remove any special character
+ # sed 3: find status and test name, wrap it in a lava-test-case call
+ # sh: execute the lava-test-case commands
+ test_pass=$(echo "$UNIT_LOG" | grep -e 'PASS' | wc -l)
+ test_fail=$(echo "$UNIT_LOG" | grep -e 'FAIL' | wc -l)
+ lava-test-case passed-commands --result PASS --measurement $test_pass --units pass
+ if ! [ x"0" = x"$test_fail"] ; then
+ lava-test-case failed-commands --result FAIL --measurement $test_fail --units fail
+ echo "$UNIT_LOG" | grep -e 'FAIL'
+ fi
+ else
+ lava-test-case ptest-runner ptest-full --result fail
+ fi
+ lava-test-set stop ptest-full
+ done
+ lava-test-case ptest-runtime --measurement $SECONDS --units seconds --result PASS
+fi
+
+# Wait for LAVA to parse all the tests from stdout
+sleep 15
+
+cat results.log
diff --git a/common/scripts/ptest-lava-wrapper.sh b/common/scripts/ptest-lava-wrapper.sh
index 07a951a..3b186b4 100755
--- a/common/scripts/ptest-lava-wrapper.sh
+++ b/common/scripts/ptest-lava-wrapper.sh
@@ -19,8 +19,11 @@ else
# sh: execute the lava-test-case commands
test_pass=$(echo "$UNIT_LOG" | grep -e 'PASS' | wc -l)
test_fail=$(echo "$UNIT_LOG" | grep -e 'FAIL' | wc -l)
- lava-test-case passed-commands --result PASS --measurement $test_pass --units pass
- lava-test-case failed-commands --result FAIL --measurement $test_fail --units fail
+ lava-test-case ${unit}-passed-commands --result PASS --measurement $test_pass --units pass
+ if ! [ x"0" = x"$test_fail"] ; then
+ lava-test-case ${unit}-failed-commands --result FAIL --measurement $test_fail --units fail
+ echo "$UNIT_LOG" | grep -e 'FAIL'
+ fi
lava-test-set stop ptest-$unit
else
lava-test-case ptest-runner ${unit} --result fail
diff --git a/test-suites/yocto-ptest-full.yaml b/test-suites/yocto-ptest-full.yaml
new file mode 100644
index 0000000..a234ded
--- /dev/null
+++ b/test-suites/yocto-ptest-full.yaml
@@ -0,0 +1,7 @@
+metadata:
+ name: metadata-name-yocto-ptest-all
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Wrapper around the Yocto ptests for LAVA"
+run:
+ steps:
+ - ./common/scripts/ptest-lava-wrapper-all.sh