@@ -63,6 +63,7 @@ PTESTS_FAST = "\
libxmlb \
libxslt \
libyaml \
+ log4cplus \
logrotate \
lttng-ust \
lua \
new file mode 100644
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+cd @PTEST_PATH@/tests/
+
+./testsuite --am-fmt -k '!headers-compilation'
@@ -16,6 +16,67 @@ SRC_URI[sha256sum] = "374175c22fabe752eb1c20138e732b69ae191e641f92d32c9432985cd8
UPSTREAM_CHECK_URI = "https://github.com/log4cplus/log4cplus/releases"
UPSTREAM_CHECK_REGEX = "log4cplus-(?P<pver>\d+(\.\d+)+)\.tar"
-inherit autotools pkgconfig
+inherit autotools pkgconfig ptest
+
+SRC_URI += "file://run-ptest"
+
+RDEPENDS:${PN}-ptest += "bash diffutils gawk grep sed ${PN}"
+
+log4cplus_ptest_tests() {
+ progs=$(makefile-getvar ${B}/Makefile noinst_PROGRAMS)
+ for at in $(makefile-getvar ${B}/Makefile TESTSUITE_AT); do
+ name=$(basename $at .at)
+ for p in $progs; do
+ [ "$p" = "$name" ] && echo "$name"
+ done
+ done
+}
+
+do_compile_ptest() {
+ rm -f ${S}/tests/testsuite
+ oe_runmake -C ${B} tests/testsuite
+ for t in $(log4cplus_ptest_tests); do
+ oe_runmake -C ${B} $t ${t}U
+ done
+}
+
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}/tests
+
+ install -m 0755 ${S}/tests/testsuite ${D}${PTEST_PATH}/tests/
+
+ install -m 0644 ${B}/tests/atconfig ${D}${PTEST_PATH}/tests/
+ sed -i "/^abs_/d" ${D}${PTEST_PATH}/tests/atconfig
+ cat >> ${D}${PTEST_PATH}/tests/atconfig <<EOF
+abs_builddir='${PTEST_PATH}/tests'
+abs_srcdir='${PTEST_PATH}/tests'
+abs_top_builddir='${PTEST_PATH}'
+abs_top_srcdir='${PTEST_PATH}'
+EOF
+
+ enable_threads=$(sed -n "s|^: \${ENABLE_THREADS='\(.*\)'}|\1|p" ${B}/tests/atlocal)
+ wchar_support=$(sed -n "s|^: \${BUILD_WITH_WCHAR_T_SUPPORT='\(.*\)'}|\1|p" ${B}/tests/atlocal)
+ cat > ${D}${PTEST_PATH}/tests/atlocal <<EOF
+: \${GREP='grep'}
+: \${AWK='gawk'}
+: \${SED='sed'}
+: \${ENABLE_THREADS='$enable_threads'}
+: \${BUILD_WITH_WCHAR_T_SUPPORT='$wchar_support'}
+EOF
+
+ for t in $(log4cplus_ptest_tests); do
+ ${B}/libtool --mode=install install -m 0755 ${B}/$t ${D}${PTEST_PATH}/
+ [ -e ${B}/${t}U ] && ${B}/libtool --mode=install install -m 0755 ${B}/${t}U ${D}${PTEST_PATH}/
+ install -d ${D}${PTEST_PATH}/tests/$t
+ for f in expout experr log4cplus.properties.1 log4cplus.properties.2; do
+ [ -e ${S}/tests/$t/$f ] && install -m 0644 ${S}/tests/$t/$f ${D}${PTEST_PATH}/tests/$t/
+ done
+ for f in ${B}/tests/$t/*.properties; do
+ [ -e $f ] && install -m 0644 $f ${D}${PTEST_PATH}/tests/$t/
+ done
+ done
+
+ sed -i "s#@PTEST_PATH@#${PTEST_PATH}#g" ${D}${PTEST_PATH}/run-ptest
+}
BBCLASSEXTEND = "native"
Build the GNU Autotest based test suite and run it under ptest, following the tar ptest pattern: the generated testsuite is shipped together with atconfig/atlocal, whose build-host paths and tool locations are rewritten to the on-target ptest directory. The test programs use libtool -no-install, so the real binaries are installed with libtool. Tested on qemuriscv64 with ptest-runner. Signed-off-by: Pratik Farkase <pratik.farkase@est.tech> --- Notes: v3: Drop the buildpaths INSANE_SKIP; no longer needed now that atlocal does not embed build paths. Also derive the test list dynamically from the autotools TESTSUITE_AT and noinst_PROGRAMS variables (makefile-getvar) instead of hardcoding it, per review on the lttng-ust ptest series. v2: Trim atlocal to the variables the on-target tests need; the dropped compiler/flags variables embedded build paths and broke reproducibility. .../distro/include/ptest-packagelists.inc | 1 + .../log4cplus/log4cplus/run-ptest | 5 ++ .../log4cplus/log4cplus_2.2.0.1.bb | 63 ++++++++++++++++++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/log4cplus/log4cplus/run-ptest