File: git-test-preload-libs

package info (click to toggle)
eztrace 2.0%2Brepack-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,132 kB
  • sloc: ansic: 23,501; perl: 910; sh: 857; cpp: 771; makefile: 696; fortran: 327; f90: 320; python: 57
file content (201 lines) | stat: -rw-r--r-- 8,258 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
commit 813acf3f52af00fa0ccf73bd49ac9e019612db8d
Author: François Trahay <francois.trahay@telecom-sudparis.eu>
Date:   Wed Aug 24 14:36:07 2022 +0200

    fix eztrace paths in test mode

commit 4ffaf3c51abf72a3d7bb959ac72de3bfd4ddd9f1
Author: François Trahay <francois.trahay@telecom-sudparis.eu>
Date:   Wed Aug 24 14:23:25 2022 +0200

    when running tests with make test, we need to pass -p to eztrace so that it uses the libraries located in the build directory instead of the one in the install directory

---
 src/eztrace.c.in                  |   17 ++++++++++++-----
 test/memory/test_memory.sh        |    2 +-
 test/mpi/test_mpi_ping.sh         |    2 +-
 test/ompt/test_lock.sh            |    2 +-
 test/ompt/test_parallel_for.sh    |    2 +-
 test/ompt/test_task.sh            |    2 +-
 test/openmp/test_lock.sh          |    2 +-
 test/openmp/test_nest_lock.sh     |    2 +-
 test/openmp/test_openmp_simple.sh |    2 +-
 test/openmp/test_task.sh          |    2 +-
 test/posixio/test_my_cat.sh       |    2 +-
 test/posixio/test_posixio.sh      |    2 +-
 test/pthread/test_dummy.sh        |    2 +-
 test/unit_tests/CMakeLists.txt    |    1 +
 14 files changed, 25 insertions(+), 17 deletions(-)

--- a/src/eztrace.c.in
+++ b/src/eztrace.c.in
@@ -210,17 +210,24 @@ int main(int argc, char **argv) {
     }
   }
 
