Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] kbd: create ptest sub-package
@ 2016-09-30  8:49 kai.kang
  2016-09-30  8:49 ` [PATCH 1/1] " kai.kang
  0 siblings, 1 reply; 2+ messages in thread
From: kai.kang @ 2016-09-30  8:49 UTC (permalink / raw)
  To: openembedded-core

From: Kai Kang <kai.kang@windriver.com>

The following changes since commit 5d8a968ecdf40babe452b0ac63d94a7a163710ae:

  dev-manual: Applied review changes to GNU debugging section. (2016-09-28 15:02:33 +0100)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib kangkai/kbd
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/kbd

Kai Kang (1):
  kbd: create ptest sub-package

 meta/recipes-core/kbd/kbd/run-ptest                |  4 ++
 .../kbd/kbd/set-proper-path-of-resources.patch     | 56 ++++++++++++++++++++++
 meta/recipes-core/kbd/kbd_2.0.3.bb                 | 19 ++++++++
 3 files changed, 79 insertions(+)
 create mode 100644 meta/recipes-core/kbd/kbd/run-ptest
 create mode 100644 meta/recipes-core/kbd/kbd/set-proper-path-of-resources.patch

-- 
2.9.3



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] kbd: create ptest sub-package
  2016-09-30  8:49 [PATCH 0/1] kbd: create ptest sub-package kai.kang
@ 2016-09-30  8:49 ` kai.kang
  0 siblings, 0 replies; 2+ messages in thread
From: kai.kang @ 2016-09-30  8:49 UTC (permalink / raw)
  To: openembedded-core

From: Kai Kang <kai.kang@windriver.com>

Create kbd-ptest sub-package:

* add file run-ptest and runtime dependency make
* modify installed Makefile to disable remake Makefile and the test
  cases when run the ptest
* add patch to set proper path for test cases to get resource files

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 meta/recipes-core/kbd/kbd/run-ptest                |  4 ++
 .../kbd/kbd/set-proper-path-of-resources.patch     | 56 ++++++++++++++++++++++
 meta/recipes-core/kbd/kbd_2.0.3.bb                 | 19 ++++++++
 3 files changed, 79 insertions(+)
 create mode 100644 meta/recipes-core/kbd/kbd/run-ptest
 create mode 100644 meta/recipes-core/kbd/kbd/set-proper-path-of-resources.patch

