All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] kbd: make libkbdfile-test08 ptest work for multilib
@ 2020-01-22 20:20 Mingde (Matthew) Zeng
  2020-01-22 21:19 ` Randy MacLeod
  0 siblings, 1 reply; 2+ messages in thread
From: Mingde (Matthew) Zeng @ 2020-01-22 20:20 UTC (permalink / raw)
  To: openembedded-core

This patch fixes kbd ptest libkbdfile-test08 failure in 64-bit images.

```sh
root@intel-x86-64:/usr/lib64/kbd/ptest# ./run-ptest
make: Entering directory '/usr/lib64/kbd/ptest/tests'
make[1]: Entering directory '/usr/lib64/kbd/ptest/tests'
PASS: libkbdfile-test01
PASS: libkbdfile-test02
PASS: libkbdfile-test03
PASS: libkbdfile-test04
PASS: libkbdfile-test05
PASS: libkbdfile-test06
PASS: libkbdfile-test07
FAIL: libkbdfile-test08
PASS: libkbdfile-test09
...
```

`DATADIR` and `ABS_DATADIR` are compile flags defined in
./kbd/tests/Makefile.am. `DATADIR` is the relative directory of
kbd, i.e `./kbd/ptest/tests` whereas `ABS_DATADIR` is the full
directory path, i.e `/usr/lib/kbd/ptest/tests`. The latter has a
problem when building ptests for a 64-bit image, because the tests
folder is located at `/usr/lib64/kbd/ptest/tests` instead.

Therefore `ABS_DATADIR` is changed to `DATADIR`, also consistent with
what *every other* kbd test is doing.

The test searches DATADIR recursively for a file named `test0.map`,
but it finds the wrong file at
    `/findfile/test_0/keymaps/test0.map`,
while it actually needs
    `/findfile/test_0/keymaps/i386/qwerty/test0.map`.

Thus appending `/i386` to `dirpath` so that `libkbdfile-test08.c`
    finds the right test file.

Signed-off-by: Matthew Zeng<Matthew.Zeng@windriver.com>
---
 ...append-i386-to-fix-libkbdfile-test08.patch | 45 +++++++++++++++++++
 meta/recipes-core/kbd/kbd_2.2.0.bb            |  1 +
 2 files changed, 46 insertions(+)
 create mode 100644 meta/recipes-core/kbd/kbd/0001-Use-DATADIR-and-append-i386-to-fix-libkbdfile-test08.patch

diff --git a/meta/recipes-core/kbd/kbd/0001-Use-DATADIR-and-append-i386-to-fix-libkbdfile-test08.patch b/meta/recipes-core/kbd/kbd/0001-Use-DATADIR-and-append-i386-to-fix-libkbdfile-test08.patch
new file mode 100644
index 0000000000..54e4dc9034
--- /dev/null
+++ b/meta/recipes-core/kbd/kbd/0001-Use-DATADIR-and-append-i386-to-fix-libkbdfile-test08.patch
@@ -0,0 +1,45 @@
+From 4c12f76f4177cfd560cf708a16774ebfadbd41a5 Mon Sep 17 00:00:00 2001
+From: "Mingde (Matthew) Zeng" <matthew.zeng@windriver.com>
+Date: Wed, 22 Jan 2020 11:02:17 -0500
+Subject: [PATCH] Use DATADIR and append i386 to fix libkbdfile-test08 ptest
+ failure
+
+Replace ABS_DATADIR with DATADIR and append i386 to dirpath.
+
+Upstream-Status: Inappropriate [OE specific]
+
+This OE specific patch applies to kbd v2.2.0 for now, the upstream
+made drastic changes since v2.2.0, in fact they got rid of ABS_DATADIR
+in commit 5b6df5c along with a series of other commits which may or
+may not fix this issue. We will find out in future releases.
+
+Signed-off-by: Matthew Zeng<Matthew.Zeng@windriver.com>
+---
+ tests/libkbdfile-test08.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tests/libkbdfile-test08.c b/tests/libkbdfile-test08.c
+index bf41707..5e287f1 100644
+--- a/tests/libkbdfile-test08.c
++++ b/tests/libkbdfile-test08.c
+@@ -14,14 +14,14 @@ main(int __attribute__((unused)) argc, char **argv)
+ 	if (!fp)
+ 		kbd_error(EXIT_FAILURE, 0, "unable to create kbdfile");
+
+-	const char *const dirpath[]  = { "", DATADIR "/findfile/test_0/keymaps/**", 0 };
++	const char *const dirpath[]  = { "", DATADIR "/findfile/test_0/keymaps/i386/**", 0 };
+ 	const char *const suffixes[] = { "", ".map", ".kmap", 0 };
+
+-	const char *expect = ABS_DATADIR "/findfile/test_0/keymaps/i386/qwerty/test0.map";
++	const char *expect = DATADIR "/findfile/test_0/keymaps/i386/qwerty/test0.map";
+
+ 	int rc = 0;
+
+-	rc = kbdfile_find((char *)(ABS_DATADIR "/findfile/test_0/keymaps/i386/qwerty/test0"), (char **) dirpath, (char **) suffixes, fp);
++	rc = kbdfile_find((char *)"test0", (char **) dirpath, (char **) suffixes, fp);
+
+ 	if (rc != 0)
+ 		kbd_error(EXIT_FAILURE, 0, "unable to find file");
+--
+2.24.1
+
diff --git a/meta/recipes-core/kbd/kbd_2.2.0.bb b/meta/recipes-core/kbd/kbd_2.2.0.bb
index df9b0bb90b..e13cea7634 100644
--- a/meta/recipes-core/kbd/kbd_2.2.0.bb
+++ b/meta/recipes-core/kbd/kbd_2.2.0.bb
@@ -16,6 +16,7 @@ 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)} \
            file://0001-analyze.l-add-missing-string-format.patch \
+           file://0001-Use-DATADIR-and-append-i386-to-fix-libkbdfile-test08.patch \
            "

 SRC_URI[md5sum] = "d1d7ae0b5fb875dc082731e09cd0c8bc"
--
2.24.0


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

* Re: [PATCHv2] kbd: make libkbdfile-test08 ptest work for multilib
  2020-01-22 20:20 [PATCHv2] kbd: make libkbdfile-test08 ptest work for multilib Mingde (Matthew) Zeng
@ 2020-01-22 21:19 ` Randy MacLeod
  0 siblings, 0 replies; 2+ messages in thread