-  // libeztrace should always be preloaded!
+  // libeztrace-core and libeztrace-lib should always be preloaded!
   char *files = NULL;
   if (test) {
+    /* If test is enable, it means that eztrace is invoked by "make
+     *  test", and we should use the libraries located in the build
+     *  directory instead of the one in the installed directory.
+    */
+
     fprintf(stderr, "Eztrace test Mode\n");
-    files = strdup(EZTRACE_ABS_TOP_BUILDDIR);
-    files = add_to_str(files, "src/core/.libs/libeztrace.@DYNLIB_EXT@");
+    files = strdup("@CMAKE_BINARY_DIR@");
+    files = add_to_str(files, "/src/core/libeztrace-core.@DYNLIB_EXT@");
+    files = strdup("@CMAKE_BINARY_DIR@");
+    files = add_to_str(files, "/src/eztrace-lib/libeztrace-lib.@DYNLIB_EXT@");
   } else {
     files = strdup(EZTRACE_LIB_DIR);
-    files = add_to_str(files, "/libeztrace-core.@DYNLIB_EXT@"); //libeztrace-core
+    files = add_to_str(files, "/libeztrace-core.@DYNLIB_EXT@");
     files = strdup(EZTRACE_LIB_DIR);
-    files = add_to_str(files, "/libeztrace-lib.@DYNLIB_EXT@"); //libeztrace-core
+    files = add_to_str(files, "/libeztrace-lib.@DYNLIB_EXT@");
   }
   if (pptrace_add_preload(bin, files)) {
     fprintf(stderr, "Unable to add %s to @LD_PRELOAD_NAME@\n", files);
--- a/test/memory/test_memory.sh
+++ b/test/memory/test_memory.sh
@@ -3,7 +3,7 @@ CUR_PATH=$(dirname  $(realpath $0))
 source "$CUR_PATH/../test_utils/test_utils.sh"
 
 name="memory"
-run_and_check_command "$EZTRACE_PATH" -t "memory" "$CUR_PATH/$name"
+run_and_check_command "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "memory" "$CUR_PATH/$name"
 
 trace_filename="${name}_trace/eztrace_log.otf2"
 
--- a/test/mpi/test_mpi_ping.sh
+++ b/test/mpi/test_mpi_ping.sh
@@ -6,7 +6,7 @@ name="mpi_ping"
 np="2"
 
 [ -n "$MPI_MODULE_NAME" ] || MPI_MODULE_NAME=mpi
-run_and_check_command "$MPIRUN_PATH" $MPIRUN_CLI_OPTION -np $np "$EZTRACE_PATH" -t "$MPI_MODULE_NAME $CUR_PATH/$name"
+run_and_check_command "$MPIRUN_PATH" $MPIRUN_CLI_OPTION -np $np "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "$MPI_MODULE_NAME $CUR_PATH/$name"
 
 trace_filename="${name}_trace/eztrace_log.otf2"
 if ! "$OTF2_PRINT_PATH" "$trace_filename" 2>&1 > /dev/null ; then
--- a/test/ompt/test_lock.sh
+++ b/test/ompt/test_lock.sh
@@ -4,7 +4,7 @@ source "$CUR_PATH/../test_utils/test_uti
 
 name="lock"
 
-run_and_check_command "$EZTRACE_PATH" -t "ompt" "$CUR_PATH/test_$name"
+run_and_check_command "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "ompt" "$CUR_PATH/test_$name"
 
 trace_filename="test_${name}_trace/eztrace_log.otf2"
 trace_check_integrity "$trace_filename"
--- a/test/ompt/test_parallel_for.sh
+++ b/test/ompt/test_parallel_for.sh
@@ -4,7 +4,7 @@ source "$CUR_PATH/../test_utils/test_uti
 
 name="parallel_for"
 
-run_and_check_command "$EZTRACE_PATH" -t "ompt" "$CUR_PATH/test_$name"
+run_and_check_command "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "ompt" "$CUR_PATH/test_$name"
 
 trace_filename="test_${name}_trace/eztrace_log.otf2"
 
--- a/test/ompt/test_task.sh
+++ b/test/ompt/test_task.sh
@@ -4,7 +4,7 @@ source "$CUR_PATH/../test_utils/test_uti
 
 name="task"
 
-nb_tasks=$("$EZTRACE_PATH" -t "ompt" "$CUR_PATH/test_$name" 2>&1 | grep "Number of executed tasks" | cut -d' ' -f5)
+nb_tasks=$("$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "ompt" "$CUR_PATH/test_$name" 2>&1 | grep "Number of executed tasks" | cut -d' ' -f5)
 
 trace_filename="test_${name}_trace/eztrace_log.otf2"
 
--- a/test/openmp/test_lock.sh
+++ b/test/openmp/test_lock.sh
@@ -4,7 +4,7 @@ source "$CUR_PATH/../test_utils/test_uti
 
 name="lock"
 
-run_and_check_command "$EZTRACE_PATH" -t "openmp" "$CUR_PATH/test_$name" || ((nb_fail++))
+run_and_check_command "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "openmp" "$CUR_PATH/test_$name" || ((nb_fail++))
 
 trace_filename="test_${name}_trace/eztrace_log.otf2"
 trace_check_integrity "$trace_filename" ||  ((nb_fail++))
--- a/test/openmp/test_nest_lock.sh
+++ b/test/openmp/test_nest_lock.sh
@@ -4,7 +4,7 @@ source "$CUR_PATH/../test_utils/test_uti
 
 name="nest_lock"
 
-run_and_check_command "$EZTRACE_PATH" -t "openmp" "$CUR_PATH/test_$name" || ((nb_fail++))
+run_and_check_command "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "openmp" "$CUR_PATH/test_$name" || ((nb_fail++))
 
 trace_filename="test_${name}_trace/eztrace_log.otf2"
 trace_check_integrity "$trace_filename" || return 1
--- a/test/openmp/test_openmp_simple.sh
+++ b/test/openmp/test_openmp_simple.sh
@@ -5,7 +5,7 @@ source "$CUR_PATH/../test_utils/test_uti
 name="openmp_simple"
 export OMP_NUM_THREADS=4
 
-run_and_check_command "$EZTRACE_PATH" -t "openmp" "$CUR_PATH/$name" || ((nb_fail++))
+run_and_check_command "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "openmp" "$CUR_PATH/$name" || ((nb_fail++))
 
 trace_filename="${name}_trace/eztrace_log.otf2"
 trace_check_integrity "$trace_filename" || exit 1
--- a/test/openmp/test_task.sh
+++ b/test/openmp/test_task.sh
@@ -4,7 +4,7 @@ source "$CUR_PATH/../test_utils/test_uti
 
 name="task"
 
-run_and_check_command "$EZTRACE_PATH" -t "openmp" "$CUR_PATH/test_$name" || ((nb_fail++))
+run_and_check_command "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "openmp" "$CUR_PATH/test_$name" || ((nb_fail++))
 
 trace_filename="test_${name}_trace/eztrace_log.otf2"
 trace_check_integrity "$trace_filename" || exit 1
--- a/test/posixio/test_my_cat.sh
+++ b/test/posixio/test_my_cat.sh
@@ -8,7 +8,7 @@ output_file="output_file.tmp"
 size=1000
 dd if=/dev/random of="$input_file" count=1000 bs=1
 
-run_and_check_command "$EZTRACE_PATH" -t "posixio" "$CUR_PATH/$name" "${input_file}" "$output_file"
+run_and_check_command "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "posixio" "$CUR_PATH/$name" "${input_file}" "$output_file"
 
 trace_filename="${name}_trace/eztrace_log.otf2"
 trace_check_integrity "$trace_filename"
--- a/test/posixio/test_posixio.sh
+++ b/test/posixio/test_posixio.sh
@@ -4,7 +4,7 @@ source "$CUR_PATH/../test_utils/test_uti
 
 name="posixio"
 
-run_and_check_command "$EZTRACE_PATH" -t "posixio" "$CUR_PATH/$name"
+run_and_check_command "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "posixio"  "$CUR_PATH/$name"
 
 trace_filename="${name}_trace/eztrace_log.otf2"
 trace_check_integrity "$trace_filename"
--- a/test/pthread/test_dummy.sh
+++ b/test/pthread/test_dummy.sh
@@ -4,7 +4,7 @@ source "$CUR_PATH/../test_utils/test_uti
 
 name="dummy_thread"
 [ -n "$EZTRACE_PATH" ] || EZTRACE_PATH=eztrace
-run_and_check_command "$EZTRACE_PATH" -t "pthread" "$CUR_PATH/dummy_thread"
+run_and_check_command "$EZTRACE_PATH" $EZTRACE_TEST_OPTION -t "pthread" "$CUR_PATH/dummy_thread"
 
 trace_filename="${name}_trace/eztrace_log.otf2"
 trace_check_integrity "$trace_filename"
--- a/test/unit_tests/CMakeLists.txt
+++ b/test/unit_tests/CMakeLists.txt
@@ -49,4 +49,5 @@ set_property(TEST ${test_list}
   "EZTRACE_CC_PATH=${CMAKE_BINARY_DIR}/modules/omp/bin/eztrace_cc"
   "EZTRACE_PATH=${CMAKE_BINARY_DIR}/src/eztrace"
   "OTF2_PRINT_PATH=${OTF2_PRINT}"
+  "EZTRACE_TEST_OPTION=-p"
 )