From 0c1589224727bffb58c1507d57c9b4c059ce5d40 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 22 Jul 2020 07:57:41 -0600 Subject: [PATCH] starting to fill in test_simple --- tests/cunit/CMakeLists.txt | 2 +- tests/cunit/Makefile.am | 1 + tests/cunit/test_simple.c | 26 ++++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/tests/cunit/CMakeLists.txt b/tests/cunit/CMakeLists.txt index 4502ecd7398..b3611b8b7eb 100644 --- a/tests/cunit/CMakeLists.txt +++ b/tests/cunit/CMakeLists.txt @@ -111,7 +111,7 @@ if (NOT PIO_USE_MPISERIAL) target_link_libraries (test_async_manyproc pioc) add_executable (test_async_1d EXCLUDE_FROM_ALL test_async_1d.c) target_link_libraries (test_async_1d pioc) - add_executable (test_simple EXCLUDE_FROM_ALL test_simple.c) + add_executable (test_simple EXCLUDE_FROM_ALL test_simple.c test_common.c) target_link_libraries (test_simple pioc) endif () endif () diff --git a/tests/cunit/Makefile.am b/tests/cunit/Makefile.am index c1ca26cf407..ecb7024e117 100644 --- a/tests/cunit/Makefile.am +++ b/tests/cunit/Makefile.am @@ -65,6 +65,7 @@ test_perf2_SOURCES = test_perf2.c test_common.c pio_tests.h test_async_perf_SOURCES = test_async_perf.c test_common.c pio_tests.h test_darray_vard_SOURCES = test_darray_vard.c test_common.c pio_tests.h test_async_1d_SOURCES = test_async_1d.c pio_tests.h +test_simple_SOURCES = test_simple.c test_common.c pio_tests.h # Distribute the test script. EXTRA_DIST = run_tests.sh CMakeLists.txt test_darray_frame.c diff --git a/tests/cunit/test_simple.c b/tests/cunit/test_simple.c index ea332ef936e..f3f04437e80 100644 --- a/tests/cunit/test_simple.c +++ b/tests/cunit/test_simple.c @@ -16,8 +16,10 @@ int main(int argc, char **argv) int ntasks; /* Number of processors involved in current execution. */ int num_iotasks = 1; int iosysid; /* The ID for the parallel I/O system. */ - /* int num_flavors; /\* Number of PIO netCDF flavors in this build. *\/ */ - /* int flavor[NUM_FLAVORS]; /\* iotypes for the supported netCDF IO flavors. *\/ */ + int ncid; + int num_flavors; /* Number of PIO netCDF flavors in this build. */ + int flavor[NUM_FLAVORS]; /* iotypes for the supported netCDF IO flavors. */ + int f; int ret; /* Return code. */ /* Initialize MPI. */ @@ -41,6 +43,26 @@ int main(int argc, char **argv) &iosysid))) ERR(ret); + /* Find out which IOtypes are available in this build by calling + * this function from test_common.c. */ + if ((ret = get_iotypes(&num_flavors, flavor))) + ERR(ret); + + /* Create a file with each available IOType. */ + for (f = 0; f < num_flavors; f++) + { + char filename[NC_MAX_NAME + 1]; + + sprintf(filename, "%s_%d.nc", TEST_NAME, flavor[f]); + /* Create a file. */ + if ((ret = PIOc_createfile(iosysid, &ncid, &flavor[f], filename, NC_CLOBBER))) + ERR(ret); + + /* Close the file. */ + if ((ret = PIOc_closefile(ncid))) + ERR(ret); + } /* next IOType */ + /* Finalize the IOsystem. */ if ((ret = PIOc_finalize(iosysid))) ERR(ret);