From: Randy MacLeod @ 2020-01-22 21:19 UTC (permalink / raw)
  To: Mingde (Matthew) Zeng, openembedded-core


LGTM.

Thanks Matthew.
../Randy

On 1/22/20 3:20 PM, Mingde (Matthew) Zeng wrote:
> This patch fixes kbd ptest libkbdfile-test08 failure in 64-bit images.
> 
> ```sh
> root@intel-x86-64:/usr/lib64/kbd/ptest# ./run-ptest
> make: Entering directory '/usr/lib64/kbd/ptest/tests'
> make[1]: Entering directory '/usr/lib64/kbd/ptest/tests'
> PASS: libkbdfile-test01
> PASS: libkbdfile-test02
> PASS: libkbdfile-test03
> PASS: libkbdfile-test04
> PASS: libkbdfile-test05
> PASS: libkbdfile-test06
> PASS: libkbdfile-test07
> FAIL: libkbdfile-test08
> PASS: libkbdfile-test09
> ...
> ```
> 
> `DATADIR` and `ABS_DATADIR` are compile flags defined in
> ./kbd/tests/Makefile.am. `DATADIR` is the relative directory of
> kbd, i.e `./kbd/ptest/tests` whereas `ABS_DATADIR` is the full
> directory path, i.e `/usr/lib/kbd/ptest/tests`. The latter has a
> problem when building ptests for a 64-bit image, because the tests
> folder is located at `/usr/lib64/kbd/ptest/tests` instead.
> 
> Therefore `ABS_DATADIR` is changed to `DATADIR`, also consistent with
> what *every other* kbd test is doing.
> 
> The test searches DATADIR recursively for a file named `test0.map`,
> but it finds the wrong file at
>      `/findfile/test_0/keymaps/test0.map`,
> while it actually needs
>      `/findfile/test_0/keymaps/i386/qwerty/test0.map`.
> 
> Thus appending `/i386` to `dirpath` so that `libkbdfile-test08.c`
>      finds the right test file.
> 
> Signed-off-by: Matthew Zeng<Matthew.Zeng@windriver.com>
> ---
>   ...append-i386-to-fix-libkbdfile-test08.patch | 45 +++++++++++++++++++
>   meta/recipes-core/kbd/kbd_2.2.0.bb            |  1 +
>   2 files changed, 46 insertions(+)
>   create mode 100644 meta/recipes-core/kbd/kbd/0001-Use-DATADIR-and-append-i386-to-fix-libkbdfile-test08.patch
> 
> diff --git a/meta/recipes-core/kbd/kbd/0001-Use-DATADIR-and-append-i386-to-fix-libkbdfile-test08.patch b/meta/recipes-core/kbd/kbd/0001-Use-DATADIR-and-append-i386-to-fix-libkbdfile-test08.patch
> new file mode 100644
> index 0000000000..54e4dc9034
> --- /dev/null
> +++ b/meta/recipes-core/kbd/kbd/0001-Use-DATADIR-and-append-i386-to-fix-libkbdfile-test08.patch
> @@ -0,0 +1,45 @@
> +From 4c12f76f4177cfd560cf708a16774ebfadbd41a5 Mon Sep 17 00:00:00 2001
> +From: "Mingde (Matthew) Zeng" <matthew.zeng@windriver.com>
> +Date: Wed, 22 Jan 2020 11:02:17 -0500
> +Subject: [PATCH] Use DATADIR and append i386 to fix libkbdfile-test08 ptest
> + failure
> +
> +Replace ABS_DATADIR with DATADIR and append i386 to dirpath.
> +
> +Upstream-Status: Inappropriate [OE specific]
> +
> +This OE specific patch applies to kbd v2.2.0 for now, the upstream
> +made drastic changes since v2.2.0, in fact they got rid of ABS_DATADIR
> +in commit 5b6df5c along with a series of other commits which may or
> +may not fix this issue. We will find out in future releases.
> +
> +Signed-off-by: Matthew Zeng<Matthew.Zeng@windriver.com>
> +---
> + tests/libkbdfile-test08.c | 6 +++---
> + 1 file changed, 3 insertions(+), 3 deletions(-)
> +
> +diff --git a/tests/libkbdfile-test08.c b/tests/libkbdfile-test08.c
> +index bf41707..5e287f1 100644
> +--- a/tests/libkbdfile-test08.c
> ++++ b/tests/libkbdfile-test08.c
> +@@ -14,14 +14,14 @@ main(int __attribute__((unused)) argc, char **argv)
> + 	if (!fp)
> + 		kbd_error(EXIT_FAILURE, 0, "unable to create kbdfile");
> +
> +-	const char *const dirpath[]  = { "", DATADIR "/findfile/test_0/keymaps/**", 0 };
> ++	const char *const dirpath[]  = { "", DATADIR "/findfile/test_0/keymaps/i386/**", 0 };
> + 	const char *const suffixes[] = { "", ".map", ".kmap", 0 };
> +
> +-	const char *expect = ABS_DATADIR "/findfile/test_0/keymaps/i386/qwerty/test0.map";
> ++	const char *expect = DATADIR "/findfile/test_0/keymaps/i386/qwerty/test0.map";
> +
> + 	int rc = 0;
> +
> +-	rc = kbdfile_find((char *)(ABS_DATADIR "/findfile/test_0/keymaps/i386/qwerty/test0"), (char **) dirpath, (char **) suffixes, fp);
> ++	rc = kbdfile_find((char *)"test0", (char **) dirpath, (char **) suffixes, fp);
> +
> + 	if (rc != 0)
> + 		kbd_error(EXIT_FAILURE, 0, "unable to find file");
> +--
> +2.24.1
> +
> diff --git a/meta/recipes-core/kbd/kbd_2.2.0.bb b/meta/recipes-core/kbd/kbd_2.2.0.bb
> index df9b0bb90b..e13cea7634 100644
> --- a/meta/recipes-core/kbd/kbd_2.2.0.bb
> +++ b/meta/recipes-core/kbd/kbd_2.2.0.bb
> @@ -16,6 +16,7 @@ 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)} \
>              file://0001-analyze.l-add-missing-string-format.patch \
> +           file://0001-Use-DATADIR-and-append-i386-to-fix-libkbdfile-test08.patch \
>              "
> 
>   SRC_URI[md5sum] = "d1d7ae0b5fb875dc082731e09cd0c8bc"
> --
> 2.24.0
> 


-- 
# Randy MacLeod
# Wind River Linux


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

end of thread, other threads:[~2020-01-22 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-22 20:20 [PATCHv2] kbd: make libkbdfile-test08 ptest work for multilib Mingde (Matthew) Zeng
2020-01-22 21:19 ` Randy MacLeod

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.