Skip to contentSkip to conversation

oprofile: Add PTEST regression testing to oprofile

PATCH Superseded Chong Lu 1 participant 1 message Jun 6, 2014

lore
Share & tools
lore

Chong Lu

author
#0 lore raw

PATCH v2 1/1 oprofile: Add PTEST regression testing to oprofile

The commit changes the oe-core oprofile recipe by adding the PTEST interface, implementing do_compile_ptest() and do_install_ptest().

The install routine adds several files that only the regression tests require. Also, a patch is necessary to inhibit executing the tests on the build host and to point to the correct target directory for the libutil++ test 'file-manip-tests'.

That test requires the recipe to set SRCDIR in the build environment instead of determining the value from build-time host paths as for a self-hosted build.

---
 meta/recipes-kernel/oprofile/oprofile.inc          |   31 ++++++-
 .../oprofile/oprofile-cross-compile-tests.patch    |   98 ++++++++++++++++++++
 meta/recipes-kernel/oprofile/oprofile/run-ptest    |   18 ++++
 3 files changed, 145 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-kernel/oprofile/oprofile/oprofile-cross-compile-tests.patch
 create mode 100644 meta/recipes-kernel/oprofile/oprofile/run-ptest
meta/recipes-kernel/oprofile/oprofile.inc +29 -2
index ccf9f9f..aaba48e 100644
@@ -20,9 +20,11 @@ FILES_${PN}-staticdev += "${libdir}/${BPN}/lib*.a"
 
 SRC_URI = "file://opstart.patch \
            file://oprofile-root.patch \
-           file://acinclude.m4"
+           file://acinclude.m4 \
+           file://oprofile-cross-compile-tests.patch \
+           file://run-ptest"
 
-inherit autotools-brokensep pkgconfig
+inherit autotools-brokensep pkgconfig ptest
 
 EXTRA_OECONF = "--with-kernel=${STAGING_KERNEL_DIR}  --without-x"
 do_configure () {
@@ -30,3 +32,28 @@ do_configure () {
 	cp ${WORKDIR}/acinclude.m4 ${S}/
 	autotools_do_configure
 }
+
+EXTRA_OEMAKE = "SRCDIR=${PTEST_PATH}/libutil++/tests"
+do_compile_ptest() {
+	oe_runmake check
+}
+
+do_install_ptest() {
+	subdirs="libdb/tests libutil++/tests libregex/tests libutil/tests libop/tests libdb/tests "
+	cd ${S}
+	for tooltest in ${subdirs}
+	do
+		find ${tooltest} -perm /u=x -type f| cpio -pvdu ${D}${PTEST_PATH}
+	done
+
+	# needed by some libop tests
+	cp -r events ${D}${PTEST_PATH}
+
+	# needed by libregex regex_test
+	cp libregex/stl.pat ${D}${PTEST_PATH}/libregex
+	cp libregex/tests/mangled-name ${D}${PTEST_PATH}/libregex/tests
+
+	# needed by litutil++ file_manip_tests
+	cp libutil++/tests/file_manip_tests.cpp \
+		libutil++/tests/file_manip_tests.o ${D}${PTEST_PATH}/libutil++/tests
+}
meta/recipes-kernel/oprofile/oprofile/oprofile-cross-compile-tests.patch new file +98 -0

98 lines not on this page · raw message

meta/recipes-kernel/oprofile/oprofile/run-ptest new file +18 -0
new file mode 100644
index 0000000..583ee1b
@@ -0,0 +1,18 @@
+#!/bin/bash
+saved_dir=$PWD
+for dir in */tests ; do
+	cd $dir
+	for atest in * ; do
+		if [ \( -x $atest \) -a \( -f $atest \) ] ; then
+			./$atest > ${atest}.stdout 2> ${atest}.stderr
+			if [ $? = 0 ] ; then
+				echo "PASS: $dir $atest"
+				rm ${atest}.stdout ${atest}.stderr
+			else
+				echo "FAIL: ${dir}/${atest}"
+			fi
+		fi
+	done
+	cd $saved_dir
+done
+
Signature · 1 line
1.7.9.5