From: Qiu Tingting <qi...@fujitsu.com>

Add a ptest for lz4.
- It is taking around 9 min to execute with kvm, so added it to PTEST_SLOW.
- It contains one case: test_frame.
- Below is the run log:
  START: ptest-runner
  2023-04-06T00:36
  BEGIN: /usr/lib/lz4/ptest
  Starting lz4frame tester (64-bits, 1.9.4)
  Seed = 7314
  Basic tests completed
  All tests completed
  PASS: lz4/test_frame
  DURATION: 573
  END: /usr/lib/lz4/ptest
  2023-04-06T00:45
  STOP: ptest-runner
  TOTAL: 1 FAIL: 0

Signed-off-by: Qiu Tingting <qi...@fujitsu.com>
---
 .../distro/include/ptest-packagelists.inc     |  3 +--
 meta/recipes-support/lz4/files/run-ptest      | 17 ++++++++++++++++
 meta/recipes-support/lz4/lz4_1.9.4.bb         | 20 ++++++++++++++++++-
 3 files changed, 37 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-support/lz4/files/run-ptest

diff --git a/meta/conf/distro/include/ptest-packagelists.inc 
b/meta/conf/distro/include/ptest-packagelists.inc
index d60ebb38fc..d6351466f2 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -105,6 +105,7 @@ PTESTS_SLOW = "\
     tcl \
     util-linux \
     valgrind \
+    lz4 \
 "
 
 PTESTS_SLOW:remove:riscv64 = "valgrind"
@@ -114,7 +115,6 @@ PTESTS_SLOW:remove:x86 = "valgrind"
 PTESTS_PROBLEMS:append:x86 = " valgrind"
 
 #    ruby \ # Timeout
-#    lz4 \ # Needs a rewrite
 #    rt-tests \ # Needs to be checked whether it runs at all
 #    bash \ # Test outcomes are non-deterministic by design
 #    ifupdown \ # Tested separately in lib/oeqa/selftest/cases/imagefeatures.py
@@ -127,7 +127,6 @@ PTESTS_PROBLEMS:append:x86 = " valgrind"
 
 PTESTS_PROBLEMS = "\
     ruby \
-    lz4 \
     rt-tests \
     bash \
     ifupdown \
diff --git a/meta/recipes-support/lz4/files/run-ptest 
b/meta/recipes-support/lz4/files/run-ptest
new file mode 100644
index 0000000000..f4a46a4f2c
--- /dev/null
+++ b/meta/recipes-support/lz4/files/run-ptest
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Define test work dir
+WORKDIR=@PTEST_PATH@/tests/
+
+# Run test
+cd ${WORKDIR}
+
+case_name="test_frame"
+./frametest 
+ret=$?
+if [[ ${ret} == "0" ]]; then
+    echo "PASS: lz4/$case_name"
+else
+    echo "FAIL: lz4/$case_name"
+fi
+
diff --git a/meta/recipes-support/lz4/lz4_1.9.4.bb 
b/meta/recipes-support/lz4/lz4_1.9.4.bb
index a2a178bab5..d2a25fd5b0 100644
--- a/meta/recipes-support/lz4/lz4_1.9.4.bb
+++ b/meta/recipes-support/lz4/lz4_1.9.4.bb
@@ -12,11 +12,15 @@ PE = "1"
 
 SRCREV = "5ff839680134437dbf4678f3d0c7b371d84f4964"
 
-SRC_URI = "git://github.com/lz4/lz4.git;branch=release;protocol=https"
+SRC_URI = "git://github.com/lz4/lz4.git;branch=release;protocol=https \
+          file://run-ptest \
+          "
 UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.*)"
 
 S = "${WORKDIR}/git"
 
+inherit ptest
+
 # Fixed in r118, which is larger than the current version.
 CVE_CHECK_IGNORE += "CVE-2014-4715"
 
@@ -27,3 +31,17 @@ do_install() {
 }
 
 BBCLASSEXTEND = "native nativesdk"
+
+RDEPENDS:${PN}-ptest += "bash"
+
+do_compile_ptest() {
+        oe_runmake -C ${B}/tests/
+}
+
+do_install_ptest() {
+       install -d ${D}${PTEST_PATH}/tests/
+       install --mode=755 ${B}/tests/frametest ${D}${PTEST_PATH}/tests/
+       sed -i "s#@PTEST_PATH@#${PTEST_PATH}#g" ${D}${PTEST_PATH}/run-ptest
+
+}
+
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#179755): 
https://lists.openembedded.org/g/openembedded-core/message/179755
Mute This Topic: https://lists.openembedded.org/mt/98097516/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to