[meta-intel] [PATCH v3] isa-l: add ptest

Naveen Saini naveen.kumar.saini at intel.com
Mon Oct 7 21:59:05 PDT 2019


Added unittests as ptest.

Signed-off-by: Naveen Saini <naveen.kumar.saini at intel.com>
---
 recipes-support/isa-l/files/run-ptest | 25 ++++++++++++++++++++++
 recipes-support/isa-l/isa-l_2.27.0.bb | 30 +++++++++++++++++++++++++--
 2 files changed, 53 insertions(+), 2 deletions(-)
 create mode 100755 recipes-support/isa-l/files/run-ptest

diff --git a/recipes-support/isa-l/files/run-ptest b/recipes-support/isa-l/files/run-ptest
new file mode 100755
index 00000000..e82d08bf
--- /dev/null
+++ b/recipes-support/isa-l/files/run-ptest
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd tests
+
+failed=0
+all=0
+
+echo 'Executing isa-l unittest..'
+for f in unittest/*; do
+    ./$f | grep -i Pass
+    if [ $? -eq 0 ]; then
+        echo PASS: $f
+        all=$((all + 1))
+    else
+        echo FAIL: $f
+        failed=$((failed + 1))
+        all=$((all + 1))
+    fi
+done
+
+if [ "$failed" -eq 0 ] ; then
+  echo "All $all tests passed"
+else
+  echo "$failed of $all tests failed"
+fi
diff --git a/recipes-support/isa-l/isa-l_2.27.0.bb b/recipes-support/isa-l/isa-l_2.27.0.bb
index ac9cfad8..7e4494b4 100644
--- a/recipes-support/isa-l/isa-l_2.27.0.bb
+++ b/recipes-support/isa-l/isa-l_2.27.0.bb
@@ -5,13 +5,39 @@ LICENSE  = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=e6c7d82ad7dd512687b0991a159a1ca9"
 SECTION = "lib"
 
-inherit autotools pkgconfig
+inherit autotools pkgconfig ptest
 
 S = "${WORKDIR}/git"
 SRCREV = "0111c21cbc775bd2b152cd06717f7f09988bc0f1"
-SRC_URI = "git://github.com/intel/isa-l.git"
+SRC_URI = "git://github.com/intel/isa-l.git \
+        file://run-ptest \
+"
 
 DEPENDS = "nasm-native"
 AS[unexport] = "1"
 
 COMPATIBLE_HOST = '(x86_64).*-linux'
+
+do_configure_ptest_prepend() {
+    sed -i 's/tests: ${unit_tests}/tests: ${unit_tests} ${check_tests}/g' ${S}/Makefile.am
+}
+
+do_compile_ptest() {
+    cd ${B}
+    oe_runmake tests
+}
+
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    install -d ${D}${PTEST_PATH}/tests/unittest
+    install -m 0755 ${B}/erasure_code/.libs/gf_*_test ${D}${PTEST_PATH}/tests/unittest/
+    install -m 0755 ${B}/erasure_code/.libs/erasure_code_test ${D}${PTEST_PATH}/tests/unittest/
+    install -m 0755 ${B}/erasure_code/.libs/erasure_code_update_test ${D}${PTEST_PATH}/tests/unittest/
+    install -m 0755 ${B}/crc/.libs/crc*_test ${D}${PTEST_PATH}/tests/unittest/
+    install -m 0755 ${B}/igzip/.libs/igzip*_test ${D}${PTEST_PATH}/tests/unittest/
+    install -m 0755 ${B}/igzip/.libs/checksum32_funcs_test ${D}${PTEST_PATH}/tests/unittest/
+    install -m 0755 ${B}/mem/.libs/mem_zero_detect_test ${D}${PTEST_PATH}/tests/unittest/
+    install -m 0755 ${B}/raid/.libs/pq*_test ${D}${PTEST_PATH}/tests/unittest/
+    install -m 0755 ${B}/raid/.libs/xor*_test ${D}${PTEST_PATH}/tests/unittest/
+}
+RDEPENDS_${PN}-ptest = "bash"
-- 
2.17.1



More information about the meta-intel mailing list