summaryrefslogtreecommitdiffstats
path: root/meta/classes/ptest.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/ptest.bbclass')
-rw-r--r--meta/classes/ptest.bbclass62
1 files changed, 62 insertions, 0 deletions
diff --git a/meta/classes/ptest.bbclass b/meta/classes/ptest.bbclass
new file mode 100644
index 0000000..ea4a38b
--- /dev/null
+++ b/meta/classes/ptest.bbclass
@@ -0,0 +1,62 @@
1SUMMARY_${PN}-ptest ?= "${SUMMARY} - Package test files"
2DESCRIPTION_${PN}-ptest ?= "${DESCRIPTION} \
3This package contains a test directory ${PTEST_PATH} for package test purposes."
4
5PTEST_PATH ?= "${libdir}/${PN}/ptest"
6FILES_${PN}-ptest = "${PTEST_PATH}"
7SECTION_${PN}-ptest = "devel"
8ALLOW_EMPTY_${PN}-ptest = "1"
9PTEST_ENABLED = "${@base_contains('DISTRO_FEATURES', 'ptest', '1', '0', d)}"
10PTEST_ENABLED_class-native = ""
11PTEST_ENABLED_class-nativesdk = ""
12PTEST_ENABLED_class-cross-canadian = ""
13RDEPENDS_${PN}-ptest_class-native = ""
14RDEPENDS_${PN}-ptest_class-nativesdk = ""
15
16PACKAGES =+ "${@bb.utils.contains('PTEST_ENABLED', '1', '${PN}-ptest', '', d)}"
17
18do_configure_ptest() {
19 :
20}
21
22do_configure_ptest_base() {
23 do_configure_ptest
24}
25
26do_compile_ptest() {
27 :
28}
29
30do_compile_ptest_base() {
31 do_compile_ptest
32}
33
34do_install_ptest() {
35 :
36}
37
38do_install_ptest_base() {
39 if [ -f ${WORKDIR}/run-ptest ]; then
40 install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
41 if grep -q install-ptest: Makefile; then
42 oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
43 fi
44 do_install_ptest
45 fi
46}
47
48do_install_ptest_base[cleandirs] = "${D}${PTEST_PATH}"
49
50addtask configure_ptest_base after do_configure before do_compile
51addtask compile_ptest_base after do_compile before do_install
52addtask install_ptest_base after do_install before do_package do_populate_sysroot
53
54python () {
55 if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
56 d.setVarFlag('do_install_ptest_base', 'fakeroot', 1)
57
58 # Remove all '*ptest_base' tasks when ptest is not enabled
59 if not(d.getVar('PTEST_ENABLED', True) == "1"):
60 for i in ['do_configure_ptest_base', 'do_compile_ptest_base', 'do_install_ptest_base']:
61 bb.build.deltask(i, d)
62}