diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-09-16 22:27:49 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-09-16 22:27:49 (GMT) |
commit | ee7612be44b3797a903e21433558a52331515ce1 (patch) | |
tree | cce28a3a6e169f1668ad1a0356e907f0dddbfde6 /test | |
parent | 222e7186ea78e49b387284cbb9997677c933c368 (diff) | |
download | hdf5-ee7612be44b3797a903e21433558a52331515ce1.zip hdf5-ee7612be44b3797a903e21433558a52331515ce1.tar.gz hdf5-ee7612be44b3797a903e21433558a52331515ce1.tar.bz2 |
[svn-r27811] Description:
Refactor property list code to "deep copy" properties in the correct way,
retraining the rest of the library to copy & release things correctly. This
cleans up another batch of memory leaks, etc. within the library.
Tested on:
MacOSX/64 10.10.5 (amazon) w/serial & parallel
Linux/32 2.6.x (jam) w/serial & parallel
(h5committest forthcoming)
Diffstat (limited to 'test')
-rw-r--r-- | test/links.c | 14 | ||||
-rw-r--r-- | test/objcopy.c | 4 | ||||
-rw-r--r-- | test/testframe.c | 23 | ||||
-rw-r--r-- | test/tfile.c | 8 | ||||
-rw-r--r-- | test/tgenprop.c | 29 |
5 files changed, 35 insertions, 43 deletions
diff --git a/test/links.c b/test/links.c index ce3b658..887a72c 100644 --- a/test/links.c +++ b/test/links.c @@ -3883,11 +3883,8 @@ external_set_elink_fapl3(hbool_t new_format) if(H5Pget(lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR if(H5Pclose(lapl_id) < 0) TEST_ERROR - /* Try closing out_fapl should fail since H5Pclose(lapl_id) should also close its fapl */ - H5E_BEGIN_TRY { - ret = H5Pclose(out_fapl); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR + /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ + if(H5Pclose(out_fapl) < 0) TEST_ERROR /* Verify that the driver for the copied link's fapl is the "core" driver */ if((l_fapl = H5Pget_elink_fapl(new_lapl_id)) < 0) TEST_ERROR @@ -3897,11 +3894,8 @@ external_set_elink_fapl3(hbool_t new_format) if(H5Pget(new_lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR if(H5Premove(new_lapl_id, "external link fapl") < 0) TEST_ERROR - /* Try closing out_fapl should fail since the property is removed from new_lapl_id */ - H5E_BEGIN_TRY { - ret = H5Pclose(out_fapl); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR + /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ + if(H5Pclose(out_fapl) < 0) TEST_ERROR if(H5Pclose(l_fapl) < 0) TEST_ERROR if(H5Pclose(new_lapl_id) < 0) TEST_ERROR diff --git a/test/objcopy.c b/test/objcopy.c index 6607f4e..ecc3ba5 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1247,10 +1247,6 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf) } /* Remove external file information from the dcpls */ - /* Remove default property causes memory leak - if(H5Premove(dcpl, H5D_CRT_EXT_FILE_LIST_NAME) < 0) TEST_ERROR - if(H5Premove(dcpl2, H5D_CRT_EXT_FILE_LIST_NAME) < 0) TEST_ERROR - */ /* reset external file information from the dcpls */ if (H5P_reset_external_file_test(dcpl) < 0) TEST_ERROR diff --git a/test/testframe.c b/test/testframe.c index 2dd181b..daa27c5 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -213,6 +213,7 @@ void TestInfo(const char *ProgName) */ void TestParseCmdLine(int argc, char *argv[]) { + hbool_t skipped_all = FALSE; int ret_code; while (argv++, --argc > 0){ @@ -248,14 +249,20 @@ void TestParseCmdLine(int argc, char *argv[]) } else if (((HDstrcmp(*argv, "-only") == 0) || (HDstrcmp(*argv, "-o") == 0))) { - if (argc > 0){ + if(argc > 0) { int Loop; + --argc; ++argv; + /* Skip all tests, then activate only one. */ - for (Loop = 0; Loop < Index; Loop++) - Test[Loop].SkipFlag = 1; + if(!skipped_all) { + for(Loop = 0; Loop < Index; Loop++) + Test[Loop].SkipFlag = 1; + skipped_all = TRUE; + } /* end if */ SetTest(*argv, ONLYTEST); - }else{ + } /* end if */ + else { TestUsage(); exit(EXIT_FAILURE); } @@ -548,6 +555,7 @@ TestErrPrintf(const char *format, ...) void SetTest(const char *testname, int action) { int Loop; + switch (action){ case SKIPTEST: for (Loop = 0; Loop < Index; Loop++) @@ -569,17 +577,12 @@ void SetTest(const char *testname, int action) break; case ONLYTEST: for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) != 0) - Test[Loop].SkipFlag = 1; - else { + if (HDstrcmp(testname, Test[Loop].Name) == 0) { /* Found it. Set it to run. Break to skip the rest. */ Test[Loop].SkipFlag = 0; break; } } - /* skip the rest */ - while (++Loop < Index) - Test[Loop].SkipFlag = 1; break; default: /* error */ diff --git a/test/tfile.c b/test/tfile.c index 8c4adb4..5fc528e 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -2796,6 +2796,10 @@ test_free_sections(hid_t fapl, char *fname) file = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); + /* Close the FCPL */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); + /* Create dataspace for datasets */ dspace = H5Screate(H5S_SCALAR); CHECK(dspace, FAIL, "H5Screate"); @@ -2920,9 +2924,6 @@ test_free_sections(hid_t fapl, char *fname) ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - ret = H5Pclose(fcpl); - CHECK(fcpl, FAIL, "H5Pclose"); - HDfree(saved_sect_info); } /* end test_free_sections() */ @@ -3000,6 +3001,7 @@ test_filespace_sects(void) /* close fapl and remove the file */ h5_clean_files(FILENAME, fapl_stdio); + /* CORE */ MESSAGE(5, ("Testing File free space information for a core file\n")); diff --git a/test/tgenprop.c b/test/tgenprop.c index f35505f..c4f3a3f 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -784,7 +784,7 @@ test_genprop_basic_list_prop(void) ret = H5Pget(lid1, PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) + if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE)) printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); @@ -1203,9 +1203,9 @@ test_genprop_list_callback(void) lid1 = H5Pcreate(cid1); CHECK_I(lid1, "H5Pcreate"); - /* The compare callback should have been called once on property 1 (to check - * if the create callback modified the value) */ - VERIFY(prop1_cb_info.cmp_count, 1, "H5Pcreate"); + /* The compare callback should not have been called once on property 1, as + * the property is always copied */ + VERIFY(prop1_cb_info.cmp_count, 0, "H5Pcreate"); /* The compare callback should not have been called on property 3, as there * is no create callback */ VERIFY(prop3_cb_info.cmp_count, 0, "H5Pcreate"); @@ -1221,9 +1221,8 @@ test_genprop_list_callback(void) ret = H5Pget(lid1, PROP1_NAME,&prop1_value); CHECK_I(ret, "H5Pget"); VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget"); - /* The compare callback should have been called once (to check if the get - * callback modified the value) */ - VERIFY(prop1_cb_info.cmp_count, 2, "H5Pget"); + /* The compare callback should not have been called */ + VERIFY(prop1_cb_info.cmp_count, 0, "H5Pget"); ret = H5Pget(lid1, PROP2_NAME,&prop2_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ @@ -1242,7 +1241,7 @@ test_genprop_list_callback(void) ret = H5Pget(lid1, PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) + if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE)) printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); @@ -1266,17 +1265,15 @@ test_genprop_list_callback(void) if(HDmemcmp(prop1_cb_info.set_value,&prop1_new_value, PROP1_SIZE)!=0) TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); - /* The compare callback should have been called once (to check if the new - * value needed to be copied onto the property list) */ - VERIFY(prop1_cb_info.cmp_count, 3, "H5Pset"); + /* The compare callback should not have been called */ + VERIFY(prop1_cb_info.cmp_count, 0, "H5Pset"); /* Set value of property #3 to different value */ ret = H5Pset(lid1, PROP3_NAME,prop3_new_value); CHECK_I(ret, "H5Pset"); - /* The compare callback should have been called once (to check if the new - * value needed to be copied onto the property list) */ - VERIFY(prop3_cb_info.cmp_count, 1, "H5Pset"); + /* The compare callback should not have been called */ + VERIFY(prop3_cb_info.cmp_count, 0, "H5Pset"); /* Check new value of tracked properties */ ret = H5Pget(lid1, PROP1_NAME,&prop1_value); @@ -1323,8 +1320,8 @@ test_genprop_list_callback(void) VERIFY(ret, 1, "H5Pequal"); /* Verify compare callback information for properties tracked */ - VERIFY(prop1_cb_info.cmp_count, 4, "H5Pequal"); - VERIFY(prop3_cb_info.cmp_count, 2, "H5Pequal"); + VERIFY(prop1_cb_info.cmp_count, 1, "H5Pequal"); + VERIFY(prop3_cb_info.cmp_count, 1, "H5Pequal"); /* Close first list */ ret = H5Pclose(lid1); |