mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-04 14:39:54 +00:00
freediameter: fix buildpaths issue
The pass-ptest-env.patch uses ${B}/extensions as the EXTENSIONS_DIR at build
time and pass the env variable EXTENSIONS_DIR as ${libdir}/${fd_pkgname} at
run time to fix the run time error. But there still exists buildpaths issue.
So rework the pass-ptest-env.patch to make sure EXTENSIONS_DIR to be
${libdir}/${fd_pkgname} both in build and run time.
Fixes:
WARNING: freediameter-1.4.0-r0 do_package_qa: QA Issue: File /usr/lib/freeDiameter/ptest/testloadext in package freediameter-ptest contains reference to TMPDIR
File /usr/lib/freeDiameter/ptest/testmesg_stress in package freediameter-ptest contains reference to TMPDIR
File /usr/lib/freeDiameter/ptest/CTestTestfile.cmake in package freediameter-ptest contains reference to TMPDIR [buildpaths]
WARNING: freediameter-1.4.0-r0 do_package_qa: QA Issue: File /usr/src/debug/freediameter/1.4.0-r0/build/libfdcore/fdd.tab.c in package freediameter-src contains reference to TMPDIR
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
+92
@@ -0,0 +1,92 @@
|
||||
From 935fcac46e2790e0e297ca855b8033895c1b8941 Mon Sep 17 00:00:00 2001
|
||||
From: Mingli Yu <mingli.yu@windriver.com>
|
||||
Date: Wed, 24 Aug 2022 13:45:32 +0800
|
||||
Subject: [PATCH] tests: use EXTENSIONS_DIR
|
||||
|
||||
Use EXTENSIONS_DIR to replace BUILD_DIR as the BUILD_DIR is meanlingless
|
||||
on target and also fix buildpaths issue.
|
||||
|
||||
Upstream-Status: Inappropriate [OE ptest specific]
|
||||
|
||||
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
|
||||
---
|
||||
tests/CMakeLists.txt | 1 +
|
||||
tests/testloadext.c | 12 ++++++------
|
||||
tests/testmesg_stress.c | 12 ++++++------
|
||||
3 files changed, 13 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
|
||||
index 8b698ce..2c83cbb 100644
|
||||
--- a/tests/CMakeLists.txt
|
||||
+++ b/tests/CMakeLists.txt
|
||||
@@ -37,6 +37,7 @@ SET(TEST_LIST
|
||||
|
||||
ADD_DEFINITIONS(-DTEST_DEBUG)
|
||||
ADD_DEFINITIONS(-DBUILD_DIR="${CMAKE_BINARY_DIR}")
|
||||
+ADD_DEFINITIONS(-DEXTENSIONS_DIR="${EXTENSIONS_DIR}")
|
||||
|
||||
INCLUDE_DIRECTORIES( "../libfdproto" )
|
||||
INCLUDE_DIRECTORIES( "../libfdcore" )
|
||||
diff --git a/tests/testloadext.c b/tests/testloadext.c
|
||||
index 452737f..3fffef5 100644
|
||||
--- a/tests/testloadext.c
|
||||
+++ b/tests/testloadext.c
|
||||
@@ -35,9 +35,9 @@
|
||||
|
||||
#include "tests.h"
|
||||
|
||||
-#ifndef BUILD_DIR
|
||||
-#error "Missing BUILD_DIR information"
|
||||
-#endif /* BUILD_DIR */
|
||||
+#ifndef EXTENSIONS_DIR
|
||||
+#error "Missing EXTENSIONS_DIR information"
|
||||
+#endif /* EXTENSIONS_DIR */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
@@ -59,9 +59,9 @@ int main(int argc, char *argv[])
|
||||
CHECK( 0, fd_rtdisp_init() );
|
||||
|
||||
/* Find all extensions which have been compiled along the test */
|
||||
- TRACE_DEBUG(INFO, "Loading from: '%s'", BUILD_DIR "/extensions");
|
||||
- CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 );
|
||||
- pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
|
||||
+ TRACE_DEBUG(INFO, "Loading from: '%s'", EXTENSIONS_DIR);
|
||||
+ CHECK( 0, (dir = opendir (EXTENSIONS_DIR)) == NULL ? 1 : 0 );
|
||||
+ pathlen = snprintf(fullname, sizeof(fullname), EXTENSIONS_DIR "/");
|
||||
|
||||
while ((dp = readdir (dir)) != NULL) {
|
||||
char * dot = strrchr(dp->d_name, '.');
|
||||
diff --git a/tests/testmesg_stress.c b/tests/testmesg_stress.c
|
||||
index 310a9d2..97dfe07 100644
|
||||
--- a/tests/testmesg_stress.c
|
||||
+++ b/tests/testmesg_stress.c
|
||||
@@ -38,9 +38,9 @@
|
||||
#include <libgen.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
-#ifndef BUILD_DIR
|
||||
-#error "Missing BUILD_DIR information"
|
||||
-#endif /* BUILD_DIR */
|
||||
+#ifndef EXTENSIONS_DIR
|
||||
+#error "Missing EXTENSIONS_DIR information"
|
||||
+#endif /* EXTENSIONS_DIR */
|
||||
|
||||
|
||||
/* The number of times each operation is repeated to measure the average operation time */
|
||||
@@ -73,9 +73,9 @@ static void load_all_extensions(char * prefix)
|
||||
struct fd_list ext_with_depends = FD_LIST_INITIALIZER(ext_with_depends);
|
||||
|
||||
/* Find all extensions which have been compiled along the test */
|
||||
- LOG_D("Loading %s*.fdx from: '%s'", BUILD_DIR "/extensions", prefix ?: "");
|
||||
- CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 );
|
||||
- pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
|
||||
+ LOG_D("Loading %s*.fdx from: '%s'", EXTENSIONS_DIR, prefix ?: "");
|
||||
+ CHECK( 0, (dir = opendir (EXTENSIONS_DIR)) == NULL ? 1 : 0 );
|
||||
+ pathlen = snprintf(fullname, sizeof(fullname), EXTENSIONS_DIR "/");
|
||||
|
||||
while ((dp = readdir (dir)) != NULL) {
|
||||
char * dot = strrchr(dp->d_name, '.');
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
freediameter ptest cases testmesg_stress.c and testloadext.c need load
|
||||
extensions both build time and runtime. Then they search extensions with
|
||||
build directory that causes runtime failures.
|
||||
|
||||
Pass an environment variable to define runtime extension path.
|
||||
|
||||
Upstream-Status: Inappropriate [OE ptest specific]
|
||||
|
||||
Signed-off-by: Kai Kang <kai.kang@windriver.com>
|
||||
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
|
||||
|
||||
diff -Nur freeDiameter-1.2.0.orig/tests/testloadext.c freeDiameter-1.2.0/tests/testloadext.c
|
||||
--- freeDiameter-1.2.0.orig/tests/testloadext.c 2014-02-19 17:33:24.785405032 +0800
|
||||
+++ freeDiameter-1.2.0/tests/testloadext.c 2014-02-19 20:08:03.871403924 +0800
|
||||
@@ -49,7 +49,7 @@
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *dp;
|
||||
- char fullname[512];
|
||||
+ char fullname[1024];
|
||||
int pathlen;
|
||||
|
||||
/* First, initialize the daemon modules */
|
||||
@@ -57,11 +57,16 @@
|
||||
CHECK( 0, fd_queues_init() );
|
||||
CHECK( 0, fd_msg_init() );
|
||||
CHECK( 0, fd_rtdisp_init() );
|
||||
-
|
||||
+
|
||||
+ char *ext_dir = getenv("EXTENSIONS_DIR");
|
||||
+ if (ext_dir)
|
||||
+ pathlen = snprintf(fullname, sizeof(fullname), "%s", ext_dir);
|
||||
+ else
|
||||
+ pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
|
||||
+
|
||||
/* Find all extensions which have been compiled along the test */
|
||||
- TRACE_DEBUG(INFO, "Loading from: '%s'", BUILD_DIR "/extensions");
|
||||
- CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 );
|
||||
- pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
|
||||
+ TRACE_DEBUG(INFO, "Loading from: '%s'", fullname);
|
||||
+ CHECK( 0, (dir = opendir (fullname)) == NULL ? 1 : 0 );
|
||||
|
||||
while ((dp = readdir (dir)) != NULL) {
|
||||
char * dot = strrchr(dp->d_name, '.');
|
||||
diff -Nur freeDiameter-1.2.0.orig/tests/testmesg_stress.c freeDiameter-1.2.0/tests/testmesg_stress.c
|
||||
--- freeDiameter-1.2.0.orig/tests/testmesg_stress.c 2014-02-19 17:33:24.785405032 +0800
|
||||
+++ freeDiameter-1.2.0/tests/testmesg_stress.c 2014-02-19 20:08:03.928403924 +0800
|
||||
@@ -67,15 +67,20 @@
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *dp;
|
||||
- char fullname[512];
|
||||
+ char fullname[1024];
|
||||
int pathlen;
|
||||
struct fd_list all_extensions = FD_LIST_INITIALIZER(all_extensions);
|
||||
struct fd_list ext_with_depends = FD_LIST_INITIALIZER(ext_with_depends);
|
||||
|
||||
+ char *ext_dir = getenv("EXTENSIONS_DIR");
|
||||
+ if (ext_dir)
|
||||
+ pathlen = snprintf(fullname, sizeof(fullname), "%s", ext_dir);
|
||||
+ else
|
||||
+ pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
|
||||
+
|
||||
/* Find all extensions which have been compiled along the test */
|
||||
- LOG_D("Loading %s*.fdx from: '%s'", BUILD_DIR "/extensions", prefix ?: "");
|
||||
- CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 );
|
||||
- pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
|
||||
+ TRACE_DEBUG(INFO, "Loading from: '%s'", fullname);
|
||||
+ CHECK( 0, (dir = opendir (fullname)) == NULL ? 1 : 0 );
|
||||
|
||||
while ((dp = readdir (dir)) != NULL) {
|
||||
char * dot = strrchr(dp->d_name, '.');
|
||||
@@ -6,6 +6,5 @@ if ! lsmod | grep -q sctp && ! modprobe sctp 2>/dev/null; then
|
||||
echo
|
||||
fi
|
||||
|
||||
export EXTENSIONS_DIR=$EXTENSIONS_DIR
|
||||
cmake -E cmake_echo_color --cyan "Running tests..."
|
||||
ctest --force-new-ctest-process
|
||||
|
||||
@@ -18,7 +18,7 @@ SRC_URI = "\
|
||||
file://Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch \
|
||||
file://freediameter.service \
|
||||
file://freediameter.init \
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://install_test.patch file://run-ptest file://pass-ptest-env.patch', '', d)} \
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://install_test.patch file://run-ptest file://0001-tests-use-EXTENSIONS_DIR.patch', '', d)} \
|
||||
file://freeDiameter.conf \
|
||||
file://0001-libfdcore-sctp.c-update-the-old-sctp-api-check.patch \
|
||||
"
|
||||
@@ -46,6 +46,7 @@ EXTRA_OECMAKE = " \
|
||||
-DBUILD_TEST_RT_ANY:BOOL=ON \
|
||||
-DINSTALL_LIBRARY_SUFFIX:PATH=${baselib} \
|
||||
-DINSTALL_EXTENSIONS_SUFFIX:PATH=${baselib}/${fd_pkgname} \
|
||||
-DEXTENSIONS_DIR:PATH=${libdir}/${fd_pkgname} \
|
||||
-DINSTALL_TEST_SUFFIX:PATH=${PTEST_PATH}-tests \
|
||||
-DCMAKE_SKIP_RPATH:BOOL=ON \
|
||||
"
|
||||
@@ -107,13 +108,15 @@ EOF
|
||||
openssl req -x509 -config ${STAGING_DIR_NATIVE}/etc/ssl/openssl.cnf -newkey rsa:4096 -sha256 -nodes -out ${D}${sysconfdir}/freeDiameter/${FD_PEM} -keyout ${D}${sysconfdir}/freeDiameter/${FD_KEY} -days 3650 -subj '/CN=${FD_HOSTNAME}.${FD_REALM}'
|
||||
openssl dhparam -out ${D}${sysconfdir}/freeDiameter/${FD_DH_PEM} 1024
|
||||
|
||||
find ${B} \( -name "*.c" -o -name "*.h" \) -exec sed -i -e 's#${WORKDIR}##g' {} \;
|
||||
}
|
||||
|
||||
do_install_ptest() {
|
||||
sed -i "s#\(EXTENSIONS_DIR=\).*\$#\1${libdir}/${fd_pkgname}/#" ${D}${PTEST_PATH}/run-ptest
|
||||
mv ${D}${PTEST_PATH}-tests/* ${D}${PTEST_PATH}/
|
||||
rmdir ${D}${PTEST_PATH}-tests
|
||||
install -m 0644 ${B}/tests/CTestTestfile.cmake ${D}${PTEST_PATH}/
|
||||
sed -i -e 's#${WORKDIR}##g' ${D}${PTEST_PATH}/CTestTestfile.cmake
|
||||
sed -i "/^set_tests_properties/d" ${D}${PTEST_PATH}/CTestTestfile.cmake
|
||||
}
|
||||
|
||||
FILES:${PN}-dbg += "${libdir}/${fd_pkgname}/.debug/*"
|
||||
|
||||
Reference in New Issue
Block a user