Skip to content

Commit 8e2fe36

Browse files
Rename test utility prefixes. (#291)
Update common test infrastructure by avoiding the use of a qvi_ prefix. Instead use ctu_ to avoid potential confusion with internal QV APIs. Fixes #284. Signed-off-by: Samuel K. Gutierrez <[email protected]>
1 parent 1b86b6a commit 8e2fe36

17 files changed

+332
-332
lines changed

tests/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*-
22
#
3-
# Copyright (c) 2020-2024 Triad National Security, LLC
3+
# Copyright (c) 2020-2025 Triad National Security, LLC
44
# All rights reserved.
55
#
66
# Copyright (c) 2020-2021 Lawrence Livermore National Security, LLC
@@ -82,7 +82,7 @@ endif()
8282
if(MPI_FOUND)
8383
add_executable(
8484
test-mpi-init
85-
qvi-test-common.h
85+
common-test-utils.h
8686
test-mpi-init.c
8787
)
8888

@@ -144,7 +144,7 @@ if(MPI_FOUND)
144144

145145
add_executable(
146146
test-pthread-split
147-
qvi-test-common.h
147+
common-test-utils.h
148148
test-pthread-split.c
149149
)
150150

tests/qvi-test-common.h tests/common-test-utils.h

+36-36
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2020-2023 Triad National Security, LLC
3+
* Copyright (c) 2020-2025 Triad National Security, LLC
44
* All rights reserved.
55
*
66
* This file is part of the quo-vadis project. See the LICENSE file at the
77
* top-level directory of this distribution.
88
*/
99

1010
/**
11-
* @file qvi-test-common.h
11+
* @file common-test-utils.h
1212
*
1313
* Common test infrastructure.
1414
*/
@@ -28,10 +28,10 @@
2828
#include <sys/syscall.h>
2929
#include <unistd.h>
3030

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)
3333

34-
#define qvi_test_panic(...) \
34+
#define ctu_panic(...) \
3535
do { \
3636
fprintf(stderr, "\n%s@%d: ", __func__, __LINE__); \
3737
fprintf(stderr, __VA_ARGS__); \
@@ -44,49 +44,49 @@ do { \
4444
#ifdef QUO_VADIS
4545

4646
static inline pid_t
47-
qvi_test_gettid(void)
47+
ctu_gettid(void)
4848
{
4949
return (pid_t)syscall(SYS_gettid);
5050
}
5151

5252
static inline void
53-
qvi_test_emit_task_bind(
53+
ctu_emit_task_bind(
5454
qv_scope_t *scope
5555
) {
56-
const int pid = qvi_test_gettid();
56+
const int pid = ctu_gettid();
5757
char const *ers = NULL;
5858
// Get new, current binding.
5959
char *binds = NULL;
6060
int rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &binds);
6161
if (rc != QV_SUCCESS) {
6262
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));
6464
}
6565
printf("[%d] cpubind=%s\n", pid, binds);
6666
free(binds);
6767
}
6868

6969
static inline void
70-
qvi_test_scope_report(
70+
ctu_scope_report(
7171
qv_scope_t *scope,
7272
const char *const scope_name
7373
) {
7474
char const *ers = NULL;
7575

76-
const int pid = qvi_test_gettid();
76+
const int pid = ctu_gettid();
7777

7878
int sgrank;
7979
int rc = qv_scope_group_rank(scope, &sgrank);
8080
if (rc != QV_SUCCESS) {
8181
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));
8383
}
8484

8585
int sgsize;
8686
rc = qv_scope_group_size(scope, &sgsize);
8787
if (rc != QV_SUCCESS) {
8888
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));
9090
}
9191

9292
printf(
@@ -99,48 +99,48 @@ qvi_test_scope_report(
9999
rc = qv_scope_barrier(scope);
100100
if (rc != QV_SUCCESS) {
101101
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));
103103
}
104104
}
105105

