New Yocto ptest definition & script 07/11407/2 4.99.2 eel/4.99.2 eel_4.99.2
authorlollivier <lollivier@baylibre.com>
Fri, 20 Oct 2017 09:30:03 +0000 (11:30 +0200)
committerlollivier <lollivier@baylibre.com>
Fri, 20 Oct 2017 09:36:28 +0000 (11:36 +0200)
Add a new yocto ptest definition to the pool of tests.
The script is a wrapper around the ptests.
For now it only runs the ptests for busybox.

Bug-AGL: SPEC-911
Change-Id: I6fe96297c0d5db71c2ef41dc5afd67eecf3d8e97
Signed-off-by: lollivier <lollivier@baylibre.com>
common/scripts/ptest-lava-wrapper.sh [new file with mode: 0755]
test-suites/yocto-ptest.yaml [new file with mode: 0644]

diff --git a/common/scripts/ptest-lava-wrapper.sh b/common/scripts/ptest-lava-wrapper.sh
new file mode 100755 (executable)
index 0000000..e49db5d
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+REQUIREDPTESTS="busybox"
+
+# Check if ptest packages are installed
+command -v ptest-runner >/dev/null 2>&1
+if [ $? -ne 0 ] ; then
+    lava-test-case ptest-installed --result FAIL
+else
+    # Run ptests for specified packages
+    for unit in ${REQUIREDPTESTS}; do
+        UNIT_LOG=$(ptest-runner ${unit} 2> /dev/null)
+        if [ $? -eq 0 ] ; then
+            lava-test-set start ptest-$unit
+            # 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
+            echo "$UNIT_LOG" | grep -e 'PASS' -e 'FAIL' | sed 's/ /-/g' | sed 's/[^a-z|A-Z|0-9|-]//g' | sed 's/\([^-]*\)-\(.*\)/lava-test-case \2 --result \1/' | sh
+            lava-test-set stop ptest-$unit
+        else
+            lava-test-case ptest-runner ${unit} --result fail
+        fi
+    done
+    lava-test-case ptest-runtime --measurement $SECONDS --units seconds --result PASS
+fi
+
+# Wait for LAVA to parse all the tests from stdout
+sleep 60
\ No newline at end of file
diff --git a/test-suites/yocto-ptest.yaml b/test-suites/yocto-ptest.yaml
new file mode 100644 (file)
index 0000000..3a59643
--- /dev/null
@@ -0,0 +1,7 @@
+metadata:
+  name: metadata-name-yocto-ptest
+  format: "Lava-Test-Shell Test Definition 1.0"
+  description: "Wrapper around the Yocto ptests for LAVA"
+run:
+  steps:
+    - ./common/scripts/ptest-lava-wrapper.sh