diff mbox series

[meta-oe,kirkstone] rocksdb: Add ptest support

Message ID 20241009020530.3661267-1-mingli.yu@windriver.com
State New
Headers show
Series [meta-oe,kirkstone] rocksdb: Add ptest support | expand

Commit Message

Yu, Mingli Oct. 9, 2024, 2:05 a.m. UTC
From: Mingli Yu <mingli.yu@windriver.com>

 # ./run-ptest
PASS: arena_test
PASS: cache_test
PASS: db_basic_test
PASS: env_basic_test
PASS: testutil_test

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 meta-oe/recipes-dbs/rocksdb/files/run-ptest   | 12 ++++++++++++
 meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb | 19 +++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-dbs/rocksdb/files/run-ptest
diff mbox series

Patch

diff --git a/meta-oe/recipes-dbs/rocksdb/files/run-ptest b/meta-oe/recipes-dbs/rocksdb/files/run-ptest
new file mode 100644
index 000000000..45406fdfa
--- /dev/null
+++ b/meta-oe/recipes-dbs/rocksdb/files/run-ptest
@@ -0,0 +1,12 @@ 
+#!/bin/sh
+ptestdir=$(dirname "$(readlink -f "$0")")
+cd "$ptestdir"/tests || exit
+
+for test in *_test; do
+    if ./${test} >/dev/null 2>&1; then
+        echo "PASS: ${test}"
+    else
+        echo "FAIL: ${test}"
+    fi
+done
+
diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb
index 2ad2d38a5..8164f856e 100644
--- a/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb
+++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb
@@ -18,6 +18,7 @@  SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH};protocol=htt
            file://ppc64.patch \
            file://mips.patch \
            file://arm.patch \
+           file://run-ptest \
           "
 
 SRC_URI:append:riscv32 = " file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch"
@@ -27,7 +28,7 @@  SRC_URI:remove:toolchain-clang:riscv32 = "file://0001-replace-old-sync-with-new-
 
 S = "${WORKDIR}/git"
 
-inherit cmake
+inherit cmake ptest
 
 PACKAGECONFIG ??= "bzip2 zlib lz4 gflags"
 PACKAGECONFIG[bzip2] = "-DWITH_BZ2=ON,-DWITH_BZ2=OFF,bzip2"
@@ -40,7 +41,7 @@  PACKAGECONFIG[gflags] = "-DWITH_GFLAGS=ON,-DWITH_GFLAGS=OFF,gflags"
 # Tools and tests currently don't compile on armv5 so we disable them
 EXTRA_OECMAKE = "\
     -DPORTABLE=ON \
-    -DWITH_TESTS=OFF \
+    -DWITH_TESTS=${@bb.utils.contains("DISTRO_FEATURES", "ptest", "ON", "OFF", d)} \
     -DWITH_BENCHMARK_TOOLS=OFF \
     -DWITH_TOOLS=OFF \
     -DFAIL_ON_WARNINGS=OFF \
@@ -52,7 +53,21 @@  do_install:append() {
 }
 
 LDFLAGS:append:riscv64 = " -pthread"
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    # only cover the basic test as all the tests need to take about 6 hours
+    # time ./run-ptest
+    # real    356m32.956s
+    # user    252m32.004s
+    # sys 178m50.246s
+    install -m 0755 ${B}/env_basic_test ${D}${PTEST_PATH}/tests/
+    install -m 0755 ${B}/db_basic_test ${D}${PTEST_PATH}/tests/
+    install -m 0755 ${B}/arena_test ${D}${PTEST_PATH}/tests/
+    install -m 0755 ${B}/testutil_test ${D}${PTEST_PATH}/tests/
+    install -m 0755 ${B}/cache_test ${D}${PTEST_PATH}/tests/
+}
 
 # Need toku_time_now() implemented for ppc/musl
 # see utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
 COMPATIBLE_HOST:libc-musl:powerpc = "null"
+COMPATIBLE_HOST:armv5 = 'null'