diff --git a/meta/recipes-core/kbd/kbd/run-ptest b/meta/recipes-core/kbd/kbd/run-ptest
new file mode 100644
index 0000000..7a2d205
--- /dev/null
+++ b/meta/recipes-core/kbd/kbd/run-ptest
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+CURDIR=$(dirname `readlink -f $0`)
+make -k -C ${CURDIR}/tests check-TESTS
diff --git a/meta/recipes-core/kbd/kbd/set-proper-path-of-resources.patch b/meta/recipes-core/kbd/kbd/set-proper-path-of-resources.patch
new file mode 100644
index 0000000..27d6f42
--- /dev/null
+++ b/meta/recipes-core/kbd/kbd/set-proper-path-of-resources.patch
@@ -0,0 +1,56 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+kbd is out of source built, then the value of $(srcdir) is relative path of
+${S}/tests to ${B}/tests. Macro DATADIR is defined with $(srcdir) and replaced
+in .c files by compiler, and string @DATADIR@ is replaced with $(srdir) by rule
+"%: %.in" in Makefile.
+
+But kbd-ptest puts test cases and resource files in same directory, then some
+ptest cases fail to find resources.
+
+Replace DATADIR and @DATADIR@ with current directory(dot) to make test cases
+run as expected.
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 1976333..b36aef3 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -1,7 +1,7 @@
+ AM_CPPFLAGS = \
+ 	-I$(srcdir)/../src/libkeymap \
+ 	-I$(builddir)/../src/libkeymap \
+-	-DDATADIR=\"$(srcdir)\" -DBUILDDIR=\"$(builddir)\"
++	-DDATADIR=\".\" -DBUILDDIR=\"$(builddir)\"
+ 
+ AM_CFLAGS = $(CHECK_CFLAGS)
+ LDADD  = $(top_builddir)/src/libkeymap/libkeymap.la $(CHECK_LIBS)
+diff --git a/tests/alt-is-meta.in b/tests/alt-is-meta.in
+index ddd5ed8..772fb51 100755
+--- a/tests/alt-is-meta.in
++++ b/tests/alt-is-meta.in
+@@ -7,8 +7,8 @@ cd "$cwd"
+ rc=0
+ temp="$(mktemp "@BUILDDIR@/temp.XXXXXXXXX")"
+ 
+-./libkeymap-showmaps "@DATADIR@"/alt-is-meta.map > "$temp" || rc=$?
+-cmp -s "@DATADIR@//alt-is-meta.output" "$temp" || rc=$?
++./libkeymap-showmaps ./alt-is-meta.map > "$temp" || rc=$?
++cmp -s "./alt-is-meta.output" "$temp" || rc=$?
+ 
+ if [ "$rc" != 0 ]; then
+ 	printf 'failed\n'
+diff --git a/tests/dumpkeys-fulltable.in b/tests/dumpkeys-fulltable.in
+index 7c856e5..14d92c1 100755
+--- a/tests/dumpkeys-fulltable.in
++++ b/tests/dumpkeys-fulltable.in
+@@ -5,7 +5,7 @@ cwd="$(readlink -ev "${0%/*}")"
+ cd "$cwd"
+ 
+ BUILDDIR="@BUILDDIR@"
+-DATADIR="@DATADIR@"
++DATADIR="."
+ 
+ check_keymap() {
+ 	local kmap temp rc
diff --git a/meta/recipes-core/kbd/kbd_2.0.3.bb b/meta/recipes-core/kbd/kbd_2.0.3.bb
index ea1e0b4..54d1683 100644
--- a/meta/recipes-core/kbd/kbd_2.0.3.bb
+++ b/meta/recipes-core/kbd/kbd_2.0.3.bb
@@ -11,6 +11,8 @@ RPROVIDES_${PN} = "console-tools"
 RCONFLICTS_${PN} = "console-tools"
 
 SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
+           file://run-ptest \
+           ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://set-proper-path-of-resources.patch', '', d)} \
           "
 
 SRC_URI[md5sum] = "231b46e7142eb41ea3ae06d2ded3c208"
@@ -19,6 +21,21 @@ SRC_URI[sha256sum] = "7a899de1c0eb75f3aea737095a736f2375e1cbfbe693fc14a3fe0bfb46
 PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
 PACKAGECONFIG[pam] = "--enable-vlock, --disable-vlock, libpam,"
 
+do_compile_ptest() {
+    oe_runmake -C ${B}/tests dumpkeys-fulltable alt-is-meta
+}
+
+do_install_ptest() {
+    install -D ${B}/tests/Makefile ${D}${PTEST_PATH}/tests/Makefile
+    sed -i -e '/Makefile:/,/^$/d' -e '/%: %.in/,/^$/d' \
+	-e '/libkeymap_.*_SOURCES =/d' -e '/$(EXEEXT):/,/^$/d' ${D}${PTEST_PATH}/tests/Makefile
+
+    find ${B}/tests -executable -exec install {} ${D}${PTEST_PATH}/tests \;
+    find ${S}/tests \( -name \*.map -o -name \*.bin -o -name \*.output \) -exec install {} ${D}${PTEST_PATH}/tests \;
+
+    install -D -m 755 ${S}/config/test-driver ${D}${PTEST_PATH}/config/test-driver
+}
+
 PACKAGES += "${PN}-consolefonts ${PN}-keymaps ${PN}-unimaps ${PN}-consoletrans"
 
 FILES_${PN}-consolefonts = "${datadir}/consolefonts"
@@ -26,6 +43,8 @@ FILES_${PN}-consoletrans = "${datadir}/consoletrans"
 FILES_${PN}-keymaps = "${datadir}/keymaps"
 FILES_${PN}-unimaps = "${datadir}/unimaps"
 
+RDEPENDS_${PN}-ptest = "make"
+
 inherit update-alternatives
 
 ALTERNATIVE_${PN} = "chvt deallocvt fgconsole openvt"
-- 
2.9.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-30  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-30  8:49 [PATCH 0/1] kbd: create ptest sub-package kai.kang
2016-09-30  8:49 ` [PATCH 1/1] " kai.kang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox