summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-09-14 03:58:59 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-09-14 03:58:59 (GMT)
commit102337449220dfc29be1cce29147704b9c760832 (patch)
tree2f57d117f2bd934eac2768be18dcc866619f390f /test
parentf16361d5f1dc70c344d8143270aa4aeaa867f244 (diff)
downloadhdf5-102337449220dfc29be1cce29147704b9c760832.zip
hdf5-102337449220dfc29be1cce29147704b9c760832.tar.gz
hdf5-102337449220dfc29be1cce29147704b9c760832.tar.bz2
[svn-r27768] Description:
Complete revamp of package initialization/shutdown mechanism in the library. Each package now has a single init/term routine. This new way should avoid packages being re-initialized during library shutdown and is also be _much_ more proactive about giving feedback for resource leaks internal to the library. Introduces a new "module" header file for packages in the library (e.g src/H5Fmodule.h) which sets up some necessary package configuration macros for the FUNC_ENTER/LEAVE macros. (The VFL drivers have their own slightly modified version of this header, src/H5FDdrvr_module.h) Also cleaned up a bunch of resources leaks all across the library and tests, along with addressing many warnings, as I encountered them. Tested on: MacOSX/64 10.10.5 (amazon) w/serial & parallel Linux/64 3.10.x (kituo) w/serial & parallel Linux/64 2.6.x (ostrich) w/serial
Diffstat (limited to 'test')
-rw-r--r--test/accum.c2
-rw-r--r--test/app_ref.c4
-rw-r--r--test/big.c6
-rw-r--r--test/bittests.c2
-rw-r--r--test/btree2.c2
-rw-r--r--test/cache_common.h4
-rw-r--r--test/cache_tagging.c10
-rw-r--r--test/cmpd_dset.c2
-rw-r--r--test/dsets.c2
-rw-r--r--test/dt_arith.c68
-rw-r--r--test/dtypes.c93
-rw-r--r--test/earray.c2
-rw-r--r--test/efc.c4
-rw-r--r--test/err_compat.c3
-rw-r--r--test/error_test.c2
-rw-r--r--test/farray.c2
-rw-r--r--test/fheap.c2
-rw-r--r--test/file_image.c24
-rw-r--r--test/flush2.c32
-rw-r--r--test/freespace.c6
-rw-r--r--test/getname.c4
-rw-r--r--test/h5test.c84
-rw-r--r--test/h5test.h2
-rw-r--r--test/istore.c2
-rw-r--r--test/links.c2
-rw-r--r--test/links_env.c2
-rw-r--r--test/mf.c32
-rw-r--r--test/objcopy.c4
-rw-r--r--test/ohdr.c4
-rw-r--r--test/plugin.c2
-rw-r--r--test/pool.c2
-rw-r--r--test/stab.c2
-rw-r--r--test/tattr.c6
-rw-r--r--test/tfile.c14
-rw-r--r--test/tgenprop.c2
-rw-r--r--test/tid.c2
-rw-r--r--test/tmisc.c2
-rw-r--r--test/tselect.c2
-rw-r--r--test/tsohm.c6
-rw-r--r--test/unlink.c2
-rw-r--r--test/vfd.c380
41 files changed, 537 insertions, 293 deletions
diff --git a/test/accum.c b/test/accum.c
index a924517..268b7e1 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -17,7 +17,7 @@
*/
#include "h5test.h"
-#define H5F_PACKAGE
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "H5Fpkg.h"
#include "H5FDprivate.h"
#include "H5Iprivate.h"
diff --git a/test/app_ref.c b/test/app_ref.c
index 3052df7..4b72bcb 100644
--- a/test/app_ref.c
+++ b/test/app_ref.c
@@ -185,6 +185,10 @@ main (void)
PASSED();
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
+ /* Clean up any file(s) created */
h5_reset();
fapl = H5Pcreate (H5P_FILE_ACCESS);
h5_cleanup (FILENAME, fapl);
diff --git a/test/big.c b/test/big.c
index db03c99..53b4337 100644
--- a/test/big.c
+++ b/test/big.c
@@ -618,7 +618,7 @@ test_sec2(hid_t fapl)
quit:
/* End with normal return code */
/* Clean up the test file */
- if(h5_cleanup(FILENAME, fapl))
+ if(h5_clean_files(FILENAME, fapl))
HDremove(DNAME);
return 0;
@@ -655,7 +655,7 @@ test_stdio(hid_t fapl)
quit:
/* End with normal return code */
/* Clean up the test file */
- if(h5_cleanup(FILENAME, fapl))
+ if(h5_clean_files(FILENAME, fapl))
HDremove(DNAME);
HDfflush(stdout);
return 0;
@@ -716,7 +716,7 @@ test_family(hid_t fapl)
quit:
/* End with normal return code */
/* Clean up the test file */
- if(h5_cleanup(FILENAME, fapl))
+ if(h5_clean_files(FILENAME, fapl))
HDremove(DNAME);
return 0;
diff --git a/test/bittests.c b/test/bittests.c
index c527bb8..c4dfe4c 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -21,7 +21,7 @@
*/
#include "h5test.h"
-#define H5T_PACKAGE
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "H5Tpkg.h"
#define NTESTS 100000
diff --git a/test/btree2.c b/test/btree2.c
index d8abc84..caad849 100644
--- a/test/btree2.c
+++ b/test/btree2.c
@@ -22,7 +22,7 @@
* This file needs to access private datatypes from the H5B2 package.
* This file also needs to access the v2 B-tree testing code.
*/
-#define H5B2_PACKAGE
+#define H5B2_FRIEND /*suppress error about including H5B2pkg */
#define H5B2_TESTING
#include "H5B2pkg.h"
diff --git a/test/cache_common.h b/test/cache_common.h
index 737c53f..9e8c5ba 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -22,8 +22,8 @@
#ifndef _CACHE_COMMON_H
#define _CACHE_COMMON_H
-#define H5C_PACKAGE /*suppress error about including H5Cpkg */
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+#define H5C_FRIEND /*suppress error about including H5Cpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
/* Include library header files */
#include "H5ACprivate.h"
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index 84c9b34..2d22b5b 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -1113,6 +1113,7 @@ check_dense_attribute_tags(void)
/* Create dataset */
if ( (did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
/* get dataset object header */
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
@@ -2025,6 +2026,7 @@ check_dataset_creation_tags(hid_t fcpl, int type)
/* Create Dataset */
if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
/* =================================== */
/* Verification of Metadata Tag Values */
@@ -2159,6 +2161,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type)
if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
if (( did = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
/* =================================== */
/* Verification of Metadata Tag Values */
@@ -2287,6 +2290,7 @@ check_dataset_open_tags(hid_t fcpl, int type)
/* Create Dataset */
if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
/* Retrieve tag associated with this dataset */
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
@@ -2419,6 +2423,7 @@ check_dataset_write_tags(hid_t fcpl, int type)
/* Create Dataset */
if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
/* Retrieve tag associated with this dataset */
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
@@ -2709,6 +2714,7 @@ check_dataset_read_tags(hid_t fcpl, int type)
/* Create Dataset */
if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
/* Retrieve tag associated with this dataset */
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
@@ -2847,6 +2853,7 @@ check_dataset_size_retrieval(hid_t fcpl, int type)
/* Create Dataset */
if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
/* Retrieve tag associated with this dataset */
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
@@ -2986,6 +2993,7 @@ check_dataset_extend_tags(hid_t fcpl, int type)
/* Create Dataset */
if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
/* Retrieve tag associated with this dataset */
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
@@ -3367,6 +3375,7 @@ check_link_removal_tags(hid_t fcpl, int type)
/* Create Dataset */
if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
/* Retrieve tag associated with this dataset */
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
@@ -3526,6 +3535,7 @@ check_link_getname_tags(hid_t fcpl, int type)
/* Create Dataset */
if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
/* Retrieve tag associated with this dataset */
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 5c591f8..22bf3a2 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -21,7 +21,7 @@
/* See H5private.h for how to include headers */
#undef NDEBUG
-#define H5T_PACKAGE
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "H5Tpkg.h" /*to turn off hardware conversions*/
#include "H5Iprivate.h"
diff --git a/test/dsets.c b/test/dsets.c
index 136fec2..4d20023 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -26,7 +26,7 @@
/*
* This file needs to access private information from the H5Z package.
*/
-#define H5Z_PACKAGE
+#define H5Z_FRIEND
#include "h5test.h"
diff --git a/test/dt_arith.c b/test/dt_arith.c
index eb201d0..102f217 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -45,7 +45,7 @@
/* Alignment test stuff */
#ifdef TEST_ALIGNMENT
-#define H5T_PACKAGE
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "H5Tpkg.h"
#endif
#define SET_ALIGNMENT(TYPE,VAL) \
@@ -645,11 +645,18 @@ test_hard_query(void)
}
PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
return 0;
- error:
+error:
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
return 1;
}
@@ -871,7 +878,11 @@ error:
if(saved_buf2)
HDfree(saved_buf2);
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5(); /*print statistics*/
+
return MAX((int)fails_this_test, 1);
}
@@ -1290,6 +1301,10 @@ test_derived_flt(void)
} /* end if */
PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5(); /*print statistics*/
return 0;
@@ -1305,7 +1320,12 @@ test_derived_flt(void)
H5Pclose (dxpl_id);
H5Fclose (file);
} H5E_END_TRY;
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5(); /*print statistics*/
+
return MAX((int)fails_this_test, 1);
}
@@ -1592,6 +1612,10 @@ test_derived_integer(void)
HDfree(saved_buf);
PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5(); /*print statistics*/
return 0;
@@ -1606,7 +1630,12 @@ test_derived_integer(void)
H5Pclose (dxpl_id);
H5Fclose (file);
} H5E_END_TRY;
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5(); /*print statistics*/
+
return MAX((int)fails_this_test, 1);
}
@@ -2601,7 +2630,12 @@ done:
if (saved) aligned_free(saved);
if (aligned) HDfree(aligned);
HDfflush(stdout);
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5(); /*print statistics*/
+
return (int)fails_all_tests;
error:
@@ -2609,7 +2643,12 @@ error:
if (saved) aligned_free(saved);
if (aligned) HDfree(aligned);
HDfflush(stdout);
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5(); /*print statistics*/
+
return MAX((int)fails_all_tests, 1);
}
@@ -3307,6 +3346,9 @@ done:
HDassert(0 && "Should not reach this point!");
return 1;
#else
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
/* If the source is normalized values, treat the failures as error;
@@ -3330,7 +3372,11 @@ error:
HDassert(0 && "Should not reach this point!");
return 1;
#else
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
if(run_test==TEST_NOOP || run_test==TEST_NORMAL)
return MAX((int)fails_all_tests, 1);
else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
@@ -4504,6 +4550,9 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
if (saved) aligned_free(saved);
if (aligned) HDfree(aligned);
HDfflush(stdout);
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5(); /*print statistics*/
/* If the source is normalized floating values, treat the failures as error;
@@ -4518,6 +4567,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
if (saved) aligned_free(saved);
if (aligned) HDfree(aligned);
HDfflush(stdout);
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5(); /*print statistics*/
if(run_test==TEST_NORMAL)
@@ -5164,6 +5217,10 @@ main(void)
*----------------------------------------------------------------------
*/
without_hardware_g = TRUE;
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
/* Test software floating-point conversion functions */
@@ -5179,8 +5236,14 @@ main(void)
/* Test software integer-float conversion functions */
nerrors += run_int_fp_conv("soft");
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
if (nerrors) {
printf("***** %lu FAILURE%s! *****\n",
nerrors, 1==nerrors?"":"S");
@@ -5189,3 +5252,4 @@ main(void)
printf("All data type tests passed.\n");
return 0;
}
+
diff --git a/test/dtypes.c b/test/dtypes.c
index 88bbce0..6fe455d 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -47,7 +47,7 @@
/* Alignment test stuff */
#ifdef TEST_ALIGNMENT
-#define H5T_PACKAGE
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "H5Tpkg.h"
#endif
#define SET_ALIGNMENT(TYPE,VAL) \
@@ -769,11 +769,20 @@ test_compound_2(void)
CHECK_NMEMBS(nmembs , st, dt)
PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return 0;
- error:
+error:
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return 1;
}
@@ -888,11 +897,19 @@ test_compound_3(void)
CHECK_NMEMBS(nmembs, st, dt)
PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
return 0;
- error:
+error:
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return 1;
}
@@ -1015,11 +1032,19 @@ test_compound_4(void)
CHECK_NMEMBS(nmembs, st, dt)
PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
return 0;
- error:
+error:
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return 1;
}
@@ -1226,11 +1251,19 @@ test_compound_6(void)
CHECK_NMEMBS(nmembs, st, dt)
PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
return 0;
- error:
+error:
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return 1;
}
@@ -1365,11 +1398,19 @@ test_compound_7(void)
} /* end if */
PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
return 0;
- error:
+error:
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return 1;
}
@@ -4229,6 +4270,10 @@ test_conv_str_1(void)
HDfree(buf);
PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
return 0;
@@ -4241,7 +4286,11 @@ error:
if(buf)
HDfree(buf);
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return 1;
}
@@ -4304,7 +4353,11 @@ error:
if(buf)
HDfree(buf);
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return ret_value;
}
@@ -4418,7 +4471,11 @@ error:
if(tag)
H5free_memory(tag); /* Technically allocated by API call */
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return ret_value; /* Number of errors */
}
@@ -4490,7 +4547,11 @@ error:
if(buf)
HDfree(buf);
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return ret_value;
}
@@ -4657,13 +4718,22 @@ test_conv_bitfield(void)
H5Tclose(st);
H5Tclose(dt);
PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
return 0;
- error:
+error:
H5Tclose(st);
H5Tclose(dt);
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return 1;
}
@@ -4781,14 +4851,18 @@ test_bitfield_funcs(void)
retval = 0;
- error:
-
+error:
if (retval == -1) retval = 1;
H5free_memory(tag);
H5Tclose(ntype);
H5Tclose(type);
if (retval == 0) PASSED();
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return retval;
}
@@ -7293,6 +7367,7 @@ main(void)
#ifndef H5_NO_DEPRECATED_SYMBOLS
nerrors += test_deprec(fapl);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
h5_cleanup(FILENAME, fapl); /*must happen before first reset*/
reset_hdf5();
diff --git a/test/earray.c b/test/earray.c
index b510992..368ee42 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -22,7 +22,7 @@
* This file needs to access private datatypes from the H5EA package.
* This file also needs to access the extensible array testing code.
*/
-#define H5EA_PACKAGE
+#define H5EA_FRIEND /*suppress error about including H5EApkg */
#define H5EA_TESTING
#include "H5EApkg.h" /* Extensible Arrays */
diff --git a/test/efc.c b/test/efc.c
index ff4f738..a8d77e0 100644
--- a/test/efc.c
+++ b/test/efc.c
@@ -18,7 +18,7 @@
#include "h5test.h"
-#define H5F_PACKAGE
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "H5Fpkg.h"
#include "H5Iprivate.h"
@@ -3200,7 +3200,7 @@ main(void)
puts("All external file cache tests passed.");
- h5_cleanup(FILENAME, fapl_id);
+ h5_clean_files(FILENAME, fapl_id);
return 0;
diff --git a/test/err_compat.c b/test/err_compat.c
index 576433e..7779ddc 100644
--- a/test/err_compat.c
+++ b/test/err_compat.c
@@ -500,7 +500,7 @@ main(void)
}
if(H5Fclose(file) < 0) TEST_ERROR ;
- h5_cleanup(FILENAME, fapl);
+ h5_clean_files(FILENAME, fapl);
printf("All error API tests passed.\n");
return 0;
@@ -510,3 +510,4 @@ main(void)
return 1;
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
diff --git a/test/error_test.c b/test/error_test.c
index e712d86..4e4c0ef 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -756,7 +756,7 @@ main(void)
if(test_filter_error(filename) < 0)
TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
+ h5_clean_files(FILENAME, fapl);
HDfprintf(stderr, "\nAll error API tests passed.\n");
return 0;
diff --git a/test/farray.c b/test/farray.c
index 43b63c6..e3e59da 100644
--- a/test/farray.c
+++ b/test/farray.c
@@ -22,7 +22,7 @@
* This file needs to access private datatypes from the H5FA package.
* This file also needs to access the fixed array testing code.
*/
-#define H5FA_PACKAGE
+#define H5FA_FRIEND /*suppress error about including H5FApkg */
#define H5FA_TESTING
#include "H5FApkg.h" /* Fixed Arrays */
diff --git a/test/fheap.c b/test/fheap.c
index bb30e05..25784a9 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -22,7 +22,7 @@
* This file needs to access private datatypes from the H5HF package.
* This file also needs to access the fractal heap testing code.
*/
-#define H5HF_PACKAGE
+#define H5HF_FRIEND /*suppress error about including H5HFpkg */
#define H5HF_TESTING
#include "H5HFpkg.h" /* Fractal heaps */
diff --git a/test/file_image.c b/test/file_image.c
index b1b9d47..42199cb 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -643,7 +643,7 @@ test_core(void)
if(H5Fclose(file) < 0) FAIL_STACK_ERROR
/* Release resources */
- h5_cleanup(FILENAME, fapl);
+ h5_clean_files(FILENAME, fapl);
HDfree(udata);
HDfree(file_image);
HDremove(copied_filename);
@@ -890,8 +890,8 @@ test_get_file_image(const char * test_banner,
VERIFY(err == SUCCEED, "H5Pclose(core_fapl_id) failed.");
/* tidy up */
- result = h5_cleanup(FILENAME2, fapl);
- VERIFY(result != 0, "h5_cleanup() failed.");
+ result = h5_clean_files(FILENAME2, fapl);
+ VERIFY(result != 0, "h5_clean_files() failed.");
/* discard the image buffer if it exists */
if(image_ptr != NULL)
@@ -1039,8 +1039,8 @@ test_get_file_image_error_rejection(void)
VERIFY(err == SUCCEED, "H5Fclose(file_id) failed.");
/* tidy up */
- result = h5_cleanup(FILENAME2, fapl_id);
- VERIFY(result != 0, "h5_cleanup(1) failed.");
+ result = h5_clean_files(FILENAME2, fapl_id);
+ VERIFY(result != 0, "h5_clean_files(1) failed.");
/* discard the image buffer if it exists */
if(image_ptr != NULL)
@@ -1145,8 +1145,8 @@ test_get_file_image_error_rejection(void)
VERIFY(err == SUCCEED, "H5Fclose(2) failed.");
/* tidy up */
- result = h5_cleanup(FILENAME2, fapl_id);
- VERIFY(result != 0, "h5_cleanup(2 failed.");
+ result = h5_clean_files(FILENAME2, fapl_id);
+ VERIFY(result != 0, "h5_clean_files(2 failed.");
/************************** Test #3 **********************************/
/* set up a split file driver test file, and try to get its image
@@ -1208,8 +1208,8 @@ test_get_file_image_error_rejection(void)
VERIFY(err == SUCCEED, "H5Fclose(2) failed.");
/* tidy up */
- result = h5_cleanup(FILENAME2, fapl_id);
- VERIFY(result != 0, "h5_cleanup(2 failed.");
+ result = h5_clean_files(FILENAME2, fapl_id);
+ VERIFY(result != 0, "h5_clean_files(2 failed.");
/************************** Test #4 **********************************/
/* set up a family file driver test file, and try to get its image
@@ -1269,8 +1269,8 @@ test_get_file_image_error_rejection(void)
VERIFY(err == SUCCEED, "H5Fclose(2) failed.");
/* tidy up */
- result = h5_cleanup(FILENAME2, fapl_id);
- VERIFY(result != 0, "h5_cleanup(2 failed.");
+ result = h5_clean_files(FILENAME2, fapl_id);
+ VERIFY(result != 0, "h5_clean_files(2 failed.");
PASSED();
@@ -1340,6 +1340,8 @@ main(void)
errors += test_get_file_image_error_rejection();
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
if(errors) {
printf("***** %d File Image TEST%s FAILED! *****\n",
diff --git a/test/flush2.c b/test/flush2.c
index 0ee299e..e86d646 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -107,7 +107,7 @@ error:
static int
check_file(char* filename, hid_t fapl, int flag)
{
- hid_t file, groups, grp;
+ hid_t file = -1, groups = -1;
char name[1024];
int i;
@@ -117,6 +117,7 @@ check_file(char* filename, hid_t fapl, int flag)
/* Open some groups */
if((groups = H5Gopen2(file, "some_groups", H5P_DEFAULT)) < 0) goto error;
for(i = 0; i < 100; i++) {
+ hid_t grp;
sprintf(name, "grp%02u", (unsigned)i);
if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error;
if(H5Gclose(grp) < 0) goto error;
@@ -132,6 +133,11 @@ check_file(char* filename, hid_t fapl, int flag)
return 0;
error:
+ H5E_BEGIN_TRY {
+ H5Gclose(groups);
+ H5Fclose(file);
+ } H5E_END_TRY;
+
return 1;
} /* end check_file() */
@@ -184,14 +190,13 @@ main(void)
h5_fixname(FILENAME[1], fapl, name, sizeof name);
if(check_file(name, fapl, FALSE))
PASSED()
- else
- {
+ else {
#if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS)
- SKIPPED();
- puts(" DLL will flush the file even when calling _exit, skip this test temporarily");
+ SKIPPED();
+ puts(" DLL will flush the file even when calling _exit, skip this test temporarily");
#else
- H5_FAILED()
- goto error;
+ H5_FAILED()
+ goto error;
#endif
}
H5Eset_auto2(H5E_DEFAULT, func, NULL);
@@ -205,17 +210,16 @@ main(void)
h5_fixname(FILENAME[2], fapl, name, sizeof name);
if(check_file(name, fapl, TRUE))
PASSED()
- else
- {
+ else {
#if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS)
- SKIPPED();
- puts(" DLL will flush the file even when calling _exit, skip this test temporarily");
+ SKIPPED();
+ puts(" DLL will flush the file even when calling _exit, skip this test temporarily");
#else
- H5_FAILED()
- goto error;
+ H5_FAILED()
+ goto error;
#endif
-
}
+
H5Eset_auto2(H5E_DEFAULT, func, NULL);
h5_cleanup(FILENAME, fapl);
diff --git a/test/freespace.c b/test/freespace.c
index 1338ae7..1b87974 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -17,13 +17,13 @@
*/
#include "h5test.h"
-#define H5FS_PACKAGE
+#define H5FS_FRIEND /*suppress error about including H5FSpkg */
#define H5FS_TESTING
#include "H5FSpkg.h" /* Free space manager */
/* Other private headers that this test requires */
-#define H5F_PACKAGE
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "H5Fpkg.h"
#include "H5Iprivate.h"
#include "H5VMprivate.h"
@@ -2841,6 +2841,8 @@ main(void)
if(env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
+ h5_reset();
+
fapl = h5_fileaccess();
/* make sure alignment is not set for tests to succeed */
diff --git a/test/getname.c b/test/getname.c
index e1bbc6b..2700b49 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -20,8 +20,8 @@
* Purpose: Tests the "ID to name" functionality
*/
-#define H5G_PACKAGE /*suppress error about including H5Gpkg */
-#define H5I_PACKAGE /*suppress error about including H5Ipkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5I_FRIEND /*suppress error about including H5Ipkg */
/* Define these macros to indicate that the testing APIs should be available */
#define H5G_TESTING
diff --git a/test/h5test.c b/test/h5test.c
index fefacda..51ec2ca 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -28,7 +28,7 @@
#include "H5srcdir.h"
/* Necessary for h5_verify_cached_stabs() */
-#define H5G_PACKAGE
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
#define H5G_TESTING
#include "H5Gpkg.h"
@@ -91,6 +91,9 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
*/
static const char *multi_letters = "msbrglo";
+/* Previous error reporting function */
+static H5E_auto2_t err_func = NULL;
+
static herr_t h5_errors(hid_t estack, void *client_data);
static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix,
char *fullname, size_t size);
@@ -120,9 +123,9 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data)
return 0;
}
-
+
/*-------------------------------------------------------------------------
- * Function: h5_cleanup
+ * Function: h5_clean_files
*
* Purpose: Cleanup temporary test files.
* base_name contains the list of test file names.
@@ -130,13 +133,13 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data)
*
* Return: Non-zero if cleanup actions were performed; zero otherwise.
*
- * Programmer: Albert Cheng
- * May 28, 1998
+ * Programmer: Quincey Koziol
+ * September 13, 2015
*
*-------------------------------------------------------------------------
*/
int
-h5_cleanup(const char *base_name[], hid_t fapl)
+h5_clean_files(const char *base_name[], hid_t fapl)
{
int retval = 0;
@@ -189,8 +192,61 @@ h5_cleanup(const char *base_name[], hid_t fapl)
retval = 1;
} /* end if */
+ /* Close the FAPL used to access the file */
H5Pclose(fapl);
+
return retval;
+} /* end h5_clean_files() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5_cleanup
+ *
+ * Purpose: Cleanup temporary test files.
+ * base_name contains the list of test file names.
+ * The file access property list is also closed.
+ *
+ * Return: Non-zero if cleanup actions were performed; zero otherwise.
+ *
+ * Programmer: Albert Cheng
+ * May 28, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+h5_cleanup(const char *base_name[], hid_t fapl)
+{
+ int retval = 0;
+
+ /* Clean up the files and the FAPL */
+ retval = h5_clean_files(base_name, fapl);
+
+ /* Restore the original error reporting routine */
+ h5_restore_err();
+
+ return retval;
+} /* end h5_cleanup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5_restore_err
+ *
+ * Purpose: Restore the default error handler.
+ *
+ * Return: N/A
+ *
+ * Programmer: Quincey Koziol
+ * Sept 10, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+h5_restore_err(void)
+{
+ /* Restore the original error reporting routine */
+ HDassert(err_func != NULL);
+ H5Eset_auto2(H5E_DEFAULT, err_func, NULL);
+ err_func = NULL;
}
@@ -212,6 +268,10 @@ h5_reset(void)
HDfflush(stdout);
HDfflush(stderr);
H5close();
+
+ /* Save current error stack reporting routine and redirect to our local one */
+ HDassert(err_func == NULL);
+ H5Eget_auto2(H5E_DEFAULT, &err_func, NULL);
H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL);
/*
@@ -233,12 +293,12 @@ h5_reset(void)
*/
sprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid());
H5E_BEGIN_TRY {
- hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT);
- hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(grp);
- H5Fclose(file);
- HDunlink(filename);
+ hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
+ H5P_DEFAULT);
+ hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(grp);
+ H5Fclose(file);
+ HDunlink(filename);
} H5E_END_TRY;
}
#endif /* OLD_WAY */
diff --git a/test/h5test.h b/test/h5test.h
index 5b203c6..615ca4f 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -123,6 +123,7 @@ extern "C" {
#endif
/* Generally useful testing routines */
+H5TEST_DLL int h5_clean_files(const char *base_name[], hid_t fapl);
H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl);
H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size);
H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size);
@@ -130,6 +131,7 @@ H5TEST_DLL hid_t h5_fileaccess(void);
H5TEST_DLL void h5_no_hwconv(void);
H5TEST_DLL const char *h5_rmprefix(const char *filename);
H5TEST_DLL void h5_reset(void);
+H5TEST_DLL void h5_restore_err(void);
H5TEST_DLL void h5_show_hostname(void);
H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl);
H5TEST_DLL int print_func(const char *format, ...);
diff --git a/test/istore.c b/test/istore.c
index d088fe8..ec7542a 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -19,7 +19,7 @@
* Purpose: Tests various aspects of indexed raw data storage.
*/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "h5test.h"
#include "H5private.h"
diff --git a/test/links.c b/test/links.c
index ef71be7..ce3b658 100644
--- a/test/links.c
+++ b/test/links.c
@@ -24,7 +24,7 @@
* This file needs to access private information from the H5G package.
* This file also needs to access the group testing code.
*/
-#define H5G_PACKAGE
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
#define H5G_TESTING
#include "h5test.h"
diff --git a/test/links_env.c b/test/links_env.c
index 6e47667..b3fec38 100644
--- a/test/links_env.c
+++ b/test/links_env.c
@@ -17,7 +17,7 @@
* Purpose: Tests hard, soft (symbolic) & external links.
*/
-#define H5G_PACKAGE
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
#define H5G_TESTING
#include "h5test.h"
diff --git a/test/mf.c b/test/mf.c
index 67ebc4e..7e476aa 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -24,13 +24,13 @@
#include "h5test.h"
-#define H5MF_PACKAGE
+#define H5MF_FRIEND /*suppress error about including H5MFpkg */
#include "H5MFpkg.h"
-#define H5FS_PACKAGE
+#define H5FS_FRIEND /*suppress error about including H5FSpkg */
#include "H5FSpkg.h"
-#define H5F_PACKAGE
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
#include "H5Fpkg.h"
@@ -6843,7 +6843,7 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_gone(fapl_new, fcpl);
ret += test_mf_fs_persist(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
/* STDIO */
@@ -6857,7 +6857,7 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_gone(fapl_new, fcpl);
ret += test_mf_fs_persist(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
/* CORE */
HDputs("Testing free-space managers with core driver");
@@ -6871,7 +6871,7 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_gone(fapl_new, fcpl);
ret += test_mf_fs_persist(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
/* FAMILY */
HDputs("Testing free-space managers with family driver");
@@ -6883,7 +6883,7 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_persist(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
/* SPLIT */
HDputs("Testing free-space managers with split driver");
@@ -6896,7 +6896,7 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_persist(fapl_new, fcpl);
ret += test_mf_fs_split(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
/* MULTI */
HDputs("Testing free-space managers with multi driver");
@@ -6910,7 +6910,7 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_multi(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
} /* end for new_format */
@@ -7262,7 +7262,7 @@ test_filespace_drivers(hid_t fapl)
ret += test_filespace_strategy_threshold(fapl_new);
ret += test_filespace_gone(fapl_new);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
/* STDIO */
HDputs("Testing file space management with stdio driver");
@@ -7275,7 +7275,7 @@ test_filespace_drivers(hid_t fapl)
ret += test_filespace_strategy_threshold(fapl_new);
ret += test_filespace_gone(fapl_new);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
/* CORE */
HDputs("Testing file space management with core driver");
@@ -7289,7 +7289,7 @@ test_filespace_drivers(hid_t fapl)
ret += test_filespace_strategy_threshold(fapl_new);
ret += test_filespace_gone(fapl_new);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
/* FAMILY */
HDputs("Testing file space managers with family driver");
@@ -7302,7 +7302,7 @@ test_filespace_drivers(hid_t fapl)
ret += test_filespace_strategy_threshold(fapl_new);
ret += test_filespace_gone(fapl_new);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
/* SPLIT */
@@ -7316,7 +7316,7 @@ test_filespace_drivers(hid_t fapl)
ret += test_filespace_strategy_threshold(fapl_new);
ret += test_filespace_gone(fapl_new);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
/* MULTI */
HDputs("Testing file space managers with multi driver");
@@ -7331,7 +7331,7 @@ test_filespace_drivers(hid_t fapl)
ret += test_filespace_strategy_threshold(fapl_new);
ret += test_filespace_gone(fapl_new);
- h5_cleanup(FILENAME, fapl_new);
+ h5_clean_files(FILENAME, fapl_new);
} /* end for new_format */
@@ -7456,6 +7456,8 @@ main(void)
if(env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
+ h5_reset();
+
fapl = h5_fileaccess();
/* Make a copy of the FAPL before adjusting the alignment */
diff --git a/test/objcopy.c b/test/objcopy.c
index a73beb3..6607f4e 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -28,7 +28,7 @@
* This file needs to access private information from the H5S package.
* This file also needs to access the dataspace testing code.
*/
-#define H5S_PACKAGE
+#define H5S_FRIEND /*suppress error about including H5Spkg */
#define H5S_TESTING
#include "H5Spkg.h" /* Dataspaces */
@@ -36,7 +36,7 @@
* This file needs to access private information from the H5P package.
* This file also needs to access the property list testing code.
*/
-#define H5P_PACKAGE
+#define H5P_FRIEND /*suppress error about including H5Ppkg */
#define H5P_TESTING
#include "H5Ppkg.h" /* Property Lists */
diff --git a/test/ohdr.c b/test/ohdr.c
index 45f2238..e178729 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -24,14 +24,14 @@
* This file needs to access private datatypes from the H5O package.
* This file also needs to access the object header testing code.
*/
-#define H5O_PACKAGE
+#define H5O_FRIEND /*suppress error about including H5Opkg */
#define H5O_TESTING
#include "H5Opkg.h"
/*
* This file needs to access private datatypes from the H5G package.
*/
-#define H5G_PACKAGE
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
#include "H5Gpkg.h"
const char *FILENAME[] = {
diff --git a/test/plugin.c b/test/plugin.c
index 74a8f4b..07b20ea 100644
--- a/test/plugin.c
+++ b/test/plugin.c
@@ -26,7 +26,7 @@
/*
* This file needs to access private datatypes from the H5Z package.
*/
-#define H5Z_PACKAGE
+#define H5Z_FRIEND
#include "H5Zpkg.h"
/* Filters for HDF5 internal test */
diff --git a/test/pool.c b/test/pool.c
index 916d45e..83c862b 100644
--- a/test/pool.c
+++ b/test/pool.c
@@ -22,7 +22,7 @@
* This file needs to access private datatypes from the H5MP package.
* This file also needs to access the memory pool testing code.
*/
-#define H5MP_PACKAGE
+#define H5MP_FRIEND /*suppress error about including H5MPpkg */
#define H5MP_TESTING
#include "H5MPpkg.h" /* Memory Pools */
diff --git a/test/stab.c b/test/stab.c
index 95e9722..7db1feb 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -18,7 +18,7 @@
* Tuesday, November 24, 1998
*/
-#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5G_TESTING
diff --git a/test/tattr.c b/test/tattr.c
index 6642cf1..7e64c13 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -29,7 +29,7 @@
* This file needs to access private information from the H5O package.
* This file also needs to access the object header testing code.
*/
-#define H5O_PACKAGE
+#define H5O_FRIEND /*suppress error about including H5Opkg */
#define H5O_TESTING
#include "H5Opkg.h" /* Object headers */
@@ -37,7 +37,7 @@
* This file needs to access private information from the H5A package.
* This file also needs to access the attribute testing code.
*/
-#define H5A_PACKAGE
+#define H5A_FRIEND /*suppress error about including H5Apkg */
#define H5A_TESTING
#include "H5Apkg.h" /* Attributes */
@@ -45,7 +45,7 @@
* This file needs to access private information from the H5F package.
* This file also needs to access the file testing code.
*/
-#define H5F_PACKAGE
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
#include "H5Fpkg.h" /* File access */
diff --git a/test/tfile.c b/test/tfile.c
index 33c947f..8c4adb4 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -32,7 +32,7 @@
* This file needs to access private information from the H5F package.
* This file also needs to access the file testing code.
*/
-#define H5F_PACKAGE
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
#include "H5Fpkg.h" /* File access */
@@ -2960,7 +2960,7 @@ test_filespace_sects(void)
test_free_sections(fapl_sec2, filename);
/* close fapl_sec2 and remove the file */
- h5_cleanup(FILENAME, fapl_sec2);
+ h5_clean_files(FILENAME, fapl_sec2);
/* SPLIT */
@@ -2979,7 +2979,7 @@ test_filespace_sects(void)
test_free_sections(fapl_split, filename);
/* close fapl and remove the file */
- h5_cleanup(FILENAME, fapl_split);
+ h5_clean_files(FILENAME, fapl_split);
/* STDIO */
@@ -2998,7 +2998,7 @@ test_filespace_sects(void)
test_free_sections(fapl_stdio, filename);
/* close fapl and remove the file */
- h5_cleanup(FILENAME, fapl_stdio);
+ h5_clean_files(FILENAME, fapl_stdio);
/* CORE */
MESSAGE(5, ("Testing File free space information for a core file\n"));
@@ -3016,7 +3016,7 @@ test_filespace_sects(void)
test_free_sections(fapl_core, filename);
/* close fapl_ and remove the file */
- h5_cleanup(FILENAME, fapl_core);
+ h5_clean_files(FILENAME, fapl_core);
/* FAMILY */
@@ -3035,7 +3035,7 @@ test_filespace_sects(void)
test_free_sections(fapl_family, filename);
/* close fapl and remove the file */
- h5_cleanup(FILENAME, fapl_family);
+ h5_clean_files(FILENAME, fapl_family);
} /* end test_filespace_sects() */
@@ -3155,7 +3155,7 @@ test_filespace_info(void)
} /* end for file space strategy type */
} /* end for free space threshold */
- h5_cleanup(FILESPACE_NAME, my_fapl);
+ h5_clean_files(FILESPACE_NAME, my_fapl);
} /* end for new/old format */
diff --git a/test/tgenprop.c b/test/tgenprop.c
index fda4161..f35505f 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -21,7 +21,7 @@
*
*************************************************************/
-#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+#define H5P_FRIEND /*suppress error about including H5Ppkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5P_TESTING
diff --git a/test/tid.c b/test/tid.c
index 68cebf3..6570b1c 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -19,7 +19,7 @@
#include "hdf5.h"
/* Include H5Ipkg.h to calculate max number of groups */
-#define H5I_PACKAGE
+#define H5I_FRIEND /*suppress error about including H5Ipkg */
#include "H5Ipkg.h"
/* Test basic functionality of registering and deleting types and IDs */
diff --git a/test/tmisc.c b/test/tmisc.c
index 6a68857..2980ec2 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -23,7 +23,7 @@
*
*************************************************************/
-#define H5D_PACKAGE /*suppress error about including H5Dpkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5D_TESTING
diff --git a/test/tselect.c b/test/tselect.c
index bdcdb2b..d6b1e8f 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -21,7 +21,7 @@
*
*************************************************************/
-#define H5S_PACKAGE /*suppress error about including H5Spkg */
+#define H5S_FRIEND /*suppress error about including H5Spkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5S_TESTING
diff --git a/test/tsohm.c b/test/tsohm.c
index e22940f..b3ffac7 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -27,7 +27,7 @@
* This file needs to access private information from the H5F package.
* This file also needs to access the file testing code.
*/
-#define H5F_PACKAGE
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
#include "H5Fpkg.h" /* File access */
@@ -1279,7 +1279,7 @@ static void size2_verify_plist1(hid_t plist)
CHECK_I(ret, "H5Pget_fill_value");
ret = memcmp(&fill1, &fill1_correct, sizeof(fill1_correct));
- VERIFY(ret, 0, memcmp);
+ VERIFY(ret, 0, "memcmp");
ret = H5Tclose(dtype1_id);
CHECK_I(ret, "H5Tclose");
@@ -1350,7 +1350,7 @@ static void size2_verify_plist2(hid_t plist)
CHECK_I(ret, "H5Pget_fill_value");
ret = HDmemcmp(&fill2, &fill2_correct, (size_t)DTYPE2_SIZE);
- VERIFY(ret, 0, memcmp);
+ VERIFY(ret, 0, "memcmp");
ret = H5Tclose(dtype2_id);
CHECK_I(ret, "H5Tclose");
diff --git a/test/unlink.c b/test/unlink.c
index 993a7ec..c091281 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -20,7 +20,7 @@
* Purpose: Test unlinking operations.
*/
-#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5G_TESTING
diff --git a/test/vfd.c b/test/vfd.c
index 4ece2ba..708474c 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -80,15 +80,17 @@ const char *FILENAME[] = {
static herr_t
test_sec2(void)
{
- hid_t file = -1;
- hid_t fapl = -1;
- hid_t access_fapl = -1;
+ hid_t file = -1;
+ hid_t fapl = -1;
+ hid_t access_fapl = -1;
char filename[1024];
int *fhandle = NULL;
hsize_t file_size = 0;
TESTING("SEC2 file driver");
+ h5_reset();
+
/* Set property list and file name for SEC2 driver. */
fapl = h5_fileaccess();
if(H5Pset_fapl_sec2(fapl) < 0)
@@ -141,107 +143,103 @@ error:
return -1;
}
-
/*-------------------------------------------------------------------------
- * Function: test_direct
+ * Function: test_core
*
- * Purpose: Tests the file handle interface for DIRECT I/O driver
+ * Purpose: Tests the file handle interface for CORE driver
*
* Return: Success: 0
* Failure: -1
*
* Programmer: Raymond Lu
- * Wednesday, 20 September 2006
+ * Tuesday, Sept 24, 2002
*
*-------------------------------------------------------------------------
*/
static herr_t
-test_direct(void)
+test_core(void)
{
-#ifdef H5_HAVE_DIRECT
hid_t file=(-1), fapl, access_fapl = -1;
- hid_t dset1=-1, dset2=-1, space1=-1, space2=-1;
char filename[1024];
- int *fhandle=NULL;
+ void *fhandle=NULL;
hsize_t file_size;
- hsize_t dims1[2], dims2[1];
- size_t mbound;
- size_t fbsize;
- size_t cbsize;
+ hbool_t use_write_tracking;
+ size_t write_tracking_page_size;
int *points = NULL, *check = NULL, *p1, *p2;
- int wdata2[DSET2_DIM] = {11,12,13,14};
- int rdata2[DSET2_DIM];
+ hid_t dset1=-1, space1=-1;
+ hsize_t dims1[2];
int i, j, n;
-#endif /*H5_HAVE_DIRECT*/
- TESTING("DIRECT I/O file driver");
+ TESTING("CORE file driver");
-#ifndef H5_HAVE_DIRECT
- SKIPPED();
- return 0;
-#else /*H5_HAVE_DIRECT*/
+ h5_reset();
- /* Set property list and file name for Direct driver. Set memory alignment boundary
- * and file block size to 512 which is the minimum for Linux 2.6. */
+ /* Set property list and file name for CORE driver */
fapl = h5_fileaccess();
- if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
- TEST_ERROR;
- h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
-
- /* Verify the file access properties */
- if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0)
+ if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
TEST_ERROR;
- if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE)
+ if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0)
TEST_ERROR;
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0)
+ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- } H5E_END_TRY;
- if(file<0) {
- H5Pclose (fapl);
- SKIPPED();
- printf(" Probably the file system doesn't support Direct I/O\n");
- return 0;
- }
-
/* Retrieve the access property list... */
if ((access_fapl = H5Fget_access_plist(file)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_DIRECT != H5Pget_driver(access_fapl))
+ if(H5FD_CORE != H5Pget_driver(access_fapl))
+ TEST_ERROR;
+
+ /* Check that the backing store write tracking info was saved */
+ if(H5Pget_core_write_tracking(fapl, &use_write_tracking, &write_tracking_page_size) < 0)
+ TEST_ERROR;
+ if(TRUE != use_write_tracking)
+ TEST_ERROR;
+ if(CORE_PAGE_SIZE != write_tracking_page_size)
TEST_ERROR;
/* ...and close the property list */
if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
- /* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
- TEST_ERROR;
- if(*fhandle<0)
+ if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle) < 0)
TEST_ERROR;
+ if(fhandle==NULL)
+ {
+ printf("fhandle==NULL\n");
+ TEST_ERROR;
+ }
/* Check file size API */
if(H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
- /* There is no guarantee of the number of metadata allocations, but it's
- * 4 currently and the size of the file should be between 3 & 4 file buffer
- * sizes..
+ /* There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable. Why is this 4KB?
*/
- if(file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4))
+ if(file_size<2*KB || file_size>6*KB)
TEST_ERROR;
- /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including
- * memory address, size of data, and file address. */
- if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if(H5Fclose(file) < 0)
TEST_ERROR;
- if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+
+
+ /* Open the file with backing store off for read and write.
+ * Changes won't be saved in file. */
+ if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0)
+ TEST_ERROR;
+
+ if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR;
+
+ /* Allocate memory for data set. */
+ if(NULL == (points = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
/* Initialize the dset1 */
@@ -284,47 +282,70 @@ test_direct(void)
printf(" Read different values than written in data set 1.\n");
printf(" At index %d,%d\n", i, j);
TEST_ERROR;
- } /* end if */
+ } /* end if */
- /* Create the data space2. For data set 2, memory address and data size are not aligned. */
- dims2[0] = DSET2_DIM;
- if((space2 = H5Screate_simple(1, dims2, NULL)) < 0)
+ if(H5Dclose(dset1) < 0)
TEST_ERROR;
- /* Create the dset2 */
- if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if(H5Fclose(file) < 0)
+ TEST_ERROR;
+
+ /* Open the file with backing store on for read and write.
+ * Changes will be saved in file. */
+ if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
+ TEST_ERROR;
+
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR;
+
+ /* Create the dset1 */
+ if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
- if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0)
+ if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
- if(H5Dclose(dset2) < 0)
+ if(H5Dclose(dset1) < 0)
TEST_ERROR;
- if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0)
+ if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /* Reallocate memory for reading buffer. */
+ HDassert(check);
+ HDfree(check);
+ if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
/* Read the data back from dset1 */
- if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0)
+ if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i = 0; i < DSET2_DIM; i++)
- if(wdata2[i] != rdata2[i]) {
- H5_FAILED();
- printf(" Read different values than written in data set 2.\n");
- printf(" At index %d\n", i);
- TEST_ERROR;
- } /* end if */
+ p1 = points;
+ p2 = check;
+ for(i = 0; i < DSET1_DIM1; i++)
+ for(j = 0; j < DSET1_DIM2; j++)
+ if(*p1++ != *p2++) {
+ H5_FAILED();
+ printf(" Read different values than written in data set 1.\n");
+ printf(" At index %d,%d\n", i, j);
+ TEST_ERROR;
+ } /* end if */
- if(H5Sclose(space1) < 0)
+ /* Check file size API */
+ if(H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+
+ /* There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable. */
+ if(file_size<64*KB || file_size>256*KB)
TEST_ERROR;
- if(H5Sclose(space2) < 0)
+
+ if(H5Sclose(space1) < 0)
TEST_ERROR;
- if(H5Dclose(dset2) < 0)
+ if(H5Dclose(dset1) < 0)
TEST_ERROR;
if(H5Fclose(file) < 0)
TEST_ERROR;
@@ -334,16 +355,13 @@ test_direct(void)
HDfree(check);
h5_cleanup(FILENAME, fapl);
+
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Pclose(fapl);
- H5Sclose(space1);
- H5Dclose(dset1);
- H5Sclose(space2);
- H5Dclose(dset2);
H5Fclose(file);
} H5E_END_TRY;
@@ -353,104 +371,110 @@ error:
HDfree(check);
return -1;
-#endif /*H5_HAVE_DIRECT*/
}
/*-------------------------------------------------------------------------
- * Function: test_core
+ * Function: test_direct
*
- * Purpose: Tests the file handle interface for CORE driver
+ * Purpose: Tests the file handle interface for DIRECT I/O driver
*
* Return: Success: 0
* Failure: -1
*
* Programmer: Raymond Lu
- * Tuesday, Sept 24, 2002
+ * Wednesday, 20 September 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
-test_core(void)
+test_direct(void)
{
+#ifdef H5_HAVE_DIRECT
hid_t file=(-1), fapl, access_fapl = -1;
+ hid_t dset1=-1, dset2=-1, space1=-1, space2=-1;
char filename[1024];
- void *fhandle=NULL;
+ int *fhandle=NULL;
hsize_t file_size;
- hbool_t use_write_tracking;
- size_t write_tracking_page_size;
+ hsize_t dims1[2], dims2[1];
+ size_t mbound;
+ size_t fbsize;
+ size_t cbsize;
int *points = NULL, *check = NULL, *p1, *p2;
- hid_t dset1=-1, space1=-1;
- hsize_t dims1[2];
+ int wdata2[DSET2_DIM] = {11,12,13,14};
+ int rdata2[DSET2_DIM];
int i, j, n;
+#endif /*H5_HAVE_DIRECT*/
- TESTING("CORE file driver");
+ TESTING("DIRECT I/O file driver");
- /* Set property list and file name for CORE driver */
+#ifndef H5_HAVE_DIRECT
+ SKIPPED();
+ return 0;
+#else /*H5_HAVE_DIRECT*/
+
+ h5_reset();
+
+ /* Set property list and file name for Direct driver. Set memory alignment boundary
+ * and file block size to 512 which is the minimum for Linux 2.6. */
fapl = h5_fileaccess();
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
+ if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
TEST_ERROR;
- if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0)
+ h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
+
+ /* Verify the file access properties */
+ if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0)
+ TEST_ERROR;
+ if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE)
TEST_ERROR;
- h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0)
TEST_ERROR;
+ H5E_BEGIN_TRY {
+ file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ } H5E_END_TRY;
+ if(file<0) {
+ H5Pclose (fapl);
+ SKIPPED();
+ printf(" Probably the file system doesn't support Direct I/O\n");
+ return 0;
+ }
+
/* Retrieve the access property list... */
if ((access_fapl = H5Fget_access_plist(file)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_CORE != H5Pget_driver(access_fapl))
- TEST_ERROR;
-
- /* Check that the backing store write tracking info was saved */
- if(H5Pget_core_write_tracking(fapl, &use_write_tracking, &write_tracking_page_size) < 0)
- TEST_ERROR;
- if(TRUE != use_write_tracking)
- TEST_ERROR;
- if(CORE_PAGE_SIZE != write_tracking_page_size)
+ if(H5FD_DIRECT != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle) < 0)
+ /* Check file handle API */
+ if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
+ TEST_ERROR;
+ if(*fhandle<0)
TEST_ERROR;
- if(fhandle==NULL)
- {
- printf("fhandle==NULL\n");
- TEST_ERROR;
- }
/* Check file size API */
if(H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
- /* There is no garantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. Why is this 4KB?
+ /* There is no guarantee of the number of metadata allocations, but it's
+ * 4 currently and the size of the file should be between 3 & 4 file buffer
+ * sizes..
*/
- if(file_size<2*KB || file_size>6*KB)
- TEST_ERROR;
-
- if(H5Fclose(file) < 0)
- TEST_ERROR;
-
-
- /* Open the file with backing store off for read and write.
- * Changes won't be saved in file. */
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0)
- TEST_ERROR;
-
- if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if(file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4))
TEST_ERROR;
- /* Allocate memory for data set. */
- if(NULL == (points = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including
+ * memory address, size of data, and file address. */
+ if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
- if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
/* Initialize the dset1 */
@@ -493,71 +517,48 @@ test_core(void)
printf(" Read different values than written in data set 1.\n");
printf(" At index %d,%d\n", i, j);
TEST_ERROR;
- } /* end if */
-
- if(H5Dclose(dset1) < 0)
- TEST_ERROR;
-
- if(H5Fclose(file) < 0)
- TEST_ERROR;
-
- /* Open the file with backing store on for read and write.
- * Changes will be saved in file. */
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
- TEST_ERROR;
+ } /* end if */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ /* Create the data space2. For data set 2, memory address and data size are not aligned. */
+ dims2[0] = DSET2_DIM;
+ if((space2 = H5Screate_simple(1, dims2, NULL)) < 0)
TEST_ERROR;
- /* Create the dset1 */
- if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ /* Create the dset2 */
+ if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
- if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
- TEST_ERROR;
-
- if(H5Dclose(dset1) < 0)
+ if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0)
TEST_ERROR;
- if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if(H5Dclose(dset2) < 0)
TEST_ERROR;
- /* Reallocate memory for reading buffer. */
- HDassert(check);
- HDfree(check);
- if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
- if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
+ if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- p1 = points;
- p2 = check;
- for(i = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- if(*p1++ != *p2++) {
- H5_FAILED();
- printf(" Read different values than written in data set 1.\n");
- printf(" At index %d,%d\n", i, j);
- TEST_ERROR;
- } /* end if */
-
- /* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
- TEST_ERROR;
-
- /* There is no garantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. */
- if(file_size<64*KB || file_size>256*KB)
- TEST_ERROR;
+ for(i = 0; i < DSET2_DIM; i++)
+ if(wdata2[i] != rdata2[i]) {
+ H5_FAILED();
+ printf(" Read different values than written in data set 2.\n");
+ printf(" At index %d\n", i);
+ TEST_ERROR;
+ } /* end if */
if(H5Sclose(space1) < 0)
TEST_ERROR;
if(H5Dclose(dset1) < 0)
TEST_ERROR;
+ if(H5Sclose(space2) < 0)
+ TEST_ERROR;
+ if(H5Dclose(dset2) < 0)
+ TEST_ERROR;
if(H5Fclose(file) < 0)
TEST_ERROR;
HDassert(points);
@@ -566,13 +567,16 @@ test_core(void)
HDfree(check);
h5_cleanup(FILENAME, fapl);
-
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Pclose(fapl);
+ H5Sclose(space1);
+ H5Dclose(dset1);
+ H5Sclose(space2);
+ H5Dclose(dset2);
H5Fclose(file);
} H5E_END_TRY;
@@ -582,6 +586,7 @@ error:
HDfree(check);
return -1;
+#endif /*H5_HAVE_DIRECT*/
}
@@ -685,6 +690,8 @@ test_family(void)
TESTING("FAMILY file driver");
+ h5_reset();
+
/* Set property list and file name for FAMILY driver */
fapl = h5_fileaccess();
@@ -846,6 +853,8 @@ test_family_compat(void)
TESTING("FAMILY file driver backward compatibility");
+ h5_reset();
+
/* Set property list and file name for FAMILY driver */
fapl = h5_fileaccess();
@@ -982,6 +991,9 @@ test_multi(void)
int buf[MULTI_SIZE][MULTI_SIZE];
TESTING("MULTI file driver");
+
+ h5_reset();
+
/* Set file access property list for MULTI driver */
fapl = h5_fileaccess();
@@ -1194,6 +1206,8 @@ test_multi_compat(void)
TESTING("MULTI file driver backward compatibility");
+ h5_reset();
+
/* Set file access property list for MULTI driver */
fapl = h5_fileaccess();
@@ -1349,6 +1363,8 @@ test_log(void)
TESTING("LOG file driver");
+ h5_reset();
+
/* Set property list and file name for log driver. */
fapl = h5_fileaccess();
if(H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
@@ -1428,6 +1444,8 @@ test_stdio(void)
TESTING("STDIO file driver");
+ h5_reset();
+
/* Set property list and file name for STDIO driver. */
fapl = h5_fileaccess();
if(H5Pset_fapl_stdio(fapl) < 0)
@@ -1518,6 +1536,8 @@ test_windows(void)
#else /* H5_HAVE_WINDOWS */
+ h5_reset();
+
/* Set property list and file name for WINDOWS driver. */
fapl = h5_fileaccess();
if(H5Pset_fapl_windows(fapl) < 0)
@@ -1592,25 +1612,23 @@ main(void)
{
int nerrors = 0;
- h5_reset();
-
printf("Testing basic Virtual File Driver functionality.\n");
nerrors += test_sec2() < 0 ? 1 : 0;
nerrors += test_core() < 0 ? 1 : 0;
+ nerrors += test_direct() < 0 ? 1 : 0;
nerrors += test_family() < 0 ? 1 : 0;
nerrors += test_family_compat() < 0 ? 1 : 0;
nerrors += test_multi() < 0 ? 1 : 0;
nerrors += test_multi_compat() < 0 ? 1 : 0;
- nerrors += test_direct() < 0 ? 1 : 0;
nerrors += test_log() < 0 ? 1 : 0;
nerrors += test_stdio() < 0 ? 1 : 0;
nerrors += test_windows() < 0 ? 1 : 0;
if(nerrors) {
- printf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
- return 1;
+ printf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
+ nerrors, nerrors > 1 ? "S" : "");
+ return 1;
}
printf("All Virtual File Driver tests passed.\n");