summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/oprofile
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/oprofile')
-rw-r--r--meta/recipes-kernel/oprofile/oprofile.inc31
-rw-r--r--meta/recipes-kernel/oprofile/oprofile/oprofile-cross-compile-tests.patch98
-rw-r--r--meta/recipes-kernel/oprofile/oprofile/run-ptest18
3 files changed, 145 insertions, 2 deletions
diff --git a/meta/recipes-kernel/oprofile/oprofile.inc b/meta/recipes-kernel/oprofile/oprofile.inc
index ccf9f9fa61..aaba48e8a0 100644
--- a/meta/recipes-kernel/oprofile/oprofile.inc
+++ b/meta/recipes-kernel/oprofile/oprofile.inc
@@ -20,9 +20,11 @@ FILES_${PN}-staticdev += "${libdir}/${BPN}/lib*.a"
20 20
21SRC_URI = "file://opstart.patch \ 21SRC_URI = "file://opstart.patch \
22 file://oprofile-root.patch \ 22 file://oprofile-root.patch \
23 file://acinclude.m4" 23 file://acinclude.m4 \
24 file://oprofile-cross-compile-tests.patch \
25 file://run-ptest"
24 26
25inherit autotools-brokensep pkgconfig 27inherit autotools-brokensep pkgconfig ptest
26 28
27EXTRA_OECONF = "--with-kernel=${STAGING_KERNEL_DIR} --without-x" 29EXTRA_OECONF = "--with-kernel=${STAGING_KERNEL_DIR} --without-x"
28do_configure () { 30do_configure () {
@@ -30,3 +32,28 @@ do_configure () {
30 cp ${WORKDIR}/acinclude.m4 ${S}/ 32 cp ${WORKDIR}/acinclude.m4 ${S}/
31 autotools_do_configure 33 autotools_do_configure
32} 34}
35
36EXTRA_OEMAKE = "SRCDIR=${PTEST_PATH}/libutil++/tests"
37do_compile_ptest() {
38 oe_runmake check
39}
40
41do_install_ptest() {
42 subdirs="libdb/tests libutil++/tests libregex/tests libutil/tests libop/tests libdb/tests "
43 cd ${S}
44 for tooltest in ${subdirs}
45 do
46 find ${tooltest} -perm /u=x -type f| cpio -pvdu ${D}${PTEST_PATH}
47 done
48
49 # needed by some libop tests
50 cp -r events ${D}${PTEST_PATH}
51
52 # needed by libregex regex_test
53 cp libregex/stl.pat ${D}${PTEST_PATH}/libregex
54 cp libregex/tests/mangled-name ${D}${PTEST_PATH}/libregex/tests
55
56 # needed by litutil++ file_manip_tests
57 cp libutil++/tests/file_manip_tests.cpp \
58 libutil++/tests/file_manip_tests.o ${D}${PTEST_PATH}/libutil++/tests
59}
diff --git a/meta/recipes-kernel/oprofile/oprofile/oprofile-cross-compile-tests.patch b/meta/recipes-kernel/oprofile/oprofile/oprofile-cross-compile-tests.patch
new file mode 100644
index 0000000000..aefa9548e1
--- /dev/null
+++ b/meta/recipes-kernel/oprofile/oprofile/oprofile-cross-compile-tests.patch
@@ -0,0 +1,98 @@
1Prevent running check tests on host if cross compiling
2
3This patch enables running the 'make check' tests on the target
4in a cross-compiled environment. If not cross-compiling, then 'make
5 check' builds and executes the tests; no change from this patch.
6In a cross-compiling environment, the make variable CROSS_COMPILE is
7set which bypasses assiging tests to the makekfile variable TESTS.
8Since TESTS is empty, the 'make check' process never tries to run the
9tests on the hosts. On the target, the tests must be run manually.
10
11Also, in the libutil++ tests, a makefile variable SRCDIR is passed into
12the compilation phase, pointing to the runtime location of the test
13'file-manip-tests'. The mechanism used for a host test, based on
14'topdir' doesn't work. Instead, if CROSS_COMPILE is set, the
15makefile takes the path of SRCDIR from the build environment and not
16from an expression based on the host path 'topdir'.
17
18Upstream-Status: Pending
19
20Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
21
22diff --git a/configure.ac b/configure.ac
23index 41ece64..ce5a16f 100644
24--- a/configure.ac
25+++ b/configure.ac
26@@ -392,6 +392,7 @@ AC_ARG_ENABLE(account-check,
27 enable_account_check=$enableval, enable_account_check=yes)
28
29 AM_CONDITIONAL(CHECK_ACCOUNT, test "x$enable_account_check" = "xyes")
30+AM_CONDITIONAL(CROSS_COMPILE, test "x$cross_compiling" = "xyes")
31
32 AC_SUBST(OP_CFLAGS)
33 AC_SUBST(OP_CXXFLAGS)
34diff --git a/libdb/tests/Makefile.am b/libdb/tests/Makefile.am
35index 8a69003..d820090 100644
36--- a/libdb/tests/Makefile.am
37+++ b/libdb/tests/Makefile.am
38@@ -13,4 +13,6 @@ check_PROGRAMS = db_test
39 db_test_SOURCES = db_test.c
40 db_test_LDADD = ../libodb.a ../../libutil/libutil.a
41
42+if ! CROSS_COMPILE
43 TESTS = ${check_PROGRAMS}
44+endif
45diff --git a/libop/tests/Makefile.am b/libop/tests/Makefile.am
46index 8a79eb5..6d417c4 100644
47--- a/libop/tests/Makefile.am
48+++ b/libop/tests/Makefile.am
49@@ -33,4 +33,6 @@ load_events_files_tests_LDADD = ${COMMON_LIBS}
50 mangle_tests_SOURCES = mangle_tests.c
51 mangle_tests_LDADD = ${COMMON_LIBS}
52
53+if ! CROSS_COMPILE
54 TESTS = ${check_PROGRAMS} utf8_checker.sh
55+endif
56diff --git a/libregex/tests/Makefile.am b/libregex/tests/Makefile.am
57index 6f19838..1d176f9 100644
58--- a/libregex/tests/Makefile.am
59+++ b/libregex/tests/Makefile.am
60@@ -18,4 +18,6 @@ java_test_LDADD = \
61
62 EXTRA_DIST = mangled-name.in
63
64+if ! CROSS_COMPILE
65 TESTS = ${check_PROGRAMS}
66+endif
67diff --git a/libutil++/tests/Makefile.am b/libutil++/tests/Makefile.am
68index 51af031..a01ea2d 100644
69--- a/libutil++/tests/Makefile.am
70+++ b/libutil++/tests/Makefile.am
71@@ -1,7 +1,9 @@
72
73 REALPATH= readlink -f
74
75+if ! CROSS_COMPILE
76 SRCDIR := $(shell $(REALPATH) $(topdir)/libutil++/tests/ )
77+endif
78
79 AM_CPPFLAGS = \
80 -I ${top_srcdir}/libutil++ -D SRCDIR="\"$(SRCDIR)/\"" @OP_CPPFLAGS@
81@@ -46,4 +48,6 @@ cached_value_tests_LDADD = ${COMMON_LIBS}
82 utility_tests_SOURCES = utility_tests.cpp
83 utility_tests_LDADD = ${COMMON_LIBS}
84
85+if ! CROSS_COMPILE
86 TESTS = ${check_PROGRAMS}
87+endif
88diff --git a/libutil/tests/Makefile.am b/libutil/tests/Makefile.am
89index dfcd6ec..e8831b5 100644
90--- a/libutil/tests/Makefile.am
91+++ b/libutil/tests/Makefile.am
92@@ -12,4 +12,6 @@ file_tests_LDADD = ../libutil.a
93 string_tests_SOURCES = string_tests.c
94 string_tests_LDADD = ../libutil.a
95
96+if ! CROSS_COMPILE
97 TESTS = ${check_PROGRAMS}
98+endif
diff --git a/meta/recipes-kernel/oprofile/oprofile/run-ptest b/meta/recipes-kernel/oprofile/oprofile/run-ptest
new file mode 100644
index 0000000000..583ee1b8a8
--- /dev/null
+++ b/meta/recipes-kernel/oprofile/oprofile/run-ptest
@@ -0,0 +1,18 @@
1#!/bin/bash
2saved_dir=$PWD
3for dir in */tests ; do
4 cd $dir
5 for atest in * ; do
6 if [ \( -x $atest \) -a \( -f $atest \) ] ; then
7 ./$atest > ${atest}.stdout 2> ${atest}.stderr
8 if [ $? = 0 ] ; then
9 echo "PASS: $dir $atest"
10 rm ${atest}.stdout ${atest}.stderr
11 else
12 echo "FAIL: ${dir}/${atest}"
13 fi
14 fi
15 done
16 cd $saved_dir
17done
18