1freediameter ptest cases testmesg_stress.c and testloadext.c need load 2extensions both build time and runtime. Then they search extensions with 3build directory that causes runtime failures. 4 5Pass an environment variable to define runtime extension path. 6 7Upstream-Status: Inappropriate [OE ptest specific] 8 9Signed-off-by: Kai Kang <kai.kang@windriver.com> 10Signed-off-by: Jackie Huang <jackie.huang@windriver.com> 11 12diff -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, '.'); 45diff -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, '.'); 73