blob: 4b1e5b8eeb817422a8ff0dee5165f00db1c1bea2 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From cb3af8fb072f8999dbb5160bdc95a102b02fd37a Mon Sep 17 00:00:00 2001
2From: Kai Kang <kai.kang@windriver.com>
3Date: Fri, 30 Sep 2016 16:49:55 +0800
4Subject: [PATCH] kbd: create ptest sub-package
5
Patrick Williamsc0f7c042017-02-23 20:41:17 -06006Upstream-Status: Inappropriate [embedded specific]
7
8kbd is out of source built, then the value of $(srcdir) is relative path of
9${S}/tests to ${B}/tests. Macro DATADIR is defined with $(srcdir) and replaced
10in .c files by compiler, and string @DATADIR@ is replaced with $(srdir) by rule
11"%: %.in" in Makefile.
12
13But kbd-ptest puts test cases and resource files in same directory, then some
14ptest cases fail to find resources.
15
16Replace DATADIR and @DATADIR@ with current directory(dot) to make test cases
17run as expected.
18
19Signed-off-by: Kai Kang <kai.kang@windriver.com>
20
Andrew Geissler82c905d2020-04-13 13:39:40 -050021---
22 tests/Makefile.am | 4 ++--
23 tests/alt-is-meta.in | 2 +-
24 tests/dumpkeys-bkeymap.in | 4 ++--
25 tests/dumpkeys-fulltable.in | 2 +-
26 tests/dumpkeys-mktable.in | 4 ++--
27 5 files changed, 8 insertions(+), 8 deletions(-)
28
29diff --git a/tests/Makefile.am b/tests/Makefile.am
30index 8d0ab69..5147c28 100644
31--- a/tests/Makefile.am
32+++ b/tests/Makefile.am
33@@ -7,8 +7,8 @@ AM_CPPFLAGS = \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060034 -I$(builddir)/../src/libkeymap \
Andrew Geissler82c905d2020-04-13 13:39:40 -050035 -I$(srcdir)/../src/libkbdfile \
36 -I$(builddir)/../src/libkbdfile \
37- -DDATADIR=\"$(srcdir)\" \
38- -DABS_DATADIR=\"$(realpath $(srcdir))\" \
39+ -DDATADIR=\".\" \
40+ -DABS_DATADIR=\"/usr/lib/kbd/ptest/tests\" \
41 -DBUILDDIR=\"$(builddir)\"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060042
Andrew Geissler82c905d2020-04-13 13:39:40 -050043 AM_CFLAGS = $(CHECK_CFLAGS) $(CODE_COVERAGE_CFLAGS)
44diff --git a/tests/alt-is-meta.in b/tests/alt-is-meta.in
45index 3a1441f..d829f2e 100755
46--- a/tests/alt-is-meta.in
47+++ b/tests/alt-is-meta.in
48@@ -7,7 +7,7 @@ cd "$cwd"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060049 rc=0
50 temp="$(mktemp "@BUILDDIR@/temp.XXXXXXXXX")"
51
Andrew Geissler82c905d2020-04-13 13:39:40 -050052-datadir="@DATADIR@/data/alt-is-meta"
53+datadir="./data/alt-is-meta"
54
55 ./libkeymap-showmaps "$datadir"/alt-is-meta.map > "$temp" || rc=$?
56 cmp -s "$datadir/alt-is-meta.output" "$temp" || rc=$?
57diff --git a/tests/dumpkeys-bkeymap.in b/tests/dumpkeys-bkeymap.in
58index 03d4ca2..d1d0e26 100755
59--- a/tests/dumpkeys-bkeymap.in
60+++ b/tests/dumpkeys-bkeymap.in
61@@ -9,8 +9,8 @@ temp="$(mktemp "@BUILDDIR@/temp.XXXXXXXXX")"
62
63 datadir="@DATADIR@"
64
65-./libkeymap-bkeymap "$datadir/"../data/keymaps/i386/qwerty/defkeymap.map > "$temp" || rc=$?
66-cmp -s "$datadir/data/dumpkeys-bkeymap/bkeymap.bin" "$temp" || rc=$?
67+./libkeymap-bkeymap ../data/keymaps/i386/qwerty/defkeymap.map > "$temp" || rc=$?
68+cmp -s "./data/dumpkeys-bkeymap/bkeymap.bin" "$temp" || rc=$?
Patrick Williamsc0f7c042017-02-23 20:41:17 -060069
70 if [ "$rc" != 0 ]; then
71 printf 'failed\n'
Andrew Geissler82c905d2020-04-13 13:39:40 -050072diff --git a/tests/dumpkeys-fulltable.in b/tests/dumpkeys-fulltable.in
73index a3a5ece..67a73ef 100755
74--- a/tests/dumpkeys-fulltable.in
75+++ b/tests/dumpkeys-fulltable.in
Patrick Williamsc0f7c042017-02-23 20:41:17 -060076@@ -5,7 +5,7 @@ cwd="$(readlink -ev "${0%/*}")"
77 cd "$cwd"
78
79 BUILDDIR="@BUILDDIR@"
80-DATADIR="@DATADIR@"
81+DATADIR="."
82
83 check_keymap() {
84 local kmap temp rc
Andrew Geissler82c905d2020-04-13 13:39:40 -050085diff --git a/tests/dumpkeys-mktable.in b/tests/dumpkeys-mktable.in
86index 0f17c40..7e5161d 100755
87--- a/tests/dumpkeys-mktable.in
88+++ b/tests/dumpkeys-mktable.in
89@@ -7,8 +7,8 @@ cd "$cwd"
90 rc=0
91 temp="$(mktemp "@BUILDDIR@/temp.XXXXXXXXX")"
92
93-./libkeymap-mktable "@DATADIR@/"../data/keymaps/i386/qwerty/defkeymap.map > "$temp" || rc=$?
94-cmp -s "@DATADIR@/data/dumpkeys-mktable/defkeymap.c" "$temp" || rc=$?
95+./libkeymap-mktable ../data/keymaps/i386/qwerty/defkeymap.map > "$temp" || rc=$?
96+cmp -s "./data/dumpkeys-mktable/defkeymap.c" "$temp" || rc=$?
97
98 if [ "$rc" != 0 ]; then
99 printf 'failed\n'