Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moved tests from tst_h_atts2 into tst_xplatform2, fixed warnings and some memory issues #544

Merged

Conversation

edhartnett
Copy link
Contributor

Fixes #542.
Part of #541.

As discussed yesterday with Ward and Denis, there was a dependancy between these files. tst_h_atts2 needed tst_xplatform2 to run first, because it uses HDF5 to check the output of that test. Instead I have moved that output checking to the end of tst_xplatform2 and removed tst_h_atts2.

Also have fixed warnings in tst_xplatform2.

Also have fixed some memory problems in tst_xplatform2. Some remain (see #541). The line of test code that causes this memory issue is left commented out in this test until I can fix that memory problem.

@@ -209,16 +210,16 @@ check_file_3(int ncid, struct s3 *data_out)
for (i = 0; i < DIM3_LEN; i++)
for (j = 0; j < NUM_VL; j++)
{
if (data_in[i].data[j].len != data_in[i].data[j].len) ERR;
if (data_in[i].data[j].len != data_out[i].data[j].len) ERR;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an important warning fix. We were comparing data_in to data_in, which of course was always equal. We need to compare data_in to data_out to actually test results of read.

/* nc_free_vlen(&(data_in[i].data[j])); */
for (i = 0; i < DIM3_LEN; i++)
for (j = 0; j < NUM_VL; j++)
nc_free_vlen(&(data_in[i].data[j]));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are necessary to free data_in vlens.

/* How does it look? */
if (check_file_3(ncid, comp_array_of_vlen_of_comp_out)) ERR;
/* How does it look? Uncomment this line to see memory issue. */
/* if (check_file_3(ncid, comp_array_of_vlen_of_comp_out)) ERR; */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this line is uncommented, and the code built with address santizer, then a memory problem is revealed.

@WardF WardF merged commit 22d3d15 into Unidata:master Oct 30, 2017
@edhartnett edhartnett deleted the ejh_xplatform2_mem branch November 16, 2017 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tst_h_atts2.c depends on output from tst_xplatform2.c
2 participants