Skip to content

Commit

Permalink
fixed warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Jun 3, 2020
1 parent a4fb42f commit ceff4ea
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tests/cunit/test_async_3proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main(int argc, char **argv)
{
for (int flv = 0; flv < num_flavors; flv++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
int my_comp_idx = 0; /* Index in iosysid array. */

for (int sample = 0; sample < NUM_SAMPLES; sample++)
Expand Down
2 changes: 1 addition & 1 deletion tests/cunit/test_async_4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int main(int argc, char **argv)
{
for (int flv = 0; flv < num_flavors; flv++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
int my_comp_idx = 0; /* Index in iosysid array. */

for (int sample = 0; sample < NUM_SAMPLES; sample++)
Expand Down
2 changes: 1 addition & 1 deletion tests/cunit/test_async_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int main(int argc, char **argv)

for (int sample = 0; sample < NUM_SAMPLES; sample++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];

/* Create a filename. */
Expand Down
14 changes: 7 additions & 7 deletions tests/cunit/test_pioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ int test_names(int iosysid, int num_flavors, int *flavor, int my_rank,
{
int ncid;
int varid;
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];
int dimids[NDIM]; /* The dimension IDs. */
int att_val = ATT_VAL;
Expand Down Expand Up @@ -942,7 +942,7 @@ int test_files(int iosysid, int num_flavors, int *flavor, int my_rank)
* available ways. */
for (int fmt = 0; fmt < num_flavors; fmt++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];

/* Overwrite existing test file. */
Expand Down Expand Up @@ -1041,7 +1041,7 @@ int test_empty_files(int iosysid, int num_flavors, int *flavor, int my_rank)
* available ways. */
for (int fmt = 0; fmt < num_flavors; fmt++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];

/* Create a filename. */
Expand Down Expand Up @@ -1218,7 +1218,7 @@ int test_find_var_fillvalue(int iosysid, int num_flavors, int *flavor,
* available ways. */
for (int fmt = 0; fmt < num_flavors; fmt++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];
int num_types = NUM_CLASSIC_TYPES;

Expand Down Expand Up @@ -1370,7 +1370,7 @@ int test_deletefile(int iosysid, int num_flavors, int *flavor, int my_rank)
* available ways. */
for (int fmt = 0; fmt < num_flavors; fmt++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];
int old_method;

Expand Down Expand Up @@ -1456,7 +1456,7 @@ int test_nc4(int iosysid, int num_flavors, int *flavor, int my_rank)
* available ways. */
for (int fmt = 0; fmt < num_flavors; fmt++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];

/* Create a filename. */
Expand Down Expand Up @@ -1793,7 +1793,7 @@ int test_scalar(int iosysid, int num_flavors, int *flavor, int my_rank, int asyn
* available ways. */
for (int fmt = 0; fmt < num_flavors; fmt++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];

/* Create a filename. */
Expand Down
9 changes: 5 additions & 4 deletions tests/cunit/test_pioc_fill.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ int test_fill(int iosysid, int num_flavors, int *flavor, int my_rank,
* available ways. */
for (int fmt = 0; fmt < num_flavors; fmt++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];
int ncid;
int varid[NUM_NETCDF_TYPES];
Expand All @@ -547,7 +547,8 @@ int test_fill(int iosysid, int num_flavors, int *flavor, int my_rank,
/* Create a filename. */
if ((ret = get_iotype_name(flavor[fmt], iotype_name)))
ERR(ret);
snprintf(filename, PIO_MAX_NAME, "%s_default_fill_%d_%s.nc", TEST_NAME, default_fill, iotype_name);
snprintf(filename, PIO_MAX_NAME * 2, "%s_default_fill_%d_%s.nc", TEST_NAME,
default_fill, iotype_name);

/* Create test file with dims and vars defined. */
if ((ret = create_putget_file(iosysid, flavor[fmt], dim_len, varid, filename,
Expand Down Expand Up @@ -635,7 +636,7 @@ int test_fill_mode(int iosysid, int num_flavors, int *flavor, int my_rank,
{
for (int t = 0; t < NUM_TYPES_TO_TEST; t++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];
int ncid;
int dimid;
Expand All @@ -653,7 +654,7 @@ int test_fill_mode(int iosysid, int num_flavors, int *flavor, int my_rank,
/* Create a filename. */
if ((ret = get_iotype_name(flavor[fmt], iotype_name)))
ERR(ret);
snprintf(filename, PIO_MAX_NAME, "%s_fill_mode_async_%d_default_fill_%d_extra_var_%d_%s.nc",
snprintf(filename, PIO_MAX_NAME * 2, "%s_fill_mode_async_%d_default_fill_%d_extra_var_%d_%s.nc",
TEST_NAME, async, default_fill, extra_var, iotype_name);

/* Create the test file. */
Expand Down
8 changes: 4 additions & 4 deletions tests/cunit/test_pioc_putget.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ int test_atts_byte(int iosysid, int num_flavors, int *flavor, int my_rank,
for (int fmt = 0; fmt < num_flavors; fmt++)
{
char iotype_name[PIO_MAX_NAME + 1];
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
int ncid;
int ret; /* Return code. */

Expand Down Expand Up @@ -433,7 +433,7 @@ int test_atts_int64(int iosysid, int num_flavors, int *flavor, int my_rank,
for (int fmt = 0; fmt < num_flavors; fmt++)
{
char iotype_name[PIO_MAX_NAME + 1];
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
int ncid;
int ret; /* Return code. */

Expand Down Expand Up @@ -1917,7 +1917,7 @@ int test_putget(int iosysid, int num_flavors, int *flavor, int my_rank,
* available ways. */
for (int fmt = 0; fmt < num_flavors; fmt++)
{
char filename[PIO_MAX_NAME + 1]; /* Test filename. */
char filename[PIO_MAX_NAME * 2 + 1]; /* Test filename. */
char iotype_name[PIO_MAX_NAME + 1];
int ncid;
int varid[NUM_NETCDF4_TYPES + 1];
Expand All @@ -1926,7 +1926,7 @@ int test_putget(int iosysid, int num_flavors, int *flavor, int my_rank,
/* Create a filename. */
if ((ret = get_iotype_name(flavor[fmt], iotype_name)))
return ret;
snprintf(filename, PIO_MAX_NAME, "%s_putget_access_%d_unlim_%d_%s.nc", TEST_NAME,
snprintf(filename, PIO_MAX_NAME * 2, "%s_putget_access_%d_unlim_%d_%s.nc", TEST_NAME,
access, unlim, iotype_name);

/* Create test file with dims and vars defined. */
Expand Down

0 comments on commit ceff4ea

Please sign in to comment.