Skip to contentSkip to conversation

oprofile: Fix file_manip_tests ptest

PATCH New Khem Raj 1 participant 1 message May 8, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 oprofile: Fix file_manip_tests ptest

Remove assumptions around absolute paths which used __FILE__ macro

---
 ...-replace-__FILE__-with-__FILE_NAME__.patch | 47 +++++++++++++++++++
 .../recipes-kernel/oprofile/oprofile_1.4.0.bb |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 meta-oe/recipes-kernel/oprofile/oprofile/0011-replace-__FILE__-with-__FILE_NAME__.patch
meta-oe/recipes-kernel/oprofile/oprofile/0011-replace-__FILE__-with-__FILE_NAME__.patch new file +47 -0
new file mode 100644
index 0000000000..902032969e
@@ -0,0 +1,47 @@
+From 640b116618b89eeddd61a91b793bb3c879adfe57 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 7 May 2024 19:56:59 -0700
+Subject: [PATCH] replace __FILE__ with __FILE_NAME__
+
+This helps build paths not beeing assumed during runtime
+since in cross-builds its possible that absolute paths during
+build will not match runtime paths
+
+Upstream-Status: Inappropriate [OE-Specific]
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ libutil++/tests/file_manip_tests.cpp | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/libutil++/tests/file_manip_tests.cpp b/libutil++/tests/file_manip_tests.cpp
+index dfe161b..3d960bc 100644
+--- a/libutil++/tests/file_manip_tests.cpp
++++ b/libutil++/tests/file_manip_tests.cpp
+@@ -138,9 +138,9 @@ static void is_directory_tests()
+ static input_output<pair<string, string>, bool>
+ expect_is_files_identical[] = {
+ #define MAKE_PAIR(a, b) make_pair(string(a), string(b))
+-	{ MAKE_PAIR(__FILE__, __FILE__), true },
+-	{ MAKE_PAIR(__FILE__, "not_existing"), false },
+-	{ MAKE_PAIR("not_exisiting", __FILE__), false },
++	{ MAKE_PAIR(__FILE_NAME__, __FILE_NAME__), true },
++	{ MAKE_PAIR(__FILE_NAME__, "not_existing"), false },
++	{ MAKE_PAIR("not_exisiting", __FILE_NAME__), false },
+ 	{ MAKE_PAIR("not_exisiting", "not_existing"), false },
+ 	{ MAKE_PAIR("", ""), false }
+ #undef MAKE_PAIR
+@@ -163,8 +163,8 @@ void is_files_identical_tests(char const * prog_name)
+ 
+ static input_output<char const *, bool> expect_op_file_readable[] =
+ {
+-	{ __FILE__, true },
+-	{ "./" __FILE__, true },
++	{ __FILE_NAME__, true },
++	{ "./" __FILE_NAME__, true },
+ 	{ ".", false },
+ 	{ "/.", false },
+ 	{ "./", false },
+-- 
+2.45.0
+
meta-oe/recipes-kernel/oprofile/oprofile_1.4.0.bb +1 -0
index 092d22746a..c4c89e5750 100644
@@ -30,6 +30,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
            file://0008-include-linux-limits.h-for-MAX_INPUT.patch \
            file://0009-Prevent-running-check-tests-on-host-if-cross-compili.patch \
            file://0010-oprofile-Determine-the-root-home-directory-dynamical.patch \
+           file://0011-replace-__FILE__-with-__FILE_NAME__.patch \
            file://0001-configure-Include-unistd.h-for-getpid-API.patch \
            file://0001-Replace-std-bind2nd-with-generic-lambda.patch \
 "
Signature · 1 line
2.45.0