1
1
/* -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*- */
2
2
/*
3
- * Copyright (c) 2020-2023 Triad National Security, LLC
3
+ * Copyright (c) 2020-2025 Triad National Security, LLC
4
4
* All rights reserved.
5
5
*
6
6
* This file is part of the quo-vadis project. See the LICENSE file at the
7
7
* top-level directory of this distribution.
8
8
*/
9
9
10
10
/* *
11
- * @file qvi -test-common .h
11
+ * @file common -test-utils .h
12
12
*
13
13
* Common test infrastructure.
14
14
*/
28
28
#include < sys/syscall.h>
29
29
#include < unistd.h>
30
30
31
- #define QVI_TEST_STRINGIFY (x ) #x
32
- #define QVI_TEST_TOSTRING (x ) QVI_TEST_STRINGIFY (x)
31
+ #define CTU_STRINGIFY (x ) #x
32
+ #define CTU_TOSTRING (x ) CTU_STRINGIFY (x)
33
33
34
- #define qvi_test_panic (...) \
34
+ #define ctu_panic (...) \
35
35
do { \
36
36
fprintf (stderr, " \n %s@%d: " , __func__, __LINE__); \
37
37
fprintf (stderr, __VA_ARGS__); \
@@ -44,49 +44,49 @@ do { \
44
44
#ifdef QUO_VADIS
45
45
46
46
static inline pid_t
47
- qvi_test_gettid (void )
47
+ ctu_gettid (void )
48
48
{
49
49
return (pid_t )syscall (SYS_gettid);
50
50
}
51
51
52
52
static inline void
53
- qvi_test_emit_task_bind (
53
+ ctu_emit_task_bind (
54
54
qv_scope_t *scope
55
55
) {
56
- const int pid = qvi_test_gettid ();
56
+ const int pid = ctu_gettid ();
57
57
char const *ers = NULL ;
58
58
// Get new, current binding.
59
59
char *binds = NULL ;
60
60
int rc = qv_scope_bind_string (scope, QV_BIND_STRING_AS_LIST, &binds);
61
61
if (rc != QV_SUCCESS) {
62
62
ers = " qv_bind_string() failed" ;
63
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
63
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
64
64
}
65
65
printf (" [%d] cpubind=%s\n " , pid, binds);
66
66
free (binds);
67
67
}
68
68
69
69
static inline void
70
- qvi_test_scope_report (
70
+ ctu_scope_report (
71
71
qv_scope_t *scope,
72
72
const char *const scope_name
73
73
) {
74
74
char const *ers = NULL ;
75
75
76
- const int pid = qvi_test_gettid ();
76
+ const int pid = ctu_gettid ();
77
77
78
78
int sgrank;
79
79
int rc = qv_scope_group_rank (scope, &sgrank);
80
80
if (rc != QV_SUCCESS) {
81
81
ers = " qv_scope_group_rank() failed" ;
82
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
82
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
83
83
}
84
84
85
85
int sgsize;
86
86
rc = qv_scope_group_size (scope, &sgsize);
87
87
if (rc != QV_SUCCESS) {
88
88
ers = " qv_scope_group_size() failed" ;
89
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
89
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
90
90
}
91
91
92
92
printf (
@@ -99,48 +99,48 @@ qvi_test_scope_report(
99
99
rc = qv_scope_barrier (scope);
100
100
if (rc != QV_SUCCESS) {
101
101
ers = " qv_scope_barrier() failed" ;
102
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
102
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
103
103
}
104
104
}
105
105
106
106
/* *
107
107
* A verbose version of qv_bind_push().
108
108
*/
109
109
static inline void
110
- qvi_test_bind_push (
110
+ ctu_bind_push (
111
111
qv_scope_t *scope
112
112
) {
113
113
char const *ers = NULL ;
114
- const int pid = qvi_test_gettid ();
114
+ const int pid = ctu_gettid ();
115
115
116
116
int sgrank;
117
117
int rc = qv_scope_group_rank (scope, &sgrank);
118
118
if (rc != QV_SUCCESS) {
119
119
ers = " qv_scope_group_rank() failed" ;
120
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
120
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
121
121
}
122
122
// Get current binding.
123
123
char *bind0s;
124
124
rc = qv_scope_bind_string (scope, QV_BIND_STRING_AS_LIST, &bind0s);
125
125
if (rc != QV_SUCCESS) {
126
126
ers = " qv_bind_string() failed" ;
127
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
127
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
128
128
}
129
129
printf (" [%d] Current cpubind before qv_bind_push() is %s\n " , pid, bind0s);
130
130
131
131
// Change binding.
132
132
rc = qv_scope_bind_push (scope);
133
133
if (rc != QV_SUCCESS) {
134
134
ers = " qv_bind_push() failed" ;
135
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
135
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
136
136
}
137
137
138
138
// Get new, current binding.
139
139
char *bind1s;
140
140
rc = qv_scope_bind_string (scope, QV_BIND_STRING_AS_LIST, &bind1s);
141
141
if (rc != QV_SUCCESS) {
142
142
ers = " qv_bind_string() failed" ;
143
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
143
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
144
144
}
145
145
printf (" [%d] New cpubind after qv_bind_push() is %s\n " , pid, bind1s);
146
146
@@ -152,40 +152,40 @@ qvi_test_bind_push(
152
152
* A verbose version of qv_bind_pop().
153
153
*/
154
154
static inline void
155
- qvi_test_bind_pop (
155
+ ctu_bind_pop (
156
156
qv_scope_t *scope
157
157
) {
158
158
char const *ers = NULL ;
159
159
160
- const int pid = qvi_test_gettid ();
160
+ const int pid = ctu_gettid ();
161
161
162
162
int sgrank;
163
163
int rc = qv_scope_group_rank (scope, &sgrank);
164
164
if (rc != QV_SUCCESS) {
165
165
ers = " qv_scope_group_rank() failed" ;
166
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
166
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
167
167
}
168
168
// Get current binding.
169
169
char *bind0s;
170
170
rc = qv_scope_bind_string (scope, QV_BIND_STRING_AS_LIST, &bind0s);
171
171
if (rc != QV_SUCCESS) {
172
172
ers = " qv_bind_string() failed" ;
173
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
173
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
174
174
}
175
175
printf (" [%d] Current cpubind before qv_bind_pop() is %s\n " , pid, bind0s);
176
176
177
177
// Change binding.
178
178
rc = qv_scope_bind_pop (scope);
179
179
if (rc != QV_SUCCESS) {
180
180
ers = " qv_bind_push() failed" ;
181
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
181
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
182
182
}
183
183
// Get new, current binding.
184
184
char *bind1s;
185
185
rc = qv_scope_bind_string (scope, QV_BIND_STRING_AS_LIST, &bind1s);
186
186
if (rc != QV_SUCCESS) {
187
187
ers = " qv_bind_string() failed" ;
188
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
188
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
189
189
}
190
190
printf (" [%d] New cpubind after qv_bind_pop() is %s\n " , pid, bind1s);
191
191
@@ -198,61 +198,61 @@ qvi_test_bind_pop(
198
198
* binding policies.
199
199
*/
200
200
static inline void
201
- qvi_test_change_bind (
201
+ ctu_change_bind (
202
202
qv_scope_t *scope
203
203
) {
204
204
char const *ers = NULL ;
205
205
206
- const int pid = qvi_test_gettid ();
206
+ const int pid = ctu_gettid ();
207
207
208
208
int sgrank;
209
209
int rc = qv_scope_group_rank (scope, &sgrank);
210
210
if (rc != QV_SUCCESS) {
211
211
ers = " qv_scope_group_rank() failed" ;
212
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
212
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
213
213
}
214
214
// Get current binding.
215
215
char *bind0s;
216
216
rc = qv_scope_bind_string (scope, QV_BIND_STRING_AS_LIST, &bind0s);
217
217
if (rc != QV_SUCCESS) {
218
218
ers = " qv_bind_string() failed" ;
219
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
219
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
220
220
}
221
221
printf (" [%d] Current cpubind is %s\n " , pid, bind0s);
222
222
223
223
// Change binding.
224
224
rc = qv_scope_bind_push (scope);
225
225
if (rc != QV_SUCCESS) {
226
226
ers = " qv_bind_push() failed" ;
227
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
227
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
228
228
}
229
229
230
230
// Get new, current binding.
231
231
char *bind1s;
232
232
rc = qv_scope_bind_string (scope, QV_BIND_STRING_AS_LIST, &bind1s);
233
233
if (rc != QV_SUCCESS) {
234
234
ers = " qv_bind_string() failed" ;
235
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
235
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
236
236
}
237
237
printf (" [%d] New cpubind is %s\n " , pid, bind1s);
238
238
239
239
rc = qv_scope_bind_pop (scope);
240
240
if (rc != QV_SUCCESS) {
241
241
ers = " qv_bind_pop() failed" ;
242
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
242
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
243
243
}
244
244
245
245
char *bind2s;
246
246
rc = qv_scope_bind_string (scope, QV_BIND_STRING_AS_LIST, &bind2s);
247
247
if (rc != QV_SUCCESS) {
248
248
ers = " qv_bind_string() failed" ;
249
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
249
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
250
250
}
251
251
printf (" [%d] Popped cpubind is %s\n " , pid, bind2s);
252
252
253
253
if (strcmp (bind0s, bind2s)) {
254
254
ers = " bind push/pop mismatch" ;
255
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
255
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
256
256
}
257
257
258
258
free (bind0s);
@@ -262,7 +262,7 @@ qvi_test_change_bind(
262
262
rc = qv_scope_barrier (scope);
263
263
if (rc != QV_SUCCESS) {
264
264
ers = " qv_scope_barrier() failed" ;
265
- qvi_test_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
265
+ ctu_panic (" %s (rc=%s)" , ers, qv_strerr (rc));
266
266
}
267
267
}
268
268
0 commit comments