summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/babeltrace2/0001-tests-fix-test-applications-in-cpp-common.patch
blob: 87f94fb0873e07000cc13b92e88b4a9bae9e5834 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
From 1dc81f272855d94e6a78f7d10ea952745d991aa9 Mon Sep 17 00:00:00 2001
From: Bin Lan <bin.lan.cn@windriver.com>
Date: Tue, 11 Mar 2025 17:19:11 +0800
Subject: [PATCH] Tests: fix test applications in cpp-common are needed to
 re-build

Test applications in cpp-common directory are needed to re-build when
calling make check in embedded system. The following error is shown
when running test applications:
make[3]: *** No rule to make target 'cpp-common/test-c-string-view.cpp',
needed by 'cpp-common/test-c-string-view.o'.
make[3]: *** No rule to make target '../tests/utils/tap/libtap.la',
needed by 'cpp-common/test-c-string-view'.
make[3]: *** No rule to make target '../src/common/libcommon.la',
needed by 'cpp-common/test-c-string-view'.
make[3]: *** No rule to make target '../src/logging/liblogging.la',
needed by 'cpp-common/test-c-string-view'.
...
make[2]: *** [Makefile:1274: check-TESTS] Error 2
make[1]: *** [Makefile:1805: check-am] Error 2
make: *** [Makefile:1033: check-recursive] Error 1
make: Target 'check' not remade because of errors.

Create some new shell scripts which are used to call test applications
in cpp-common directory. Then these test applications can run without
actually examining the source code.

Upstream-Status: Submitted [https://review.lttng.org/c/babeltrace/+/14213]

Signed-off-by: Bin Lan <bin.lan.cn@windriver.com>
---
 tests/Makefile.am                      |  6 +++---
 tests/cpp-common/test-c-string-view.sh | 17 +++++++++++++++++
 tests/cpp-common/test-unicode-conv.sh  | 17 +++++++++++++++++
 tests/cpp-common/test-uuid.sh          | 17 +++++++++++++++++
 4 files changed, 54 insertions(+), 3 deletions(-)
 create mode 100755 tests/cpp-common/test-c-string-view.sh
 create mode 100755 tests/cpp-common/test-unicode-conv.sh
 create mode 100755 tests/cpp-common/test-uuid.sh

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2a4022bc4..c79b77b32 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -129,9 +129,9 @@ cpp_common_test_unicode_conv_LDADD = \
 	$(COMMON_TEST_LDADD)
 
 TESTS_CPP_COMMON = \
-	cpp-common/test-c-string-view \
-	cpp-common/test-uuid \
-	cpp-common/test-unicode-conv
+	cpp-common/test-c-string-view.sh \
+	cpp-common/test-uuid.sh \
+	cpp-common/test-unicode-conv.sh
 
 TESTS_LIB = \
 	lib/test-bt-uuid \
diff --git a/tests/cpp-common/test-c-string-view.sh b/tests/cpp-common/test-c-string-view.sh
new file mode 100755
index 000000000..9c2ca5818
--- /dev/null
+++ b/tests/cpp-common/test-c-string-view.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2025 Bin Lan <bin.lan.cn@windriver.com>
+#
+
+if [ -n "${BT_TESTS_SRCDIR:-}" ]; then
+	UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
+else
+	UTILSSH="$(dirname "$0")/../utils/utils.sh"
+fi
+
+# shellcheck source=../utils/utils.sh
+source "$UTILSSH"
+
+"${BT_TESTS_BUILDDIR}/cpp-common/test-c-string-view" "$BT_TESTS_BT2_BIN"
diff --git a/tests/cpp-common/test-unicode-conv.sh b/tests/cpp-common/test-unicode-conv.sh
new file mode 100755
index 000000000..df490b2eb
--- /dev/null
+++ b/tests/cpp-common/test-unicode-conv.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2025 Bin Lan <bin.lan.cn@windriver.com>
+#
+
+if [ -n "${BT_TESTS_SRCDIR:-}" ]; then
+	UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
+else
+	UTILSSH="$(dirname "$0")/../utils/utils.sh"
+fi
+
+# shellcheck source=../utils/utils.sh
+source "$UTILSSH"
+
+"${BT_TESTS_BUILDDIR}/cpp-common/test-unicode-conv" "$BT_TESTS_BT2_BIN"
diff --git a/tests/cpp-common/test-uuid.sh b/tests/cpp-common/test-uuid.sh
new file mode 100755
index 000000000..8c65daa94
--- /dev/null
+++ b/tests/cpp-common/test-uuid.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2025 Bin Lan <bin.lan.cn@windriver.com>
+#
+
+if [ -n "${BT_TESTS_SRCDIR:-}" ]; then
+	UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
+else
+	UTILSSH="$(dirname "$0")/../utils/utils.sh"
+fi
+
+# shellcheck source=../utils/utils.sh
+source "$UTILSSH"
+
+"${BT_TESTS_BUILDDIR}/cpp-common/test-uuid" "$BT_TESTS_BT2_BIN"
-- 
2.34.1