106106
/**
107107
* A verbose version of qv_bind_push().
108108
*/
109109
static inline void
110-
qvi_test_bind_push(
110+
ctu_bind_push(
111111
qv_scope_t *scope
112112
) {
113113
char const *ers = NULL;
114-
const int pid = qvi_test_gettid();
114+
const int pid = ctu_gettid();
115115

116116
int sgrank;
117117
int rc = qv_scope_group_rank(scope, &sgrank);
118118
if (rc != QV_SUCCESS) {
119119
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));
121121
}
122122
// Get current binding.
123123
char *bind0s;
124124
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind0s);
125125
if (rc != QV_SUCCESS) {
126126
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));
128128
}
129129
printf("[%d] Current cpubind before qv_bind_push() is %s\n", pid, bind0s);
130130

131131
// Change binding.
132132
rc = qv_scope_bind_push(scope);
133133
if (rc != QV_SUCCESS) {
134134
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));
136136
}
137137

138138
// Get new, current binding.
139139
char *bind1s;
140140
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind1s);
141141
if (rc != QV_SUCCESS) {
142142
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));
144144
}
145145
printf("[%d] New cpubind after qv_bind_push() is %s\n", pid, bind1s);
146146

@@ -152,40 +152,40 @@ qvi_test_bind_push(
152152
* A verbose version of qv_bind_pop().
153153
*/
154154
static inline void
155-
qvi_test_bind_pop(
155+
ctu_bind_pop(
156156
qv_scope_t *scope
157157
) {
158158
char const *ers = NULL;
159159

160-
const int pid = qvi_test_gettid();
160+
const int pid = ctu_gettid();
161161

162162
int sgrank;
163163
int rc = qv_scope_group_rank(scope, &sgrank);
164164
if (rc != QV_SUCCESS) {
165165
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));
167167
}
168168
// Get current binding.
169169
char *bind0s;
170170
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind0s);
171171
if (rc != QV_SUCCESS) {
172172
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));
174174
}
175175
printf("[%d] Current cpubind before qv_bind_pop() is %s\n", pid, bind0s);
176176

177177
// Change binding.
178178
rc = qv_scope_bind_pop(scope);
179179
if (rc != QV_SUCCESS) {
180180
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));
182182
}
183183
// Get new, current binding.
184184
char *bind1s;
185185
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind1s);
186186
if (rc != QV_SUCCESS) {
187187
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));
189189
}
190190
printf("[%d] New cpubind after qv_bind_pop() is %s\n", pid, bind1s);
191191

@@ -198,61 +198,61 @@ qvi_test_bind_pop(
198198
* binding policies.
199199
*/
200200
static inline void
201-
qvi_test_change_bind(
201+
ctu_change_bind(
202202
qv_scope_t *scope
203203
) {
204204
char const *ers = NULL;
205205

206-
const int pid = qvi_test_gettid();
206+
const int pid = ctu_gettid();
207207

208208
int sgrank;
209209
int rc = qv_scope_group_rank(scope, &sgrank);
210210
if (rc != QV_SUCCESS) {
211211
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));
213213
}
214214
// Get current binding.
215215
char *bind0s;
216216
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind0s);
217217
if (rc != QV_SUCCESS) {
218218
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));
220220
}
221221
printf("[%d] Current cpubind is %s\n", pid, bind0s);
222222

223223
// Change binding.
224224
rc = qv_scope_bind_push(scope);
225225
if (rc != QV_SUCCESS) {
226226
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));
228228
}
229229

230230
// Get new, current binding.
231231
char *bind1s;
232232
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind1s);
233233
if (rc != QV_SUCCESS) {
234234
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));
236236
}
237237
printf("[%d] New cpubind is %s\n", pid, bind1s);
238238

239239
rc = qv_scope_bind_pop(scope);
240240
if (rc != QV_SUCCESS) {
241241
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));
243243
}
244244

245245
char *bind2s;
246246
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind2s);
247247
if (rc != QV_SUCCESS) {
248248
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));
250250
}
251251
printf("[%d] Popped cpubind is %s\n", pid, bind2s);
252252

253253
if (strcmp(bind0s, bind2s)) {
254254
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));
256256
}
257257

258258
free(bind0s);
@@ -262,7 +262,7 @@ qvi_test_change_bind(
262262
rc = qv_scope_barrier(scope);
263263
if (rc != QV_SUCCESS) {
264264
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));
266266
}
267267
}
268268

0 commit comments

Comments
 (0)