| 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, '.'); |