diff options
Diffstat (limited to 'meta-networking/recipes-protocols/freediameter/files')
3 files changed, 92 insertions, 73 deletions
diff --git a/meta-networking/recipes-protocols/freediameter/files/0001-tests-use-EXTENSIONS_DIR.patch b/meta-networking/recipes-protocols/freediameter/files/0001-tests-use-EXTENSIONS_DIR.patch new file mode 100644 index 0000000000..4cedc21ce8 --- /dev/null +++ b/meta-networking/recipes-protocols/freediameter/files/0001-tests-use-EXTENSIONS_DIR.patch | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | From 935fcac46e2790e0e297ca855b8033895c1b8941 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Mingli Yu <mingli.yu@windriver.com> | ||
| 3 | Date: Wed, 24 Aug 2022 13:45:32 +0800 | ||
| 4 | Subject: [PATCH] tests: use EXTENSIONS_DIR | ||
| 5 | |||
| 6 | Use EXTENSIONS_DIR to replace BUILD_DIR as the BUILD_DIR is meanlingless | ||
| 7 | on target and also fix buildpaths issue. | ||
| 8 | |||
| 9 | Upstream-Status: Inappropriate [OE ptest specific] | ||
| 10 | |||
| 11 | Signed-off-by: Mingli Yu <mingli.yu@windriver.com> | ||
| 12 | --- | ||
| 13 | tests/CMakeLists.txt | 1 + | ||
| 14 | tests/testloadext.c | 12 ++++++------ | ||
| 15 | tests/testmesg_stress.c | 12 ++++++------ | ||
| 16 | 3 files changed, 13 insertions(+), 12 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt | ||
| 19 | index 8b698ce..2c83cbb 100644 | ||
| 20 | --- a/tests/CMakeLists.txt | ||
| 21 | +++ b/tests/CMakeLists.txt | ||
| 22 | @@ -37,6 +37,7 @@ SET(TEST_LIST | ||
| 23 | |||
| 24 | ADD_DEFINITIONS(-DTEST_DEBUG) | ||
| 25 | ADD_DEFINITIONS(-DBUILD_DIR="${CMAKE_BINARY_DIR}") | ||
| 26 | +ADD_DEFINITIONS(-DEXTENSIONS_DIR="${EXTENSIONS_DIR}") | ||
| 27 | |||
| 28 | INCLUDE_DIRECTORIES( "../libfdproto" ) | ||
| 29 | INCLUDE_DIRECTORIES( "../libfdcore" ) | ||
| 30 | diff --git a/tests/testloadext.c b/tests/testloadext.c | ||
| 31 | index 452737f..3fffef5 100644 | ||
| 32 | --- a/tests/testloadext.c | ||
| 33 | +++ b/tests/testloadext.c | ||
| 34 | @@ -35,9 +35,9 @@ | ||
| 35 | |||
| 36 | #include "tests.h" | ||
| 37 | |||
| 38 | -#ifndef BUILD_DIR | ||
| 39 | -#error "Missing BUILD_DIR information" | ||
| 40 | -#endif /* BUILD_DIR */ | ||
| 41 | +#ifndef EXTENSIONS_DIR | ||
| 42 | +#error "Missing EXTENSIONS_DIR information" | ||
| 43 | +#endif /* EXTENSIONS_DIR */ | ||
| 44 | |||
| 45 | #include <sys/types.h> | ||
| 46 | #include <dirent.h> | ||
| 47 | @@ -59,9 +59,9 @@ int main(int argc, char *argv[]) | ||
| 48 | CHECK( 0, fd_rtdisp_init() ); | ||
| 49 | |||
| 50 | /* Find all extensions which have been compiled along the test */ | ||
| 51 | - TRACE_DEBUG(INFO, "Loading from: '%s'", BUILD_DIR "/extensions"); | ||
| 52 | - CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 ); | ||
| 53 | - pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/"); | ||
| 54 | + TRACE_DEBUG(INFO, "Loading from: '%s'", EXTENSIONS_DIR); | ||
| 55 | + CHECK( 0, (dir = opendir (EXTENSIONS_DIR)) == NULL ? 1 : 0 ); | ||
| 56 | + pathlen = snprintf(fullname, sizeof(fullname), EXTENSIONS_DIR "/"); | ||
| 57 | |||
| 58 | while ((dp = readdir (dir)) != NULL) { | ||
| 59 | char * dot = strrchr(dp->d_name, '.'); | ||
| 60 | diff --git a/tests/testmesg_stress.c b/tests/testmesg_stress.c | ||
| 61 | index 310a9d2..97dfe07 100644 | ||
| 62 | --- a/tests/testmesg_stress.c | ||
| 63 | +++ b/tests/testmesg_stress.c | ||
| 64 | @@ -38,9 +38,9 @@ | ||
| 65 | #include <libgen.h> | ||
| 66 | #include <dlfcn.h> | ||
| 67 | |||
| 68 | -#ifndef BUILD_DIR | ||
| 69 | -#error "Missing BUILD_DIR information" | ||
| 70 | -#endif /* BUILD_DIR */ | ||
| 71 | +#ifndef EXTENSIONS_DIR | ||
| 72 | +#error "Missing EXTENSIONS_DIR information" | ||
| 73 | +#endif /* EXTENSIONS_DIR */ | ||
| 74 | |||
| 75 | |||
| 76 | /* The number of times each operation is repeated to measure the average operation time */ | ||
| 77 | @@ -73,9 +73,9 @@ static void load_all_extensions(char * prefix) | ||
| 78 | struct fd_list ext_with_depends = FD_LIST_INITIALIZER(ext_with_depends); | ||
| 79 | |||
| 80 | /* Find all extensions which have been compiled along the test */ | ||
| 81 | - LOG_D("Loading %s*.fdx from: '%s'", BUILD_DIR "/extensions", prefix ?: ""); | ||
| 82 | - CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 ); | ||
| 83 | - pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/"); | ||
| 84 | + LOG_D("Loading %s*.fdx from: '%s'", EXTENSIONS_DIR, prefix ?: ""); | ||
| 85 | + CHECK( 0, (dir = opendir (EXTENSIONS_DIR)) == NULL ? 1 : 0 ); | ||
| 86 | + pathlen = snprintf(fullname, sizeof(fullname), EXTENSIONS_DIR "/"); | ||
| 87 | |||
| 88 | while ((dp = readdir (dir)) != NULL) { | ||
| 89 | char * dot = strrchr(dp->d_name, '.'); | ||
| 90 | -- | ||
| 91 | 2.25.1 | ||
| 92 | |||
diff --git a/meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch b/meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch deleted file mode 100644 index ea857af7d6..0000000000 --- a/meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch +++ /dev/null | |||
| @@ -1,72 +0,0 @@ | |||
| 1 | freediameter ptest cases testmesg_stress.c and testloadext.c need load | ||
| 2 | extensions both build time and runtime. Then they search extensions with | ||
| 3 | build directory that causes runtime failures. | ||
| 4 | |||
| 5 | Pass an environment variable to define runtime extension path. | ||
| 6 | |||
| 7 | Upstream-Status: Inappropriate [OE ptest specific] | ||
| 8 | |||
| 9 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 10 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
| 11 | |||
| 12 | diff -Nur freeDiameter-1.2.0.orig/tests/testloadext.c freeDiameter-1.2.0/tests/testloadext.c | ||
| 13 | --- freeDiameter-1.2.0.orig/tests/testloadext.c 2014-02-19 17:33:24.785405032 +0800 | ||
| 14 | +++ freeDiameter-1.2.0/tests/testloadext.c 2014-02-19 20:08:03.871403924 +0800 | ||
| 15 | @@ -49,7 +49,7 @@ | ||
| 16 | { | ||
| 17 | DIR *dir; | ||
| 18 | struct dirent *dp; | ||
| 19 | - char fullname[512]; | ||
| 20 | + char fullname[1024]; | ||
| 21 | int pathlen; | ||
| 22 | |||
| 23 | /* First, initialize the daemon modules */ | ||
| 24 | @@ -57,11 +57,16 @@ | ||
| 25 | CHECK( 0, fd_queues_init() ); | ||
| 26 | CHECK( 0, fd_msg_init() ); | ||
| 27 | CHECK( 0, fd_rtdisp_init() ); | ||
| 28 | - | ||
| 29 | + | ||
| 30 | + char *ext_dir = getenv("EXTENSIONS_DIR"); | ||
| 31 | + if (ext_dir) | ||
| 32 | + pathlen = snprintf(fullname, sizeof(fullname), "%s", ext_dir); | ||
| 33 | + else | ||
| 34 | + pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/"); | ||
| 35 | + | ||
| 36 | /* Find all extensions which have been compiled along the test */ | ||
| 37 | - TRACE_DEBUG(INFO, "Loading from: '%s'", BUILD_DIR "/extensions"); | ||
| 38 | - CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 ); | ||
| 39 | - pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/"); | ||
| 40 | + TRACE_DEBUG(INFO, "Loading from: '%s'", fullname); | ||
| 41 | + CHECK( 0, (dir = opendir (fullname)) == NULL ? 1 : 0 ); | ||
| 42 | |||
| 43 | while ((dp = readdir (dir)) != NULL) { | ||
| 44 | char * dot = strrchr(dp->d_name, '.'); | ||
| 45 | diff -Nur freeDiameter-1.2.0.orig/tests/testmesg_stress.c freeDiameter-1.2.0/tests/testmesg_stress.c | ||
| 46 | --- freeDiameter-1.2.0.orig/tests/testmesg_stress.c 2014-02-19 17:33:24.785405032 +0800 | ||
| 47 | +++ freeDiameter-1.2.0/tests/testmesg_stress.c 2014-02-19 20:08:03.928403924 +0800 | ||
| 48 | @@ -67,15 +67,20 @@ | ||
| 49 | { | ||
| 50 | DIR *dir; | ||
| 51 | struct dirent *dp; | ||
| 52 | - char fullname[512]; | ||
| 53 | + char fullname[1024]; | ||
| 54 | int pathlen; | ||
| 55 | struct fd_list all_extensions = FD_LIST_INITIALIZER(all_extensions); | ||
| 56 | struct fd_list ext_with_depends = FD_LIST_INITIALIZER(ext_with_depends); | ||
| 57 | |||
| 58 | + char *ext_dir = getenv("EXTENSIONS_DIR"); | ||
| 59 | + if (ext_dir) | ||
| 60 | + pathlen = snprintf(fullname, sizeof(fullname), "%s", ext_dir); | ||
| 61 | + else | ||
| 62 | + pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/"); | ||
| 63 | + | ||
| 64 | /* Find all extensions which have been compiled along the test */ | ||
| 65 | - LOG_D("Loading %s*.fdx from: '%s'", BUILD_DIR "/extensions", prefix ?: ""); | ||
| 66 | - CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 ); | ||
| 67 | - pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/"); | ||
| 68 | + TRACE_DEBUG(INFO, "Loading from: '%s'", fullname); | ||
| 69 | + CHECK( 0, (dir = opendir (fullname)) == NULL ? 1 : 0 ); | ||
| 70 | |||
| 71 | while ((dp = readdir (dir)) != NULL) { | ||
| 72 | char * dot = strrchr(dp->d_name, '.'); | ||
diff --git a/meta-networking/recipes-protocols/freediameter/files/run-ptest b/meta-networking/recipes-protocols/freediameter/files/run-ptest index d0ca8d9621..3c841644b7 100644 --- a/meta-networking/recipes-protocols/freediameter/files/run-ptest +++ b/meta-networking/recipes-protocols/freediameter/files/run-ptest | |||
| @@ -6,6 +6,5 @@ if ! lsmod | grep -q sctp && ! modprobe sctp 2>/dev/null; then | |||
| 6 | echo | 6 | echo |
| 7 | fi | 7 | fi |
| 8 | 8 | ||
| 9 | export EXTENSIONS_DIR=$EXTENSIONS_DIR | ||
| 10 | cmake -E cmake_echo_color --cyan "Running tests..." | 9 | cmake -E cmake_echo_color --cyan "Running tests..." |
| 11 | ctest --force-new-ctest-process | 10 | ctest --force-new-ctest-process |
