Skip to content

Commit 5a5714a

Browse files
New test macros and code cleanup (#261)
* checkpoint * Committing clang-format changes * some tests * Committing clang-format changes * checkpoint * open_obj uses new test macros * Committing clang-format changes * read_obj uses TASSERT * read_obj uses TASSERT * Committing clang-format changes * cont_del and cont_getid use test macros * convert more tests to use macros * convert more tests to macros * Committing clang-format changes * Committing clang-format changes * clang format * use test helper in cont_info and cont_add_del * more tests use macros * Committing clang-format changes * use tests macros in more tests * use PGOTO* macros instead of goto * clang format * more log fixes * logging cleanup and more usage of test macros * Committing clang-format changes * clang format and fix CMakeLists for tests * use tests macros in transfer overlap 2D/3D * use TASSERT in more tests * Committing clang-format changes * use test asserts * all tests on the CI use TASSERT * fix printing and newlines in tests * print time, file name, function name, and line number in debug print --------- Co-authored-by: github-actions <github-actions[bot]@users.noreply.github.com>
1 parent 3549007 commit 5a5714a

File tree

192 files changed

+7008
-13595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+7008
-13595
lines changed

examples/C_plus_plus_example/multidataset_plugin.cc

Lines changed: 170 additions & 136 deletions
Large diffs are not rendered by default.

examples/C_plus_plus_example/region_transfer_1D_append.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727
#include <string.h>
2828
#include "multidataset_plugin.h"
2929

30-
#define DATA_SIZE 128
30+
#define DATA_SIZE 128
3131
#define ARRAY_SIZE 10
3232

3333
int
3434
main(int argc, char **argv)
3535
{
36-
int rank = 0, size = 1;
37-
int ret_value = 0;
38-
int *data;
39-
int i;
40-
char data_name[1024];
36+
int rank = 0, size = 1;
37+
int ret_value = 0;
38+
int *data;
39+
int i;
40+
char data_name[1024];
4141

4242
// create a pdc
4343
#ifdef ENABLE_MPI
@@ -52,21 +52,21 @@ main(int argc, char **argv)
5252

5353
init_multidataset();
5454

55-
data = (int*) malloc(sizeof(int) * DATA_SIZE);
56-
for ( i = 0; i < DATA_SIZE; ++i ) {
55+
data = (int *)malloc(sizeof(int) * DATA_SIZE);
56+
for (i = 0; i < DATA_SIZE; ++i) {
5757
data[i] = i;
5858
}
5959
sprintf(data_name, "data0_%d", rank);
6060

61-
LOG_INFO("rank %d C++ example for writing %d lists of arrays with size %d\n", rank, ARRAY_SIZE, DATA_SIZE);
62-
for ( i = 0; i < ARRAY_SIZE; ++i ) {
61+
LOG_INFO("C++ example for writing %d lists of arrays with size %d\n", rank, ARRAY_SIZE, DATA_SIZE);
62+
for (i = 0; i < ARRAY_SIZE; ++i) {
6363
register_multidataset_request_append(data_name, 0, data, sizeof(int) * DATA_SIZE, H5T_NATIVE_CHAR);
6464
}
6565

6666
sprintf(data_name, "data1_%d", rank);
6767

68-
LOG_INFO("rank %d C++ example for writing %d lists of arrays with size %d\n", rank, ARRAY_SIZE, DATA_SIZE);
69-
for ( i = 0; i < ARRAY_SIZE; ++i ) {
68+
LOG_INFO("C++ example for writing %d lists of arrays with size %d\n", rank, ARRAY_SIZE, DATA_SIZE);
69+
for (i = 0; i < ARRAY_SIZE; ++i) {
7070
register_multidataset_request_append(data_name, 0, data, sizeof(int) * DATA_SIZE, H5T_NATIVE_CHAR);
7171
}
7272
flush_multidatasets();

examples/obj_get_data.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ main(int argc, char **argv)
6363
sprintf(cont_name, "c%d", rank);
6464
cont = PDCcont_create(cont_name, cont_prop);
6565
if (cont > 0) {
66-
LOG_INFO("Rank %d Create a container %s\n", rank, cont_name);
66+
LOG_INFO("Created a container %s\n", cont_name);
6767
}
6868
else {
6969
LOG_ERROR("Failed to create container");
@@ -74,7 +74,7 @@ main(int argc, char **argv)
7474
sprintf(obj_name1, "o1_%d", rank);
7575
obj1 = PDCobj_put_data(obj_name1, (void *)data, 16 * sizeof(double), cont);
7676
if (obj1 > 0) {
77-
LOG_INFO("Rank %d Put data to %s\n", rank, obj_name1);
77+
LOG_INFO("Put data to %s\n", obj_name1);
7878
}
7979
else {
8080
LOG_ERROR("Failed to put data into object");
@@ -85,7 +85,7 @@ main(int argc, char **argv)
8585
sprintf(obj_name2, "o2_%d", rank);
8686
obj2 = PDCobj_put_data(obj_name2, (void *)data, 128 * sizeof(double), cont);
8787
if (obj2 > 0) {
88-
LOG_INFO("Rank %d Put data to %s\n", rank, obj_name2);
88+
LOG_INFO("Put data to %s\n", rank, obj_name2);
8989
}
9090
else {
9191
LOG_ERROR("Failed to put data into object");

examples/region_transfer_2D.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ main(int argc, char **argv)
6868
LOG_INFO("Create a container property\n");
6969
}
7070
else {
71-
LOG_ERROR("Failed to create container property");
71+
LOG_ERROR("Failed to create container property\n");
7272
ret_value = 1;
7373
}
7474
// create a container
@@ -78,7 +78,7 @@ main(int argc, char **argv)
7878
LOG_INFO("Create a container c1\n");
7979
}
8080
else {
81-
LOG_ERROR("Failed to create container");
81+
LOG_ERROR("Failed to create container\n");
8282
ret_value = 1;
8383
}
8484
// create an object property
@@ -87,13 +87,13 @@ main(int argc, char **argv)
8787
LOG_INFO("Create an object property\n");
8888
}
8989
else {
90-
LOG_ERROR("Failed to create object property");
90+
LOG_ERROR("Failed to create object property\n");
9191
ret_value = 1;
9292
}
9393

9494
ret = PDCprop_set_obj_type(obj_prop, PDC_INT);
9595
if (ret != SUCCEED) {
96-
LOG_ERROR("Failed to set obj type");
96+
LOG_ERROR("Failed to set obj type\n");
9797
ret_value = 1;
9898
}
9999
PDCprop_set_obj_dims(obj_prop, 2, dims);
@@ -109,7 +109,7 @@ main(int argc, char **argv)
109109
LOG_INFO("Create an object o1\n");
110110
}
111111
else {
112-
LOG_ERROR("Failed to create object");
112+
LOG_ERROR("Failed to create object\n");
113113
ret_value = 1;
114114
}
115115
// create second object
@@ -119,7 +119,7 @@ main(int argc, char **argv)
119119
LOG_INFO("Create an object o2\n");
120120
}
121121
else {
122-
LOG_ERROR("Failed to create object");
122+
LOG_ERROR("Failed to create object\n");
123123
ret_value = 1;
124124
}
125125

@@ -143,19 +143,19 @@ main(int argc, char **argv)
143143
PDCregion_transfer_close(transfer_request);
144144

145145
if (PDCregion_close(reg) < 0) {
146-
LOG_ERROR("Failed to close local region");
146+
LOG_ERROR("Failed to close local region\n");
147147
ret_value = 1;
148148
}
149149
else {
150-
LOG_INFO("successfully closed local region");
150+
LOG_INFO("successfully closed local region\n");
151151
}
152152

153153
if (PDCregion_close(reg_global) < 0) {
154-
LOG_ERROR("Failed to close global region");
154+
LOG_ERROR("Failed to close global region\n");
155155
ret_value = 1;
156156
}
157157
else {
158-
LOG_INFO("successfully closed global region");
158+
LOG_INFO("successfully closed global region\n");
159159
}
160160

161161
offset[0] = 0;
@@ -183,65 +183,65 @@ main(int argc, char **argv)
183183
}
184184
}
185185
if (PDCregion_close(reg) < 0) {
186-
LOG_ERROR("Failed to close local region");
186+
LOG_ERROR("Failed to close local region\n");
187187
ret_value = 1;
188188
}
189189
else {
190-
LOG_INFO("successfully local region");
190+
LOG_INFO("successfully local region\n");
191191
}
192192

193193
if (PDCregion_close(reg_global) < 0) {
194-
LOG_ERROR("Failed to close global region");
194+
LOG_ERROR("Failed to close global region\n");
195195
ret_value = 1;
196196
}
197197
else {
198-
LOG_INFO("successfully closed global region");
198+
LOG_INFO("successfully closed global region\n");
199199
}
200200

201201
// close object
202202
if (PDCobj_close(obj1) < 0) {
203-
LOG_ERROR("Failed to close object o1");
203+
LOG_ERROR("Failed to close object o1\n");
204204
ret_value = 1;
205205
}
206206
else {
207-
LOG_INFO("Successfully closed object o1");
207+
LOG_INFO("Successfully closed object o1\n");
208208
}
209209
if (PDCobj_close(obj2) < 0) {
210-
LOG_ERROR("Failed to close object o2");
210+
LOG_ERROR("Failed to close object o2\n");
211211
ret_value = 1;
212212
}
213213
else {
214-
LOG_INFO("Successfully closed object o2");
214+
LOG_INFO("Successfully closed object o2\n");
215215
}
216216
// close a container
217217
if (PDCcont_close(cont) < 0) {
218-
LOG_ERROR("Failed to close container c1");
218+
LOG_ERROR("Failed to close container c1\n");
219219
ret_value = 1;
220220
}
221221
else {
222-
LOG_INFO("Successfully closed container c1");
222+
LOG_INFO("Successfully closed container c1\n");
223223
}
224224
// close a object property
225225
if (PDCprop_close(obj_prop) < 0) {
226-
LOG_ERROR("Failed to close property");
226+
LOG_ERROR("Failed to close property\n");
227227
ret_value = 1;
228228
}
229229
else {
230-
LOG_INFO("Successfully closed object property");
230+
LOG_INFO("Successfully closed object property\n");
231231
}
232232
// close a container property
233233
if (PDCprop_close(cont_prop) < 0) {
234-
LOG_ERROR("Failed to close property");
234+
LOG_ERROR("Failed to close property\n");
235235
ret_value = 1;
236236
}
237237
else {
238-
LOG_INFO("Successfully closed container property");
238+
LOG_INFO("Successfully closed container property\n");
239239
}
240240
free(data);
241241
free(data_read);
242242
// close pdc
243243
if (PDCclose(pdc) < 0) {
244-
LOG_ERROR("Failed to close PDC");
244+
LOG_ERROR("Failed to close PDC\n");
245245
ret_value = 1;
246246
}
247247
#ifdef ENABLE_MPI

0 commit comments

Comments
 (0)