1From 1dc81f272855d94e6a78f7d10ea952745d991aa9 Mon Sep 17 00:00:00 2001 2From: Bin Lan <bin.lan.cn@windriver.com> 3Date: Tue, 11 Mar 2025 17:19:11 +0800 4Subject: [PATCH] Tests: fix test applications in cpp-common are needed to 5 re-build 6 7Test applications in cpp-common directory are needed to re-build when 8calling make check in embedded system. The following error is shown 9when running test applications: 10make[3]: *** No rule to make target 'cpp-common/test-c-string-view.cpp', 11needed by 'cpp-common/test-c-string-view.o'. 12make[3]: *** No rule to make target '../tests/utils/tap/libtap.la', 13needed by 'cpp-common/test-c-string-view'. 14make[3]: *** No rule to make target '../src/common/libcommon.la', 15needed by 'cpp-common/test-c-string-view'. 16make[3]: *** No rule to make target '../src/logging/liblogging.la', 17needed by 'cpp-common/test-c-string-view'. 18... 19make[2]: *** [Makefile:1274: check-TESTS] Error 2 20make[1]: *** [Makefile:1805: check-am] Error 2 21make: *** [Makefile:1033: check-recursive] Error 1 22make: Target 'check' not remade because of errors. 23 24Create some new shell scripts which are used to call test applications 25in cpp-common directory. Then these test applications can run without 26actually examining the source code. 27 28Upstream-Status: Submitted [https://review.lttng.org/c/babeltrace/+/14213] 29 30Signed-off-by: Bin Lan <bin.lan.cn@windriver.com> 31--- 32 tests/Makefile.am | 6 +++--- 33 tests/cpp-common/test-c-string-view.sh | 17 +++++++++++++++++ 34 tests/cpp-common/test-unicode-conv.sh | 17 +++++++++++++++++ 35 tests/cpp-common/test-uuid.sh | 17 +++++++++++++++++ 36 4 files changed, 54 insertions(+), 3 deletions(-) 37 create mode 100755 tests/cpp-common/test-c-string-view.sh 38 create mode 100755 tests/cpp-common/test-unicode-conv.sh 39 create mode 100755 tests/cpp-common/test-uuid.sh 40 41diff --git a/tests/Makefile.am b/tests/Makefile.am 42index 2a4022bc4..c79b77b32 100644 43--- a/tests/Makefile.am 44+++ b/tests/Makefile.am 45@@ -129,9 +129,9 @@ cpp_common_test_unicode_conv_LDADD = \ 46 $(COMMON_TEST_LDADD) 47 48 TESTS_CPP_COMMON = \ 49- cpp-common/test-c-string-view \ 50- cpp-common/test-uuid \ 51- cpp-common/test-unicode-conv 52+ cpp-common/test-c-string-view.sh \ 53+ cpp-common/test-uuid.sh \ 54+ cpp-common/test-unicode-conv.sh 55 56 TESTS_LIB = \ 57 lib/test-bt-uuid \ 58diff --git a/tests/cpp-common/test-c-string-view.sh b/tests/cpp-common/test-c-string-view.sh 59new file mode 100755 60index 000000000..9c2ca5818 61--- /dev/null 62+++ b/tests/cpp-common/test-c-string-view.sh 63@@ -0,0 +1,17 @@ 64+#!/bin/bash 65+# 66+# SPDX-License-Identifier: GPL-2.0-only 67+# 68+# Copyright (C) 2025 Bin Lan <bin.lan.cn@windriver.com> 69+# 70+ 71+if [ -n "${BT_TESTS_SRCDIR:-}" ]; then 72+ UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" 73+else 74+ UTILSSH="$(dirname "$0")/../utils/utils.sh" 75+fi 76+ 77+# shellcheck source=../utils/utils.sh 78+source "$UTILSSH" 79+ 80+"${BT_TESTS_BUILDDIR}/cpp-common/test-c-string-view" "$BT_TESTS_BT2_BIN" 81diff --git a/tests/cpp-common/test-unicode-conv.sh b/tests/cpp-common/test-unicode-conv.sh 82new file mode 100755 83index 000000000..df490b2eb 84--- /dev/null 85+++ b/tests/cpp-common/test-unicode-conv.sh 86@@ -0,0 +1,17 @@ 87+#!/bin/bash 88+# 89+# SPDX-License-Identifier: GPL-2.0-only 90+# 91+# Copyright (C) 2025 Bin Lan <bin.lan.cn@windriver.com> 92+# 93+ 94+if [ -n "${BT_TESTS_SRCDIR:-}" ]; then 95+ UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" 96+else 97+ UTILSSH="$(dirname "$0")/../utils/utils.sh" 98+fi 99+ 100+# shellcheck source=../utils/utils.sh 101+source "$UTILSSH" 102+ 103+"${BT_TESTS_BUILDDIR}/cpp-common/test-unicode-conv" "$BT_TESTS_BT2_BIN" 104diff --git a/tests/cpp-common/test-uuid.sh b/tests/cpp-common/test-uuid.sh 105new file mode 100755 106index 000000000..8c65daa94 107--- /dev/null 108+++ b/tests/cpp-common/test-uuid.sh 109@@ -0,0 +1,17 @@ 110+#!/bin/bash 111+# 112+# SPDX-License-Identifier: GPL-2.0-only 113+# 114+# Copyright (C) 2025 Bin Lan <bin.lan.cn@windriver.com> 115+# 116+ 117+if [ -n "${BT_TESTS_SRCDIR:-}" ]; then 118+ UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" 119+else 120+ UTILSSH="$(dirname "$0")/../utils/utils.sh" 121+fi 122+ 123+# shellcheck source=../utils/utils.sh 124+source "$UTILSSH" 125+ 126+"${BT_TESTS_BUILDDIR}/cpp-common/test-uuid" "$BT_TESTS_BT2_BIN" 127-- 1282.34.1 129 130