Skip to content

Commit

Permalink
starting to fill in test_simple
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Jul 22, 2020
1 parent 56ea154 commit 0c15892
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/cunit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
1 change: 1 addition & 0 deletions tests/cunit/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 24 additions & 2 deletions tests/cunit/test_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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);
Expand Down

0 comments on commit 0c15892

Please sign in to comment.