* [PATCH V1] kbd: Add ptest support
@ 2023-05-15 7:35 qiutt
2023-05-15 9:42 ` [OE-core] " Ross Burton
0 siblings, 1 reply; 4+ messages in thread
From: qiutt @ 2023-05-15 7:35 UTC (permalink / raw)
To: openembedded-core; +Cc: Qiu Tingting
From: Qiu Tingting <qiutt@fujitsu.com>
Add a ptest for kbd
- It is taking around 1s to execute with kvm, so added it to PTESTS_FAST
- It contains libkeymap unit tests(27 cases) and libkbdfile unit tests(13 cases)
Signed-off-by: Qiu Tingting <qiutt@fujitsu.com>
---
meta/recipes-core/kbd/files/run-ptest | 18 +++++++
meta/recipes-core/kbd/kbd_2.5.1.bb | 72 ++++++++++++++++++++++++++-
2 files changed, 89 insertions(+), 1 deletion(-)
create mode 100644 meta/recipes-core/kbd/files/run-ptest
diff --git a/meta/recipes-core/kbd/files/run-ptest b/meta/recipes-core/kbd/files/run-ptest
new file mode 100644
index 0000000000..cace13b8cb
--- /dev/null
+++ b/meta/recipes-core/kbd/files/run-ptest
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Define test work dir
+WORKDIR=@PTEST_PATH@/tests/
+
+# Run test
+cd ${WORKDIR}
+
+# create atconfig
+if [[ ! -f "atconfig" ]]; then
+ echo 'abs_builddir="@PTEST_PATH@/tests/"' > atconfig
+ echo 'abs_srcdir="@PTEST_PATH@/tests/"' >> atconfig
+ echo 'abs_top_builddir="@PTEST_PATH@/"' >> atconfig
+fi
+
+./testsuite -k unittest | sed -e '/[0-9]:/s/://' \
+ -e '/ ok/s/^/PASS: /;/ FAILED/s/^/FAIL: /;/ skipped/s/^/SKIP: /' \
+ -e '/ ok/s/ ok.*//;/ skipped/s/ skipped.*//;/ FAILED/s/ FAILED.*//'
diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb b/meta/recipes-core/kbd/kbd_2.5.1.bb
index 7662b8f685..bed1ad7240 100644
--- a/meta/recipes-core/kbd/kbd_2.5.1.bb
+++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
@@ -5,7 +5,7 @@ DESCRIPTION = "The kbd project contains tools for managing Linux console (Linux
LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
-inherit autotools gettext pkgconfig
+inherit autotools gettext pkgconfig ptest
DEPENDS += "flex-native"
@@ -14,6 +14,7 @@ RPROVIDES:${PN} = "console-tools"
RCONFLICTS:${PN} = "console-tools"
SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
+ file://run-ptest \
"
SRC_URI[sha256sum] = "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
@@ -45,3 +46,72 @@ ALTERNATIVE:${PN} = "chvt deallocvt fgconsole openvt showkey \
ALTERNATIVE_PRIORITY = "100"
BBCLASSEXTEND = "native"
+
+
+RDEPENDS:${PN}-ptest += "bash"
+
+do_compile_ptest() {
+ # update DATADIR in Makefile
+ sed -i 's,-DDATADIR=.*,-DDATADIR=\\\"${PTEST_PATH}/tests\\\" \\,g' ${B}/tests/libkeymap/Makefile
+ sed -i 's,-DDATADIR=.*,-DDATADIR=\\\"${PTEST_PATH}/tests\\\" \\,g' ${B}/tests/helpers/Makefile
+ sed -i 's,-DDATADIR=.*,-DDATADIR=\\\"${PTEST_PATH}/tests\\\" \\,g' ${B}/tests/libkbdfile/Makefile
+
+ # recompile tests
+ oe_runmake -C ${B}/tests/ clean
+ oe_runmake -C ${B}/tests/
+}
+
+do_install_ptest() {
+ # install files from build directory
+ install -d ${D}${PTEST_PATH}/tests/
+ install --mode=755 ${B}/tests/testsuite ${D}${PTEST_PATH}/tests/
+ install -d ${D}${PTEST_PATH}/tests/libkeymap/
+ find ${B}/tests/libkeymap/ -type f -not -name "*.o" -not -name "Makefile" \
+ -exec install --mode=755 {} ${D}${PTEST_PATH}/tests/libkeymap/ \;
+ install -d ${D}${PTEST_PATH}/tests/helpers/
+ find ${B}/tests/helpers/ -type f -not -name "*.o" -not -name "Makefile" \
+ -exec install --mode=755 {} ${D}${PTEST_PATH}/tests/helpers/ \;
+ install -d ${D}${PTEST_PATH}/tests/libkbdfile/
+ find ${B}/tests/libkbdfile/ -type f -not -name "*.o" -not -name "Makefile" \
+ -exec install --mode=755 {} ${D}${PTEST_PATH}/tests/libkbdfile/ \;
+ install -d ${D}${PTEST_PATH}/src/
+ install --mode=755 ${B}/src/loadkeys ${D}${PTEST_PATH}/src/
+
+ # install files from src/data directory
+ install -d ${D}${PTEST_PATH}/data/keymaps/i386/qwerty/
+ install ${S}/data/keymaps/i386/qwerty/defkeymap.map ${D}${PTEST_PATH}/data/keymaps/i386/qwerty/
+
+ # install files from src/tests/data directory
+ install -d ${D}${PTEST_PATH}/tests/data/
+ install -d ${D}${PTEST_PATH}/tests/data/libkeymap/
+ install ${S}/tests/data/libkeymap/* ${D}${PTEST_PATH}/tests/data/libkeymap/
+ install -d ${D}${PTEST_PATH}/tests/data/alt-is-meta/
+ install ${S}/tests/data/alt-is-meta/* ${D}${PTEST_PATH}/tests/data/alt-is-meta/
+ install -d ${D}${PTEST_PATH}/tests/data/bkeymap-2.0.4/
+ install ${S}/tests/data/bkeymap-2.0.4/* ${D}${PTEST_PATH}/tests/data/bkeymap-2.0.4/
+ install -d ${D}${PTEST_PATH}/tests/data/dumpkeys-mktable/
+ install ${S}/tests/data/dumpkeys-mktable/* ${D}${PTEST_PATH}/tests/data/dumpkeys-mktable/
+ install -d ${D}${PTEST_PATH}/tests/data/dumpkeys-fulltable/
+ install ${S}/tests/data/dumpkeys-fulltable/* ${D}${PTEST_PATH}/tests/data/dumpkeys-fulltable/
+ install -d ${D}${PTEST_PATH}/tests/data/findfile/test_1/consolefonts/
+ install ${S}/tests/data/findfile/test_1/consolefonts/* ${D}${PTEST_PATH}/tests/data/findfile/test_1/consolefonts/
+ install -d ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/include/
+ install ${S}/tests/data/findfile/test_0/keymaps/test0.map ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/
+ install ${S}/tests/data/findfile/test_0/keymaps/include/* ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/include/
+ install -d ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/include/
+ install ${S}/tests/data/findfile/test_0/keymaps/i386/include/* ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/include/
+ install -d ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/qwerty/
+ install ${S}/tests/data/findfile/test_0/keymaps/i386/qwerty/* ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/qwerty/
+ install -d ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/qwertz/
+ install ${S}/tests/data/findfile/test_0/keymaps/i386/qwertz/* ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/qwertz/
+ install -d ${D}${PTEST_PATH}/tests/data/keymaps/i386/qwerty/
+ install ${S}/tests/data/keymaps/i386/qwerty/* ${D}${PTEST_PATH}/tests/data/keymaps/i386/qwerty/
+ install -d ${D}${PTEST_PATH}/tests/data/keymaps/i386/include/
+ install ${S}/tests/data/keymaps/i386/include/* ${D}${PTEST_PATH}/tests/data/keymaps/i386/include/
+ install -d ${D}${PTEST_PATH}/tests/data/keymaps/include/
+ install ${S}/tests/data/keymaps/include/* ${D}${PTEST_PATH}/tests/data/keymaps/include/
+
+
+ # update PTEST_PATH in run-ptest
+ sed -i "s#@PTEST_PATH@#${PTEST_PATH}#g" ${D}${PTEST_PATH}/run-ptest
+}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH V1] kbd: Add ptest support
2023-05-15 7:35 [PATCH V1] kbd: Add ptest support qiutt
@ 2023-05-15 9:42 ` Ross Burton
2023-05-16 4:11 ` qiutt
2023-05-18 1:49 ` qiutt
0 siblings, 2 replies; 4+ messages in thread
From: Ross Burton @ 2023-05-15 9:42 UTC (permalink / raw)
To: qiutt@fujitsu.com; +Cc: openembedded-core@lists.openembedded.org
On 15 May 2023, at 08:35, qiutt@fujitsu.com via lists.openembedded.org <qiutt=fujitsu.com@lists.openembedded.org> wrote:
> +# create atconfig
> +if [[ ! -f "atconfig" ]]; then
> + echo 'abs_builddir="@PTEST_PATH@/tests/"' > atconfig
> + echo 'abs_srcdir="@PTEST_PATH@/tests/"' >> atconfig
> + echo 'abs_top_builddir="@PTEST_PATH@/"' >> atconfig
> +fi
You can generate this file when the package is built, surely.
> +RDEPENDS:${PN}-ptest += "bash"
Did you try to port the test suite away from bash?
Ross
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V1] kbd: Add ptest support
2023-05-15 9:42 ` [OE-core] " Ross Burton
@ 2023-05-16 4:11 ` qiutt
2023-05-18 1:49 ` qiutt
1 sibling, 0 replies; 4+ messages in thread
From: qiutt @ 2023-05-16 4:11 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 696 bytes --]
Hi,Ross
>
>
>> +# create atconfig
>> +if [[ ! -f "atconfig" ]]; then
>> + echo 'abs_builddir="@PTEST_PATH@/tests/"' > atconfig
>> + echo 'abs_srcdir="@PTEST_PATH@/tests/"' >> atconfig
>> + echo 'abs_top_builddir="@PTEST_PATH@/"' >> atconfig
>> +fi
>
> You can generate this file when the package is built, surely.
>
When the package is built, this file is created, but the directory is not PTEST_PATH.
So, I create a new file for ptest.
Of course, there is no problem using the built file.
I will try to modify this patch.
>
>
>> +RDEPENDS:${PN}-ptest += "bash"
>
> Did you try to port the test suite away from bash?
No, I didn't.
I will try to delete it.
[-- Attachment #2: Type: text/html, Size: 1007 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V1] kbd: Add ptest support
2023-05-15 9:42 ` [OE-core] " Ross Burton
2023-05-16 4:11 ` qiutt
@ 2023-05-18 1:49 ` qiutt
1 sibling, 0 replies; 4+ messages in thread
From: qiutt @ 2023-05-18 1:49 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 104 bytes --]
Hi, Ross
Please review "[PATCH V2] kbd: Add ptest support".
Thanks.
Best regards,
Qiu Tingting
[-- Attachment #2: Type: text/html, Size: 128 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-18 1:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-15 7:35 [PATCH V1] kbd: Add ptest support qiutt
2023-05-15 9:42 ` [OE-core] " Ross Burton
2023-05-16 4:11 ` qiutt
2023-05-18 1:49 ` qiutt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.