Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 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 | |