GCC Code Coverage Report


Directory: ./
File: tests/unit/01_pm/omptool_00.c
Date: 2026-12-01 10:07:21
Exec Total Coverage
Lines: 258 272 94.9%
Functions: 32 35 91.4%
Branches: 70 134 52.2%

Line Branch Exec Source
1 /*********************************************************************************/
2 /* Copyright 2009-2024 Barcelona Supercomputing Center */
3 /* */
4 /* This file is part of the DLB library. */
5 /* */
6 /* DLB is free software: you can redistribute it and/or modify */
7 /* it under the terms of the GNU Lesser General Public License as published by */
8 /* the Free Software Foundation, either version 3 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /* DLB is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU Lesser General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU Lesser General Public License */
17 /* along with DLB. If not, see <https://www.gnu.org/licenses/>. */
18 /*********************************************************************************/
19
20 #include "unique_shmem.h"
21
22 #include "LB_numThreads/omp-tools.h"
23 #include "LB_numThreads/omptool.h"
24 #include "apis/dlb_errors.h"
25 #include "support/env.h"
26
27 #include <sched.h>
28 #include <string.h>
29 #include <stdlib.h>
30 #include <assert.h>
31
32
33 ompt_start_tool_result_t* ompt_start_tool(
34 unsigned int omp_version, const char *runtime_version);
35
36 typedef struct event_checkpoints_t {
37 bool init;
38 bool finalize;
39 bool into_mpi;
40 bool outof_mpi;
41 bool lend_from_api;
42 bool thread_begin;
43 bool thread_end;
44 bool thread_role_shift;
45 bool parallel_begin;
46 bool parallel_end;
47 bool into_parallel_function;
48 bool into_parallel_implicit_barrier;
49 bool task_create;
50 bool task_complete;
51 bool task_switch;
52 } event_checkpoints_t;
53
54 static event_checkpoints_t talp_event = {0};
55 static event_checkpoints_t omptm_event = {0};
56 72 static void reset_event_checkpoints(void) {
57 72 talp_event = (const event_checkpoints_t) {0};
58 72 omptm_event = (const event_checkpoints_t) {0};
59 72 }
60
61
62 /*** TALP event functions ***/
63 2 static void talp_event_init(pid_t pid, const options_t* options) {
64 2 talp_event.init = true;
65 2 }
66
67 2 static void talp_event_finalize(void) {
68 2 talp_event.finalize = true;
69 2 }
70
71 2 static void talp_event_into_mpi(void) {
72 2 talp_event.into_mpi = true;
73 2 }
74
75 2 static void talp_event_outof_mpi(void) {
76 2 talp_event.outof_mpi = true;
77 2 }
78
79 ✗ static void talp_event_lend_from_api(void) {
80 ✗ talp_event.lend_from_api = true;
81 }
82
83 2 static void talp_event_thread_begin(ompt_thread_t thread) {
84 2 talp_event.thread_begin = true;
85 2 }
86
87 2 static void talp_event_thread_end(void) {
88 2 talp_event.thread_end = true;
89 2 }
90
91 ✗ static void talp_event_thread_role_shift(ompt_data_t* data, ompt_role_t prior_role,
92 ompt_role_t next_role) {
93 ✗ talp_event.thread_role_shift = true;
94 }
95
96 4 static void talp_event_parallel_begin(omptool_parallel_data_t* data) {
97 4 talp_event.parallel_begin = true;
98 4 }
99
100 4 static void talp_event_parallel_end(omptool_parallel_data_t* data) {
101 4 talp_event.parallel_end = true;
102 4 }
103
104 4 static void talp_event_into_parallel_function(omptool_parallel_data_t* data,
105 unsigned int index) {
106 4 talp_event.into_parallel_function = true;
107 4 }
108
109 6 static void talp_event_into_parallell_implicit_barrier(omptool_parallel_data_t* data) {
110 6 talp_event.into_parallel_implicit_barrier = true;
111 6 }
112
113 2 static void talp_event_task_create(void) {
114 2 talp_event.task_create = true;
115 2 }
116
117 2 static void talp_event_task_complete(void) {
118 2 talp_event.task_complete = true;
119 2 }
120
121 2 static void talp_event_task_switch(void) {
122 2 talp_event.task_switch = true;
123 2 }
124
125 /*** OMPTM event functions ***/
126 2 static void omptm_event_init(pid_t pid, const options_t* options) {
127 2 omptm_event.init = true;
128 2 }
129
130 2 static void omptm_event_finalize(void) {
131 2 omptm_event.finalize = true;
132 2 }
133
134 2 static void omptm_event_into_mpi(void) {
135 2 omptm_event.into_mpi = true;
136 2 }
137
138 2 static void omptm_event_outof_mpi(void) {
139 2 omptm_event.outof_mpi = true;
140 2 }
141
142 2 static void omptm_event_lend_from_api(void) {
143 2 omptm_event.lend_from_api = true;
144 2 }
145
146 2 static void omptm_event_thread_begin(ompt_thread_t thread) {
147 2 omptm_event.thread_begin = true;
148 2 }
149
150 2 static void omptm_event_thread_end(void) {
151 2 omptm_event.thread_end = true;
152 2 }
153
154 ✗ static void omptm_event_thread_role_shift(ompt_data_t* data, ompt_role_t prior_role,
155 ompt_role_t next_role) {
156 ✗ omptm_event.thread_role_shift = true;
157 }
158
159 4 static void omptm_event_parallel_begin(omptool_parallel_data_t* data) {
160 4 omptm_event.parallel_begin = true;
161 4 }
162
163 4 static void omptm_event_parallel_end(omptool_parallel_data_t* data) {
164 4 omptm_event.parallel_end = true;
165 4 }
166
167 4 static void omptm_event_into_parallel_function(omptool_parallel_data_t* data,
168 unsigned int index) {
169 4 omptm_event.into_parallel_function = true;
170 4 }
171
172 6 static void omptm_event_into_parallell_implicit_barrier(omptool_parallel_data_t* data) {
173 6 omptm_event.into_parallel_implicit_barrier = true;
174 6 }
175
176 2 static void omptm_event_task_create(void) {
177 2 omptm_event.task_create = true;
178 2 }
179
180 2 static void omptm_event_task_complete(void) {
181 2 omptm_event.task_complete = true;
182 2 }
183
184 2 static void omptm_event_task_switch(void) {
185 2 omptm_event.task_switch = true;
186 2 }
187
188 /*** Fake OpenMP runtime ***/
189 static omptool_callback_funcs_t callbacks = {0};
190 64 static ompt_set_result_t set_callback(ompt_callbacks_t event, ompt_callback_t callback) {
191 ompt_set_result_t result;
192
8/10
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
64 switch(event) {
193 8 case ompt_callback_thread_begin:
194 8 callbacks.thread_begin = (ompt_callback_thread_begin_t)callback;
195 8 result = ompt_set_always;
196 8 break;
197 8 case ompt_callback_thread_end:
198 8 callbacks.thread_end = (ompt_callback_thread_end_t)callback;
199 8 result = ompt_set_always;
200 8 break;
201 ✗ case ompt_callback_thread_role_shift:
202 ✗ callbacks.thread_role_shift = (ompt_callback_thread_role_shift_t)callback;
203 ✗ result = ompt_set_always;
204 ✗ break;
205 8 case ompt_callback_parallel_begin:
206 8 callbacks.parallel_begin = (ompt_callback_parallel_begin_t)callback;
207 8 result = ompt_set_always;
208 8 break;
209 8 case ompt_callback_parallel_end:
210 8 callbacks.parallel_end = (ompt_callback_parallel_end_t)callback;
211 8 result = ompt_set_always;
212 8 break;
213 8 case ompt_callback_task_create:
214 8 callbacks.task_create = (ompt_callback_task_create_t)callback;
215 8 result = ompt_set_always;
216 8 break;
217 8 case ompt_callback_task_schedule:
218 8 callbacks.task_schedule = (ompt_callback_task_schedule_t)callback;
219 8 result = ompt_set_always;
220 8 break;
221 8 case ompt_callback_implicit_task:
222 8 callbacks.implicit_task = (ompt_callback_implicit_task_t)callback;
223 8 result = ompt_set_always;
224 8 break;
225 8 case ompt_callback_sync_region:
226 8 callbacks.sync_region = (ompt_callback_sync_region_t)callback;
227 8 result = ompt_set_always;
228 8 break;
229 ✗ default:
230 ✗ result = ompt_set_error;
231 ✗ break;
232 }
233 64 return result;
234 }
235
236 4 static void* lookup_fn (const char *interface_function_name) {
237
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (strcmp(interface_function_name, "ompt_set_callback") == 0) {
238 4 return set_callback;
239 }
240 ✗ return NULL;
241 }
242
243 4 static void test_omptool_events(ompt_start_tool_result_t *tool_result,
244 bool talp, bool omptm) {
245 4 ompt_data_t tool_data = {};
246 4 ompt_data_t thread_data = {};
247 4 ompt_data_t parallel_data_l1 = {};
248 4 ompt_data_t parallel_data_l2 = {};
249 4 ompt_data_t task_data = {};
250 4 ompt_data_t new_task_data = {};
251 4 ompt_data_t encountering_task_data = {};
252 4 ompt_frame_t encountering_task_frame = {.exit_frame.ptr = NULL};
253 4 ompt_frame_t nested_encountering_task_frame = {.exit_frame.ptr = (void*)0x42};
254 4 unsigned int requested_parallelism = 1;
255 4 const void *codeptr_ra = (void*)0x42;
256
257 // init
258 4 reset_event_checkpoints();
259 4 tool_result->initialize((ompt_function_lookup_t)lookup_fn, 0, &tool_data);
260
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.init == talp );
261
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.init == omptm );
262
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.thread_begin != NULL );
263
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.thread_end != NULL );
264
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.thread_role_shift == NULL ); /* disabled for omp5 */
265
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.parallel_begin != NULL );
266
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.parallel_end != NULL );
267
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.task_create != NULL );
268
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.task_schedule != NULL );
269
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.implicit_task != NULL );
270
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.sync_region != NULL );
271
272 // thread begin
273 4 reset_event_checkpoints();
274 4 callbacks.thread_begin(ompt_thread_initial, &thread_data);
275
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.thread_begin == talp );
276
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.thread_begin == omptm );
277
278 // thread end
279 4 reset_event_checkpoints();
280 4 callbacks.thread_end(&thread_data);
281
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.thread_end == talp );
282
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.thread_end == omptm );
283
284 // into mpi
285 4 reset_event_checkpoints();
286 4 omptool__into_blocking_call();
287
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.into_mpi == talp );
288
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.into_mpi == omptm );
289
290 // out of mpi
291 4 reset_event_checkpoints();
292 4 omptool__outof_blocking_call();
293
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.outof_mpi == talp );
294
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.outof_mpi == omptm );
295
296 // lend from api
297 4 reset_event_checkpoints();
298 4 omptool__lend_from_api();
299
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.lend_from_api == false ); /* not implemented */
300
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.lend_from_api == omptm );
301
302 // parallel begin
303 4 reset_event_checkpoints();
304 4 callbacks.parallel_begin(&encountering_task_data, &encountering_task_frame,
305 &parallel_data_l1, requested_parallelism, 0, codeptr_ra); /* not a parallel team */
306
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.parallel_begin == false );
307
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.parallel_begin == false );
308 4 callbacks.parallel_begin(&encountering_task_data, &encountering_task_frame,
309 &parallel_data_l1, requested_parallelism, ompt_parallel_team, codeptr_ra);
310
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.parallel_begin == talp );
311
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.parallel_begin == omptm );
312
313 // into parallel
314 4 reset_event_checkpoints();
315 4 callbacks.implicit_task(ompt_scope_begin, &parallel_data_l1, &task_data, 1,
316 0, ompt_task_implicit);
317
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.into_parallel_function == talp );
318
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.into_parallel_function == omptm );
319
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( task_data.value == 1 ); /* nesting level */
320
321 // parallel begin (level 2)
322 4 reset_event_checkpoints();
323 4 callbacks.parallel_begin(&task_data, &nested_encountering_task_frame,
324 &parallel_data_l2, requested_parallelism, ompt_parallel_team, codeptr_ra);
325
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.parallel_begin == talp );
326
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.parallel_begin == omptm );
327
328 // into parallel (level 2)
329 4 reset_event_checkpoints();
330 4 callbacks.implicit_task(ompt_scope_begin, &parallel_data_l2,
331 &new_task_data, 1, 0, ompt_task_implicit);
332
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.into_parallel_function == talp );
333
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.into_parallel_function == omptm );
334
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( new_task_data.value == 2 ); /* nesting level */
335
336 // into parallel implicit barrier (level 2)
337 4 reset_event_checkpoints();
338 4 callbacks.sync_region(ompt_sync_region_barrier_implicit, ompt_scope_begin,
339 &parallel_data_l2, &new_task_data, codeptr_ra);
340
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.into_parallel_implicit_barrier == talp );
341
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.into_parallel_implicit_barrier == omptm );
342
343 // parallel end (level 2)
344 4 reset_event_checkpoints();
345 4 callbacks.parallel_end(&parallel_data_l2, &new_task_data,
346 ompt_parallel_team, codeptr_ra);
347
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.parallel_end == talp );
348
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.parallel_end == omptm );
349
350 // into parallel implicit barrier
351 4 reset_event_checkpoints();
352 4 callbacks.sync_region(ompt_sync_region_barrier_implicit, ompt_scope_begin,
353 &parallel_data_l1, &task_data, codeptr_ra);
354
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.into_parallel_implicit_barrier == talp );
355
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.into_parallel_implicit_barrier == omptm );
356
357 // into parallel implicit barrier (using new enum)
358 4 reset_event_checkpoints();
359 4 callbacks.sync_region(ompt_sync_region_barrier_implicit_parallel, ompt_scope_begin,
360 &parallel_data_l1, &task_data, codeptr_ra);
361
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.into_parallel_implicit_barrier == talp );
362
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.into_parallel_implicit_barrier == omptm );
363
364 // parallel end
365 4 reset_event_checkpoints();
366 4 callbacks.parallel_end(&parallel_data_l1, &encountering_task_data,
367 ompt_parallel_team, codeptr_ra);
368
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.parallel_end == talp );
369
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.parallel_end == omptm );
370
371 // task create
372 4 reset_event_checkpoints();
373 4 callbacks.task_create(&encountering_task_data, &encountering_task_frame,
374 &new_task_data, ompt_task_explicit, 0, codeptr_ra);
375
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.task_create == talp );
376
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.task_create == omptm );
377
378 // task complete
379 4 reset_event_checkpoints();
380 4 callbacks.task_schedule(&task_data, ompt_task_complete, &new_task_data);
381
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.task_complete == talp );
382
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.task_complete == omptm );
383
384 // task switch
385 4 reset_event_checkpoints();
386 4 callbacks.task_schedule(&task_data, ompt_task_switch, &new_task_data);
387
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( talp_event.task_switch == talp );
388
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( omptm_event.task_switch == omptm );
389
390 // finalize
391 4 tool_result->finalize(&tool_data);
392
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.thread_begin == NULL );
393
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.thread_end == NULL );
394
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.thread_role_shift == NULL );
395
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.parallel_begin == NULL );
396
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.parallel_end == NULL );
397
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.task_create == NULL );
398
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.task_schedule == NULL );
399
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.implicit_task == NULL );
400
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert( callbacks.sync_region == NULL );
401 4 }
402
403 1 int main (int argc, char *argv[]) {
404
405 1 omptool_event_funcs_t talp_test_funcs = {
406 .init = talp_event_init,
407 .finalize = talp_event_finalize,
408 .into_mpi = talp_event_into_mpi,
409 .outof_mpi = talp_event_outof_mpi,
410 .lend_from_api = talp_event_lend_from_api,
411 .thread_begin = talp_event_thread_begin,
412 .thread_end = talp_event_thread_end,
413 .thread_role_shift = talp_event_thread_role_shift,
414 .parallel_begin = talp_event_parallel_begin,
415 .parallel_end = talp_event_parallel_end,
416 .into_parallel_function = talp_event_into_parallel_function,
417 .into_parallel_implicit_barrier = talp_event_into_parallell_implicit_barrier,
418 .task_create = talp_event_task_create,
419 .task_complete = talp_event_task_complete,
420 .task_switch = talp_event_task_switch,
421 };
422 1 omptool_event_funcs_t omptm_test_funcs = {
423 .init = omptm_event_init,
424 .finalize = omptm_event_finalize,
425 .into_mpi = omptm_event_into_mpi,
426 .outof_mpi = omptm_event_outof_mpi,
427 .lend_from_api = omptm_event_lend_from_api,
428 .thread_begin = omptm_event_thread_begin,
429 .thread_end = omptm_event_thread_end,
430 .thread_role_shift = omptm_event_thread_role_shift,
431 .parallel_begin = omptm_event_parallel_begin,
432 .parallel_end = omptm_event_parallel_end,
433 .into_parallel_function = omptm_event_into_parallel_function,
434 .into_parallel_implicit_barrier = omptm_event_into_parallell_implicit_barrier,
435 .task_create = omptm_event_task_create,
436 .task_complete = omptm_event_task_complete,
437 .task_switch = omptm_event_task_switch,
438 };
439 1 omptool_testing__setup_event_fn_ptrs(&talp_test_funcs, &omptm_test_funcs);
440
441 /* Options */
442 1 char options[64] = "--ompt --shm-key=";
443 1 strcat(options, SHMEM_KEY);
444
445 /* Modify DLB_ARGS to include options */
446 1 dlb_setenv("DLB_ARGS", options, NULL, ENV_APPEND);
447
448 /* Save initial DLB_ARGS */
449 1 const char *dlb_args_env = getenv("DLB_ARGS");
450 1 size_t len = strlen(dlb_args_env) + 1;
451 1 char *dlb_args = malloc(sizeof(char*)*len);
452 1 strcpy(dlb_args, dlb_args_env);
453
454 /* Obtain OMPT functions */
455 1 ompt_start_tool_result_t *tool_result = ompt_start_tool(1, "Fake OpenMP runtime");
456
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 assert( tool_result );
457
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 assert( tool_result->initialize );
458
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 assert( tool_result->finalize );
459
460 /* Initialize OMPT tool w/o callbacks */
461 1 test_omptool_events(tool_result, /* talp: */ false, /* omptm: */ false);
462
463 /* Initialize OMPT tool with only OMPTM callbacks */
464 1 dlb_setenv("DLB_ARGS", dlb_args, NULL, ENV_OVERWRITE_ALWAYS);
465 1 dlb_setenv("DLB_ARGS", "--lewi", NULL, ENV_APPEND);
466 1 test_omptool_events(tool_result, /* talp: */ false, /* omptm: */ true);
467
468 /* Initialize OMPT tool with only TALP callbacks */
469 1 dlb_setenv("DLB_ARGS", dlb_args, NULL, ENV_OVERWRITE_ALWAYS);
470 1 dlb_setenv("DLB_ARGS", "--talp", NULL, ENV_APPEND);
471 1 test_omptool_events(tool_result, /* talp: */ true, /* omptm: */ false);
472
473 /* Initialize OMPT tool with both callbacks */
474 1 dlb_setenv("DLB_ARGS", dlb_args, NULL, ENV_OVERWRITE_ALWAYS);
475 1 dlb_setenv("DLB_ARGS", "--lewi --talp", NULL, ENV_APPEND);
476 1 test_omptool_events(tool_result, /* talp: */ true, /* omptm: */ true);
477
478 1 return 0;
479 }
480