summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-03-29 21:44:23 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-03-29 21:44:23 (GMT)
commitba2cfde1fda880bf9d4b18dd439100ee5c4680bb (patch)
treeb071863eb782a1ad32e161a60197f33e30cdf5be /test
parent096aac122ed6b6e8d07a30330bd95992887cd2be (diff)
downloadhdf5-ba2cfde1fda880bf9d4b18dd439100ee5c4680bb.zip
hdf5-ba2cfde1fda880bf9d4b18dd439100ee5c4680bb.tar.gz
hdf5-ba2cfde1fda880bf9d4b18dd439100ee5c4680bb.tar.bz2
Merge/port changes from develop back to 1.8 for tools and cmake
Diffstat (limited to 'test')
-rw-r--r--test/CMakeTests.cmake16
-rw-r--r--test/app_ref.c4
-rw-r--r--test/big.c16
-rw-r--r--test/cache.c4
-rw-r--r--test/cache_api.c207
-rw-r--r--test/cache_common.c12
-rw-r--r--test/dt_arith.c67
-rw-r--r--test/dtypes.c95
-rw-r--r--test/efc.c2
-rw-r--r--test/err_compat.c3
-rw-r--r--test/error_test.c2
-rw-r--r--test/file_image.c19
-rw-r--r--test/freespace.c2
-rw-r--r--test/h5test.c419
-rw-r--r--test/h5test.h47
-rw-r--r--test/mf.c2
-rw-r--r--test/plugin.c632
-rw-r--r--test/set_extent.c3
-rw-r--r--test/vfd.c149
19 files changed, 1132 insertions, 569 deletions
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index 5fbde25..e8b4bec 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -145,7 +145,7 @@ endif ()
add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list})
if (BUILD_SHARED_LIBS AND TEST_SHARED_PROGRAMS)
add_custom_target(HDF5_TEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_TEST_LIBSH tests" DEPENDS ${HDF5_TEST_LIBSH_files_list})
-endif()
+endif ()
# Remove any output file left over from previous test run
add_test (NAME H5TEST-clear-testhdf5-objects
@@ -776,7 +776,7 @@ if (HDF5_TEST_VFD)
endif ()
# Windows only macro
- MACRO (CHECK_VFD_TEST vfdtest vfdname resultcode)
+ macro (CHECK_VFD_TEST vfdtest vfdname resultcode)
if (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2")
if (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split")
if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug)
@@ -819,7 +819,7 @@ if (HDF5_TEST_VFD)
COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-shared"
)
endif ()
- endif()
+ endif ()
else ()
add_test (NAME VFD-${vfdname}-${vfdtest}
COMMAND "${CMAKE_COMMAND}"
@@ -884,9 +884,9 @@ if (HDF5_TEST_VFD)
)
endif ()
endif ()
- ENDMACRO ()
+ endmacro ()
- MACRO (ADD_VFD_TEST vfdname resultcode)
+ macro (ADD_VFD_TEST vfdname resultcode)
foreach (test ${H5_VFD_TESTS})
if (WIN32)
CHECK_VFD_TEST (${test} ${vfdname} ${resultcode})
@@ -979,7 +979,7 @@ if (HDF5_TEST_VFD)
)
endif ()
endif ()
- ENDMACRO ()
+ endmacro ()
# Run test with different Virtual File Driver
foreach (vfd ${VFD_LIST})
@@ -995,13 +995,13 @@ endif ()
##############################################################################
if (HDF5_BUILD_GENERATORS)
- MACRO (ADD_H5_GENERATOR genfile)
+ macro (ADD_H5_GENERATOR genfile)
add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c)
TARGET_NAMING (${genfile} STATIC)
TARGET_C_PROPERTIES (${genfile} STATIC " " " ")
target_link_libraries (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (${genfile} PROPERTIES FOLDER generator/test)
- ENDMACRO ()
+ endmacro ()
# generator executables
set (H5_GENERATORS
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..9ac4316 100644
--- a/test/big.c
+++ b/test/big.c
@@ -120,7 +120,7 @@ static hsize_t values_used[WRT_N];
static hsize_t
randll(hsize_t limit, int current_index)
{
- hsize_t acc;
+ hsize_t acc = 0;
int overlap = 1;
int i;
int tries = 0;
@@ -508,7 +508,7 @@ reader(char *filename, hid_t fapl)
if('#' != ln[0])
break;
i = (int)HDstrtol(ln + 1, &s, 10);
- hs_offset[0] = HDstrtoll(s, NULL, 0);
+ hs_offset[0] = HDstrtoull(s, NULL, 0);
HDfprintf(stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], "");
HDfflush(stdout);
@@ -618,8 +618,8 @@ test_sec2(hid_t fapl)
quit:
/* End with normal return code */
/* Clean up the test file */
- if(h5_cleanup(FILENAME, fapl))
- HDremove(DNAME);
+ h5_clean_files(FILENAME, fapl);
+ HDremove(DNAME);
return 0;
error:
@@ -655,8 +655,8 @@ test_stdio(hid_t fapl)
quit:
/* End with normal return code */
/* Clean up the test file */
- if(h5_cleanup(FILENAME, fapl))
- HDremove(DNAME);
+ h5_clean_files(FILENAME, fapl);
+ HDremove(DNAME);
HDfflush(stdout);
return 0;
@@ -716,8 +716,8 @@ test_family(hid_t fapl)
quit:
/* End with normal return code */
/* Clean up the test file */
- if(h5_cleanup(FILENAME, fapl))
- HDremove(DNAME);
+ h5_clean_files(FILENAME, fapl);
+ HDremove(DNAME);
return 0;
error:
diff --git a/test/cache.c b/test/cache.c
index df6d805..c0bfbe2 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -19,10 +19,6 @@
* This file contains tests for the cache implemented in
* H5C.c
*/
-#include "H5private.h" /* Put this first, so H5open() isn't invoked in public macros */
-#include "h5test.h"
-#include "H5Iprivate.h"
-#include "H5ACprivate.h"
#include "cache_common.h"
diff --git a/test/cache_api.c b/test/cache_api.c
index 8f556be..1a826db 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -20,11 +20,9 @@
* with the cache implemented in H5C.c
*/
-#include "h5test.h"
-#include "H5Iprivate.h"
-#include "H5ACprivate.h"
#include "cache_common.h"
+/* extern declarations */
/* global variable declarations: */
@@ -50,19 +48,19 @@ static void check_file_mdc_api_errs(void);
/**************************************************************************/
/*-------------------------------------------------------------------------
- * Function: check_fapl_mdc_api_calls()
+ * Function: check_fapl_mdc_api_calls()
*
- * Purpose: Verify that the file access property list related
- * metadata cache related API calls are functioning
- * correctly.
+ * Purpose: Verify that the file access property list related
+ * metadata cache related API calls are functioning
+ * correctly.
*
- * Since we have tested the H5C code elsewhere, it should
- * be sufficient to verify that the desired configuration
- * data is getting to the cache.
+ * Since we have tested the H5C code elsewhere, it should
+ * be sufficient to verify that the desired configuration
+ * data is getting to the cache.
*
* Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 4/12/04
*
*-------------------------------------------------------------------------
@@ -131,13 +129,13 @@ check_fapl_mdc_api_calls(void)
if ( pass ) {
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if ( fapl_id < 0 ) {
+ if ( fapl_id < 0 ) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
- }
+ }
}
if ( pass ) {
@@ -149,7 +147,7 @@ check_fapl_mdc_api_calls(void)
if ( result < 0 ) {
pass = FALSE;
- failure_mssg = "H5Pget_mdc_config() failed.\n";
+ failure_mssg = "H5Pget_mdc_config() failed.\n";
} else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)) {
@@ -170,7 +168,7 @@ check_fapl_mdc_api_calls(void)
if ( result < 0 ) {
pass = FALSE;
- failure_mssg = "H5Pset_mdc_config() failed.\n";
+ failure_mssg = "H5Pset_mdc_config() failed.\n";
}
}
@@ -183,7 +181,7 @@ check_fapl_mdc_api_calls(void)
if ( result < 0 ) {
pass = FALSE;
- failure_mssg = "H5Pget_mdc_config() failed.\n";
+ failure_mssg = "H5Pget_mdc_config() failed.\n";
} else if ( ! CACHE_CONFIGS_EQUAL(mod_config, scratch, TRUE, TRUE) ) {
@@ -197,7 +195,7 @@ check_fapl_mdc_api_calls(void)
if ( H5Pclose(fapl_id) < 0 ) {
pass = FALSE;
- failure_mssg = "H5Pclose() failed.\n";
+ failure_mssg = "H5Pclose() failed.\n";
}
}
@@ -239,11 +237,11 @@ check_fapl_mdc_api_calls(void)
if ( file_ptr == NULL ) {
pass = FALSE;
- failure_mssg = "Can't get file_ptr.\n";
+ failure_mssg = "Can't get file_ptr.\n";
- } else {
+ } else {
- cache_ptr = file_ptr->shared->cache;
+ cache_ptr = file_ptr->shared->cache;
}
}
@@ -262,10 +260,9 @@ check_fapl_mdc_api_calls(void)
/* conpare the cache's internal configuration with the expected value */
if ( pass ) {
- if ( ! resize_configs_are_equal(&default_auto_size_ctl, \
+ if ( ! resize_configs_are_equal(&default_auto_size_ctl, \
&cache_ptr->resize_ctl, TRUE) ) {
-
pass = FALSE;
failure_mssg = "Unexpected value(s) in cache resize_ctl 1.\n";
}
@@ -295,7 +292,7 @@ check_fapl_mdc_api_calls(void)
if ( result < 0 ) {
pass = FALSE;
- failure_mssg = "H5Pget_mdc_config() failed.\n";
+ failure_mssg = "H5Pget_mdc_config() failed.\n";
} else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)) {
@@ -305,22 +302,22 @@ check_fapl_mdc_api_calls(void)
} else if ( H5Pclose(fapl_id) < 0 ) {
pass = FALSE;
- failure_mssg = "H5Pclose() failed.\n";
+ failure_mssg = "H5Pclose() failed.\n";
}
}
/* close the file and delete it */
if ( pass ) {
- if ( H5Fclose(file_id) < 0 ) {
+ if ( H5Fclose(file_id) < 0 ) {
pass = FALSE;
- failure_mssg = "H5Fclose() failed.\n";
+ failure_mssg = "H5Fclose() failed.\n";
} else if ( HDremove(filename) < 0 ) {
pass = FALSE;
- failure_mssg = "HDremove() failed.\n";
+ failure_mssg = "HDremove() failed.\n";
}
}
@@ -335,13 +332,13 @@ check_fapl_mdc_api_calls(void)
/* Create a FAPL */
if ( pass ) {
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if ( fapl_id < 0 ) {
+ if ( fapl_id < 0 ) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
- }
+ }
}
/* Modify the initial mdc configuration in the FAPL. */
@@ -353,7 +350,7 @@ check_fapl_mdc_api_calls(void)
if ( result < 0 ) {
pass = FALSE;
- failure_mssg = "H5Pset_mdc_config() failed.\n";
+ failure_mssg = "H5Pset_mdc_config() failed.\n";
}
}
@@ -388,7 +385,7 @@ check_fapl_mdc_api_calls(void)
if ( file_ptr == NULL ) {
pass = FALSE;
- failure_mssg = "Can't get file_ptr.\n";
+ failure_mssg = "Can't get file_ptr.\n";
} else {
@@ -411,10 +408,9 @@ check_fapl_mdc_api_calls(void)
/* conpare the cache's internal configuration with the expected value */
if ( pass ) {
- if ( ! resize_configs_are_equal(&mod_auto_size_ctl, \
+ if ( ! resize_configs_are_equal(&mod_auto_size_ctl, \
&cache_ptr->resize_ctl, TRUE) ) {
-
pass = FALSE;
failure_mssg = "Unexpected value(s) in cache resize_ctl 2.\n";
}
@@ -444,7 +440,7 @@ check_fapl_mdc_api_calls(void)
if ( result < 0 ) {
pass = FALSE;
- failure_mssg = "H5Pget_mdc_config() failed.\n";
+ failure_mssg = "H5Pget_mdc_config() failed.\n";
} else if ( ! CACHE_CONFIGS_EQUAL(mod_config, scratch, TRUE, TRUE) ) {
@@ -454,7 +450,7 @@ check_fapl_mdc_api_calls(void)
} else if ( H5Pclose(test_fapl_id) < 0 ) {
pass = FALSE;
- failure_mssg = "H5Pclose() failed.\n";
+ failure_mssg = "H5Pclose() failed.\n";
}
}
@@ -464,22 +460,22 @@ check_fapl_mdc_api_calls(void)
if ( H5Pclose(fapl_id) < 0 ) {
pass = FALSE;
- failure_mssg = "H5Pclose() failed.\n";
+ failure_mssg = "H5Pclose() failed.\n";
}
}
/* close the file and delete it */
if ( pass ) {
- if ( H5Fclose(file_id) < 0 ) {
+ if ( H5Fclose(file_id) < 0 ) {
pass = FALSE;
- failure_mssg = "H5Fclose() failed.\n";
+ failure_mssg = "H5Fclose() failed.\n";
} else if ( HDremove(filename) < 0 ) {
pass = FALSE;
- failure_mssg = "HDremove() failed.\n";
+ failure_mssg = "HDremove() failed.\n";
}
}
@@ -493,26 +489,24 @@ check_fapl_mdc_api_calls(void)
/*-------------------------------------------------------------------------
- * Function: check_file_mdc_api_calls()
+ * Function: check_file_mdc_api_calls()
*
- * Purpose: Verify that the file related metadata cache API calls are
- * functioning correctly.
+ * Purpose: Verify that the file related metadata cache API calls are
+ * functioning correctly.
*
- * Since we have tested the H5C code elsewhere, it should
- * be sufficient to verify that the desired configuration
- * data is getting in and out of the cache. Similarly,
- * we need only verify that the cache monitoring calls
- * return the data that the cache thinks they should return.
- * We shouldn't need to verify data correctness beyond that
- * point.
+ * Since we have tested the H5C code elsewhere, it should
+ * be sufficient to verify that the desired configuration
+ * data is getting in and out of the cache. Similarly,
+ * we need only verify that the cache monitoring calls
+ * return the data that the cache thinks they should return.
+ * We shouldn't need to verify data correctness beyond that
+ * point.
*
* Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 4/14/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -821,15 +815,15 @@ check_file_mdc_api_calls(void)
/* close the file and delete it */
if ( pass ) {
- if ( H5Fclose(file_id) < 0 ) {
+ if ( H5Fclose(file_id) < 0 ) {
pass = FALSE;
- failure_mssg = "H5Fclose() failed.\n";
+ failure_mssg = "H5Fclose() failed.\n";
} else if ( HDremove(filename) < 0 ) {
pass = FALSE;
- failure_mssg = "HDremove() failed.\n";
+ failure_mssg = "HDremove() failed.\n";
}
}
@@ -845,17 +839,16 @@ check_file_mdc_api_calls(void)
/*-------------------------------------------------------------------------
* Function: mdc_api_call_smoke_check()
*
- * Purpose:
- *
- * Return: void
+ * Purpose: Initial basic functional test to see if there are problems
+ * with the cache API calls.
*
- * Programmer: John Mainzer
- * 4/14/04
+ * NOTE: This test takes some time to run and checks the
+ * HDF5TestExpress environment variable.
*
- * Modifications:
+ * Return: void
*
- * JRM -- 7/12/06
- * Added progress reporting code.
+ * Programmer: John Mainzer
+ * 4/14/04
*
*-------------------------------------------------------------------------
*/
@@ -880,7 +873,7 @@ mdc_api_call_smoke_check(int express_test)
hid_t filespace_ids[NUM_DSETS];
hid_t memspace_id = -1;
hid_t dataset_ids[NUM_DSETS];
- hid_t properties;
+ hid_t properties = -1;
char dset_name[64];
int i, j, k, l, m, n;
herr_t status;
@@ -1105,7 +1098,7 @@ mdc_api_call_smoke_check(int express_test)
sprintf(dset_name, "/dset%03d", i);
dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE,
- dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT);
+ dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT);
if ( dataset_ids[i] < 0 ) {
@@ -1329,9 +1322,9 @@ mdc_api_call_smoke_check(int express_test)
}
n++;
-
}
+
/* close the file spaces we are done with */
i = 1;
while ( ( pass ) && ( i < NUM_DSETS ) )
@@ -1450,7 +1443,6 @@ mdc_api_call_smoke_check(int express_test)
}
n++;
-
}
/* close file space 0 */
@@ -1496,16 +1488,16 @@ mdc_api_call_smoke_check(int express_test)
/* close the file and delete it */
if ( pass ) {
- if ( H5Fclose(file_id) < 0 ) {
+ if ( H5Fclose(file_id) < 0 ) {
pass = FALSE;
- failure_mssg = "H5Fclose() failed.\n";
+ failure_mssg = "H5Fclose() failed.\n";
}
else if ( HDremove(filename) < 0 ) {
pass = FALSE;
- failure_mssg = "HDremove() failed.\n";
+ failure_mssg = "HDremove() failed.\n";
}
}
@@ -3000,18 +2992,16 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] =
/*-------------------------------------------------------------------------
- * Function: check_fapl_mdc_api_errs()
+ * Function: check_fapl_mdc_api_errs()
*
- * Purpose: Verify that the FAPL related MDC API calls reject input
- * errors gracefully.
+ * Purpose: Verify that the FAPL related MDC API calls reject input
+ * errors gracefully.
*
* Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 4/19/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -3030,7 +3020,6 @@ check_fapl_mdc_api_errs(void)
pass = TRUE;
-
/* first test H5Pget_mdc_config().
*/
@@ -3038,8 +3027,8 @@ check_fapl_mdc_api_errs(void)
if ( pass ) {
H5E_BEGIN_TRY {
- result = H5Pget_mdc_config((hid_t)-1, &scratch);
- } H5E_END_TRY;
+ result = H5Pget_mdc_config((hid_t)-1, &scratch);
+ } H5E_END_TRY;
if ( result >= 0 ) {
@@ -3065,7 +3054,7 @@ check_fapl_mdc_api_errs(void)
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
if ( ( pass ) &&
- ( ( H5Pget_mdc_config(fapl_id, &scratch) < 0 ) ||
+ ( ( H5Pget_mdc_config(fapl_id, &scratch) < 0) ||
( !CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE) ) ) ) {
pass = FALSE;
@@ -3171,18 +3160,16 @@ check_fapl_mdc_api_errs(void)
/*-------------------------------------------------------------------------
- * Function: check_file_mdc_api_errs()
+ * Function: check_file_mdc_api_errs()
*
- * Purpose: Verify that the file related MDC API calls reject input
- * errors gracefully.
+ * Purpose: Verify that the file related MDC API calls reject input
+ * errors gracefully.
*
* Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 4/19/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -3215,7 +3202,7 @@ check_file_mdc_api_errs(void)
/* setup the file name */
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: calling h5_fixname().\n", fcn_name);
}
@@ -3230,7 +3217,7 @@ check_file_mdc_api_errs(void)
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: calling H5Fcreate().\n", fcn_name);
}
@@ -3252,7 +3239,7 @@ check_file_mdc_api_errs(void)
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 1.\n", fcn_name);
}
@@ -3270,7 +3257,7 @@ check_file_mdc_api_errs(void)
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 2.\n", fcn_name);
}
@@ -3289,7 +3276,7 @@ check_file_mdc_api_errs(void)
scratch.version = -1; /* a convenient, invalid value */
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 3.\n", fcn_name);
}
@@ -3311,7 +3298,7 @@ check_file_mdc_api_errs(void)
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 1.\n", fcn_name);
}
@@ -3329,7 +3316,7 @@ check_file_mdc_api_errs(void)
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 2.\n", fcn_name);
}
@@ -3348,7 +3335,7 @@ check_file_mdc_api_errs(void)
i = 0;
while ( ( pass ) && ( i < NUM_INVALID_CONFIGS ) )
{
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout,
"%s: testing H5Fset_mdc_config() with invalid config %d.\n",
@@ -3378,7 +3365,7 @@ check_file_mdc_api_errs(void)
/* test H5Fget_mdc_hit_rate() */
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n",
fcn_name);
@@ -3397,7 +3384,7 @@ check_file_mdc_api_errs(void)
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n",
fcn_name);
@@ -3418,7 +3405,7 @@ check_file_mdc_api_errs(void)
/* test H5Freset_mdc_hit_rate_stats() */
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n",
fcn_name);
@@ -3440,7 +3427,7 @@ check_file_mdc_api_errs(void)
/* test H5Fget_mdc_size() */
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 1.\n", fcn_name);
}
@@ -3459,7 +3446,7 @@ check_file_mdc_api_errs(void)
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 2.\n", fcn_name);
}
@@ -3481,7 +3468,7 @@ check_file_mdc_api_errs(void)
/* close the file and delete it */
if ( pass ) {
- if ( show_progress ) {
+ if ( show_progress ) {
HDfprintf(stdout, "%s: cleaning up from tests.\n", fcn_name);
}
@@ -3508,22 +3495,17 @@ check_file_mdc_api_errs(void)
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Run tests on the cache code contained in H5C.c
+ * Purpose: Run tests on the cache code contained in H5C.c
*
* Return: Success:
*
- * Failure:
- *
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 6/24/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
int
main(void)
{
@@ -3552,3 +3534,4 @@ main(void)
return(0);
} /* main() */
+
diff --git a/test/cache_common.c b/test/cache_common.c
index 5fe68db..6ca3d9f 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -20,9 +20,6 @@
* implemented in H5C.c
*/
#include "H5private.h" /* Put this first, so H5open() isn't invoked in public macros */
-#include "h5test.h"
-#include "H5Cprivate.h"
-#include "H5Iprivate.h"
#include "H5MFprivate.h"
#include "cache_common.h"
@@ -338,8 +335,7 @@ static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr,
-
-/* address translation funtions: */
+/* address translation functions: */
/*-------------------------------------------------------------------------
@@ -357,8 +353,8 @@ static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr,
*/
void
addr_to_type_and_index(haddr_t addr,
- int32_t * type_ptr,
- int32_t * index_ptr)
+ int32_t *type_ptr,
+ int32_t *index_ptr)
{
int i;
int32_t type;
@@ -1577,7 +1573,7 @@ entry_in_cache(H5C_t * cache_ptr,
/*-------------------------------------------------------------------------
* Function: reset_entries
*
- * Purpose: reset the contents of the entries arrays to know values.
+ * Purpose: reset the contents of the entries arrays to known values.
*
* Return: void
*
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 4337690..8396d38 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -20,8 +20,6 @@
* Purpose: Tests the data type interface (H5T)
*/
-#include <math.h>
-#include <time.h>
#include "h5test.h"
/* Number of elements in each random test */
@@ -645,11 +643,18 @@ test_hard_query(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;
} /* end test_hard_query() */
@@ -871,7 +876,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 +1299,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 +1318,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 +1610,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 +1628,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 +2628,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 +2641,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 +3344,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 +3370,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)
@@ -4506,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;
@@ -4520,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)
@@ -5168,6 +5219,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 */
@@ -5183,8 +5238,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");
diff --git a/test/dtypes.c b/test/dtypes.c
index 7c2ad7b..e06c81f 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -20,8 +20,6 @@
* Purpose: Tests the datatype interface (H5T)
*/
-#include <math.h>
-#include <time.h>
#include "h5test.h"
#include "H5srcdir.h"
#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
@@ -769,11 +767,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 +895,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 +1030,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 +1249,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 +1396,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 +4268,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 +4284,11 @@ error:
if(buf)
HDfree(buf);
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
reset_hdf5();
+
return 1;
}
@@ -4304,7 +4351,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 +4469,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 +4545,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 +4716,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 +4849,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;
}
@@ -7423,8 +7495,10 @@ 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();
+
nerrors += test_conv_str_1();
nerrors += test_conv_str_2();
nerrors += test_conv_str_3();
@@ -7452,6 +7526,7 @@ main(void)
nerrors += test_opaque();
nerrors += test_set_order();
nerrors += test_utf_ascii_conv();
+
if(nerrors) {
printf("***** %lu FAILURE%s! *****\n",
nerrors, 1==nerrors?"":"S");
diff --git a/test/efc.c b/test/efc.c
index ff4f738..167308f 100644
--- a/test/efc.c
+++ b/test/efc.c
@@ -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 64f301d..ee181b1 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/file_image.c b/test/file_image.c
index b1b9d47..d9c782a 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,7 @@ 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.");
+ h5_clean_files(FILENAME2, fapl);
/* discard the image buffer if it exists */
if(image_ptr != NULL)
@@ -1039,8 +1038,7 @@ 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.");
+ h5_clean_files(FILENAME2, fapl_id);
/* discard the image buffer if it exists */
if(image_ptr != NULL)
@@ -1145,8 +1143,7 @@ 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.");
+ h5_clean_files(FILENAME2, fapl_id);
/************************** Test #3 **********************************/
/* set up a split file driver test file, and try to get its image
@@ -1208,8 +1205,7 @@ 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.");
+ h5_clean_files(FILENAME2, fapl_id);
/************************** Test #4 **********************************/
/* set up a family file driver test file, and try to get its image
@@ -1269,8 +1265,7 @@ 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.");
+ h5_clean_files(FILENAME2, fapl_id);
PASSED();
@@ -1340,6 +1335,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/freespace.c b/test/freespace.c
index 1338ae7..f82c1f6 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -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/h5test.c b/test/h5test.c
index 4d841f1..188c12f 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -22,8 +22,7 @@
*/
#undef NDEBUG /*override -DNDEBUG */
-#include <sys/types.h>
-#include <sys/stat.h>
+
#include "h5test.h"
#include "H5srcdir.h"
@@ -75,7 +74,7 @@ char *paraprefix = NULL; /* for command line option para-prefix */
MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
#endif
-#define READ_BUF_SIZE 4096
+#define READ_BUF_SIZE 65536
/*
* These are the letters that are appended to the file name when generating
@@ -91,6 +90,12 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
*/
static const char *multi_letters = "msbrglo";
+/* Length of multi-file VFD filename buffers */
+#define H5TEST_MULTI_FILENAME_LEN 1024
+
+/* 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,77 +125,228 @@ 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.
+ * Purpose: Cleanup temporary test files (always).
* 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.
+ * Return: void
*
- * Programmer: Albert Cheng
- * May 28, 1998
+ * Programmer: Neil Fortner
+ * June 1, 2015
*
*-------------------------------------------------------------------------
*/
-int
-h5_cleanup(const char *base_name[], hid_t fapl)
+void
+h5_clean_files(const char *base_name[], hid_t fapl)
{
- int retval = 0;
+ int i;
- if(GetTestCleanup()) {
- int i;
+ for(i = 0; base_name[i]; i++) {
+ char filename[1024];
+ char temp[2048];
+ hid_t driver;
+
+ if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename)))
+ continue;
- for(i = 0; base_name[i]; i++) {
- char filename[1024];
- char temp[2048];
- hid_t driver;
+ driver = H5Pget_driver(fapl);
- if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename)))
- continue;
+ if(driver == H5FD_FAMILY) {
+ int j;
- driver = H5Pget_driver(fapl);
+ for(j = 0; /*void*/; j++) {
+ HDsnprintf(temp, sizeof temp, filename, j);
- if(driver == H5FD_FAMILY) {
- int j;
+ if(HDaccess(temp, F_OK) < 0)
+ break;
- for(j = 0; /*void*/; j++) {
- HDsnprintf(temp, sizeof temp, filename, j);
+ HDremove(temp);
+ } /* end for */
+ } else if(driver == H5FD_CORE) {
+ hbool_t backing; /* Whether the core file has backing store */
- if(HDaccess(temp, F_OK) < 0)
- break;
+ H5Pget_fapl_core(fapl, NULL, &backing);
- HDremove(temp);
- } /* end for */
- } else if(driver == H5FD_CORE) {
- hbool_t backing; /* Whether the core file has backing store */
+ /* If the file was stored to disk with bacing store, remove it */
+ if(backing)
+ HDremove(filename);
+ } else if (driver == H5FD_MULTI) {
+ H5FD_mem_t mt;
- H5Pget_fapl_core(fapl, NULL, &backing);
+ HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
- /* If the file was stored to disk with bacing store, remove it */
- if(backing)
- HDremove(filename);
- } else if (driver == H5FD_MULTI) {
- H5FD_mem_t mt;
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]);
+ HDremove(temp); /*don't care if it fails*/
+ } /* end for */
+ } else {
+ HDremove(filename);
+ }
+ } /* end for */
- HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
+ /* Close the FAPL used to access the file */
+ H5Pclose(fapl);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
- HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]);
- HDremove(temp); /*don't care if it fails*/
- } /* end for */
- } else {
- HDremove(filename);
- }
+ return;
+} /* end h5_clean_files() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5_delete_test_file
+ *
+ * Purpose Clean up temporary test files.
+ *
+ * When a test calls h5_fixname() to get a VFD-dependent
+ * test file name, this function can be used to clean it up.
+ *
+ * Return: void
+ *
+ * Since this is a cleanup file, we don't care if it fails.
+ *
+ * Programmer: Dana Robinson
+ * February 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+h5_delete_test_file(const char *base_name, hid_t fapl)
+{
+ char filename[1024]; /* VFD-dependent filename to delete */
+ char sub_filename[2048]; /* sub-files in multi & family VFDs */
+ hid_t driver = -1; /* VFD ID */
+
+ /* Get the VFD-dependent filename */
+ if(NULL == h5_fixname(base_name, fapl, filename, sizeof(filename)))
+ return;
+
+ driver = H5Pget_driver(fapl);
+
+ if(driver == H5FD_FAMILY) {
+ int j;
+ for(j = 0; /*void*/; j++) {
+ HDsnprintf(sub_filename, sizeof(sub_filename), filename, j);
+
+ /* If we can't access the file, it probably doesn't exist
+ * and we are done deleting the sub-files.
+ */
+ if(HDaccess(sub_filename, F_OK) < 0)
+ break;
+
+ HDremove(sub_filename);
+ } /* end for */
+ } else if(driver == H5FD_CORE) {
+ hbool_t backing; /* Whether the core file has backing store */
+
+ H5Pget_fapl_core(fapl, NULL, &backing);
+
+ /* If the file was stored to disk with bacing store, remove it */
+ if(backing)
+ HDremove(filename);
+ } else if (driver == H5FD_MULTI) {
+ H5FD_mem_t mt;
+
+ HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
+
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]);
+ HDremove(sub_filename);
} /* end for */
+ } else {
+ HDremove(filename);
+ } /* end if */
+
+ return;
+} /* end h5_delete_test_file() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5_delete_all_test_files
+ *
+ * Purpose Clean up temporary test files.
+ *
+ * When a test calls h5_fixname() get a VFD-dependent
+ * test file name, this function can be used to clean it up.
+ *
+ * This function takes an array of filenames that ends with
+ * a NULL string and cleans them all.
+ *
+ * Return: void
+ *
+ * Since this is a cleanup file, we don't care if it fails.
+ *
+ * Programmer: Dana Robinson
+ * February 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+h5_delete_all_test_files(const char *base_name[], hid_t fapl)
+{
+ int i; /* iterator */
+
+ for(i = 0; base_name[i]; i++) {
+ h5_delete_test_file(base_name[i], fapl);
+ } /* end for */
+
+ return;
+} /* end h5_delete_all_test_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;
+
+ if(GetTestCleanup()) {
+ /* Clean up files in base_name, and the FAPL */
+ h5_clean_files(base_name, fapl);
retval = 1;
} /* end if */
- H5Pclose(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 +368,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 +393,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 */
@@ -528,30 +688,27 @@ h5_rmprefix(const char *filename)
const char *ret_ptr;
if ((ret_ptr = HDstrstr(filename, ":")) == NULL)
- ret_ptr = filename;
+ ret_ptr = filename;
else
- ret_ptr++;
+ ret_ptr++;
return(ret_ptr);
}
/*-------------------------------------------------------------------------
- * Function: h5_fileaccess
- *
- * Purpose: Returns a file access template which is the default template
- * but with a file driver set according to the constant or
- * environment variable HDF5_DRIVER
+ * Function: h5_fileaccess
*
- * Return: Success: A file access property list
+ * Purpose: Returns a file access template which is the default template
+ * but with a file driver set according to the constant or
+ * environment variable HDF5_DRIVER
*
- * Failure: -1
+ * Return: Success: A file access property list
+ * Failure: -1
*
* Programmer: Robb Matzke
* Thursday, November 19, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -559,50 +716,61 @@ h5_fileaccess(void)
{
const char *val = NULL;
const char *name;
- char s[1024];
- hid_t fapl = -1;
+ char s[1024];
+ hid_t fapl = -1;
/* First use the environment variable, then the constant */
val = HDgetenv("HDF5_DRIVER");
#ifdef HDF5_DRIVER
- if (!val)
+ if(!val)
val = HDF5_DRIVER;
#endif
- if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0)
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
- if (!val || !*val)
- return fapl; /*use default*/
+ if(!val || !*val)
+ return fapl; /* use default */
HDstrncpy(s, val, sizeof s);
s[sizeof(s)-1] = '\0';
- if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl;
+ if(NULL == (name = HDstrtok(s, " \t\n\r")))
+ return fapl;
- if (!HDstrcmp(name, "sec2")) {
+ if(!HDstrcmp(name, "sec2")) {
/* Unix read() and write() system calls */
- if (H5Pset_fapl_sec2(fapl)<0) return -1;
- } else if (!HDstrcmp(name, "stdio")) {
+ if (H5Pset_fapl_sec2(fapl) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "stdio")) {
/* Standard C fread() and fwrite() system calls */
- if (H5Pset_fapl_stdio(fapl)<0) return -1;
- } else if (!HDstrcmp(name, "core")) {
+ if (H5Pset_fapl_stdio(fapl) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "core")) {
/* In-memory driver settings (backing store on, 1 MB increment) */
- if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1;
- } else if (!HDstrcmp(name, "core_paged")) {
+ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "core_paged")) {
/* In-memory driver with write tracking and paging on */
- if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1;
- if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)524288)<0) return -1;
- } else if (!HDstrcmp(name, "split")) {
+ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0)
+ return -1;
+ if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "split")) {
/* Split meta data and raw data each using default driver */
- if (H5Pset_fapl_split(fapl,
+ if(H5Pset_fapl_split(fapl,
"-m.h5", H5P_DEFAULT,
- "-r.h5", H5P_DEFAULT)<0)
+ "-r.h5", H5P_DEFAULT) < 0)
return -1;
- } else if (!HDstrcmp(name, "multi")) {
+ }
+ else if(!HDstrcmp(name, "multi")) {
/* Multi-file driver, general case of the split driver */
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl[H5FD_MEM_NTYPES];
const char *memb_name[H5FD_MEM_NTYPES];
- char sv[H5FD_MEM_NTYPES][1024];
+ char *sv[H5FD_MEM_NTYPES];
haddr_t memb_addr[H5FD_MEM_NTYPES];
H5FD_mem_t mt;
@@ -613,45 +781,52 @@ h5_fileaccess(void)
HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
- memb_fapl[mt] = H5P_DEFAULT;
- sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
+ memb_fapl[mt] = H5P_DEFAULT;
+ if(NULL == (sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN)))
+ return -1;
+ HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
} /* end for */
- if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name,
- memb_addr, FALSE)<0) {
+ if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
return -1;
- }
- } else if (!HDstrcmp(name, "family")) {
+
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ HDfree(sv[mt]);
+ }
+ else if(!HDstrcmp(name, "family")) {
hsize_t fam_size = 100*1024*1024; /*100 MB*/
/* Family of files, each 1MB and using the default driver */
- if ((val=HDstrtok(NULL, " \t\n\r")))
+ if((val = HDstrtok(NULL, " \t\n\r")))
fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024);
- if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
+ if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
return -1;
- } else if (!HDstrcmp(name, "log")) {
+ }
+ else if(!HDstrcmp(name, "log")) {
unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC;
/* Log file access */
- if ((val = HDstrtok(NULL, " \t\n\r")))
+ if((val = HDstrtok(NULL, " \t\n\r")))
log_flags = (unsigned)HDstrtol(val, NULL, 0);
-
- if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
+ if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
return -1;
- } else if (!HDstrcmp(name, "direct")) {
+ }
+ else if(!HDstrcmp(name, "direct")) {
#ifdef H5_HAVE_DIRECT
/* Linux direct read() and write() system calls. Set memory boundary, file block size,
* and copy buffer size to the default values. */
- if (H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0)
+ if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0)
return -1;
#endif
- } else if(!HDstrcmp(name, "latest")) {
+ }
+ else if(!HDstrcmp(name, "latest")) {
/* use the latest format */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
- } else {
+ }
+ else {
/* Unknown driver */
return -1;
}
@@ -1180,8 +1355,6 @@ getenv_all(MPI_Comm comm, int root, const char* name)
* Programmer: Larry Knox
* Monday, October 13, 2009
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -1189,24 +1362,44 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name)
{
int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
ssize_t nread; /* Number of bytes read in */
- char buf[READ_BUF_SIZE]; /* Buffer for copying data */
- const char *filename = H5_get_srcdir_filename(origfilename);; /* Get the test file name to copy */
+ void *buf = NULL; /* Buffer for copying data */
+ const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */
+
+ /* Allocate copy buffer */
+ if(NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE)))
+ goto error;
/* Copy old file into temporary file */
- if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) return -1;
- if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666))
- < 0) return -1;
+ if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0)
+ goto error;
+ if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
+ goto error;
/* Copy data */
while((nread = HDread(fd_old, buf, (size_t)READ_BUF_SIZE)) > 0)
- HDwrite(fd_new, buf, (size_t)nread);
-
+ if(HDwrite(fd_new, buf, (size_t)nread) < 0)
+ goto error;
+
/* Close files */
- if(HDclose(fd_old) < 0) return -1;
- if(HDclose(fd_new) < 0) return -1;
+ if(HDclose(fd_old) < 0)
+ goto error;
+ if(HDclose(fd_new) < 0)
+ goto error;
+
+ /* Release memory */
+ HDfree(buf);
return 0;
-}
+
+error:
+ /* ignore return values since we're already noted the problem */
+ if(fd_old > 0)
+ HDclose(fd_old);
+ if(fd_new > 0)
+ HDclose(fd_new);
+ HDfree(buf);
+ return -1;
+} /* end h5_make_local_copy() */
/*-------------------------------------------------------------------------
diff --git a/test/h5test.h b/test/h5test.h
index 19524a9..065c089 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -61,18 +61,18 @@
/* Should be used internally by the libtest.a only. */
#define HDGetTestVerbosity() (TestVerbosity)
-#define VERBOSE_NONE (HDGetTestVerbosity()==VERBO_NONE)
-#define VERBOSE_DEF (HDGetTestVerbosity()>=VERBO_DEF)
-#define VERBOSE_LO (HDGetTestVerbosity()>=VERBO_LO)
-#define VERBOSE_MED (HDGetTestVerbosity()>=VERBO_MED)
-#define VERBOSE_HI (HDGetTestVerbosity()>=VERBO_HI)
+#define VERBOSE_NONE (HDGetTestVerbosity()==VERBO_NONE)
+#define VERBOSE_DEF (HDGetTestVerbosity()>=VERBO_DEF)
+#define VERBOSE_LO (HDGetTestVerbosity()>=VERBO_LO)
+#define VERBOSE_MED (HDGetTestVerbosity()>=VERBO_MED)
+#define VERBOSE_HI (HDGetTestVerbosity()>=VERBO_HI)
/*
* Test controls definitions.
*/
-#define SKIPTEST 1 /* Skip this test */
-#define ONLYTEST 2 /* Do only this test */
-#define BEGINTEST 3 /* Skip all tests before this test */
+#define SKIPTEST 1 /* Skip this test */
+#define ONLYTEST 2 /* Do only this test */
+#define BEGINTEST 3 /* Skip all tests before this test */
/*
* This contains the filename prefix specificied as command line option for
@@ -86,8 +86,8 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
/*
* Print the current location on the standard output stream.
*/
-#define AT() printf (" at %s:%d in %s()...\n", \
- __FILE__, __LINE__, FUNC);
+#define AT() printf (" at %s:%d in %s()...\n", \
+ __FILE__, __LINE__, FUNC);
/*
* The name of the test is printed by saying TESTING("something") which will
@@ -98,12 +98,13 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
* spaces. If the h5_errors() is used for automatic error handling then
* the H5_FAILED() macro is invoked automatically when an API function fails.
*/
-#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);}
-#define TESTING_2(WHAT) {printf(" Testing %-62s",WHAT); fflush(stdout);}
-#define PASSED() {puts(" PASSED");fflush(stdout);}
-#define H5_FAILED() {puts("*FAILED*");fflush(stdout);}
-#define H5_WARNING() {puts("*WARNING*");fflush(stdout);}
-#define SKIPPED() {puts(" -SKIP-");fflush(stdout);}
+#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);}
+#define TESTING_2(WHAT) {printf(" Testing %-62s",WHAT); fflush(stdout);}
+#define PASSED() {puts(" PASSED");fflush(stdout);}
+#define H5_FAILED() {puts("*FAILED*");fflush(stdout);}
+#define H5_WARNING() {puts("*WARNING*");fflush(stdout);}
+#define SKIPPED() {puts(" -SKIP-");fflush(stdout);}
+#define PUTS_ERROR(s) {puts(s); AT(); goto error;}
#define TEST_ERROR {H5_FAILED(); AT(); goto error;}
#define STACK_ERROR {H5Eprint2(H5E_DEFAULT, stdout); goto error;}
#define FAIL_STACK_ERROR {H5_FAILED(); AT(); H5Eprint2(H5E_DEFAULT, stdout); \
@@ -113,9 +114,9 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
/*
* Alarm definitions to wait up (terminate) a test that runs too long.
*/
-#define H5_ALARM_SEC 1200 /* default is 20 minutes */
-#define ALARM_ON TestAlarmOn()
-#define ALARM_OFF HDalarm(0)
+#define H5_ALARM_SEC 1200 /* default is 20 minutes */
+#define ALARM_ON TestAlarmOn()
+#define ALARM_OFF HDalarm(0)
/*
* The methods to compare the equality of floating-point values:
@@ -140,13 +141,16 @@ extern "C" {
#endif
/* Generally useful testing routines */
+H5TEST_DLL void 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);
+H5TEST_DLL char *h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size);
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, ...);
@@ -156,13 +160,14 @@ H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl);
/* Routines for operating on the list of tests (for the "all in one" tests) */
H5TEST_DLL void TestUsage(void);
H5TEST_DLL void AddTest(const char *TheName, void (*TheCall) (void),
- void (*Cleanup) (void), const char *TheDescr,
- const void *Parameters);
+ void (*Cleanup) (void), const char *TheDescr,
+ const void *Parameters);
H5TEST_DLL void TestInfo(const char *ProgName);
H5TEST_DLL void TestParseCmdLine(int argc, char *argv[]);
H5TEST_DLL void PerformTests(void);
H5TEST_DLL void TestSummary(void);
H5TEST_DLL void TestCleanup(void);
+H5TEST_DLL void TestShutdown(void);
H5TEST_DLL void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]));
H5TEST_DLL int GetTestVerbosity(void);
H5TEST_DLL int SetTestVerbosity(int newval);
diff --git a/test/mf.c b/test/mf.c
index a252c2d..eb58beb 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -6246,6 +6246,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/plugin.c b/test/plugin.c
index 28c7c30..f0c0dd0 100644
--- a/test/plugin.c
+++ b/test/plugin.c
@@ -12,13 +12,11 @@
* to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu
- * 13 February 2013
+ * Programmer: Raymond Lu
+ * 13 February 2013
*
- * Purpose: Tests the plugin module (H5PL)
+ * Purpose: Tests the plugin module (H5PL)
*/
-#include <stdlib.h>
-#include <time.h>
#include "h5test.h"
#include "H5srcdir.h"
@@ -31,7 +29,7 @@
/* Filters for HDF5 internal test */
#define H5Z_FILTER_DYNLIB1 257
-#define H5Z_FILTER_DYNLIB2 258
+#define H5Z_FILTER_DYNLIB2 258
#define H5Z_FILTER_DYNLIB3 259
#define H5Z_FILTER_DYNLIB4 260
@@ -42,8 +40,8 @@ const char *FILENAME[] = {
#define FILENAME_BUF_SIZE 1024
/* Dataset names for testing filters */
-#define DSET_DEFLATE_NAME "deflate"
-#define DSET_DYNLIB1_NAME "dynlib1"
+#define DSET_DEFLATE_NAME "deflate"
+#define DSET_DYNLIB1_NAME "dynlib1"
#define DSET_DYNLIB2_NAME "dynlib2"
#define DSET_DYNLIB4_NAME "dynlib4"
@@ -64,7 +62,7 @@ const char *FILENAME[] = {
#define GROUP_ITERATION 1000
-int points_deflate[DSET_DIM1][DSET_DIM2],
+int points_deflate[DSET_DIM1][DSET_DIM2],
points_dynlib1[DSET_DIM1][DSET_DIM2],
points_dynlib2[DSET_DIM1][DSET_DIM2],
points_dynlib4[DSET_DIM1][DSET_DIM2],
@@ -72,14 +70,14 @@ int points_deflate[DSET_DIM1][DSET_DIM2],
/*-------------------------------------------------------------------------
- * Function: test_filter_internal
+ * Function: test_filter_internal
*
- * Purpose: Tests writing entire data and partial data with filters
+ * Purpose: Tests writing entire data and partial data with filters
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 27 February 2013
*
*-------------------------------------------------------------------------
@@ -87,28 +85,28 @@ int points_deflate[DSET_DIM1][DSET_DIM2],
static herr_t
test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
{
- hid_t dataset; /* Dataset ID */
- hid_t dxpl; /* Dataset xfer property list ID */
- hid_t write_dxpl; /* Dataset xfer property list ID for writing */
- hid_t sid; /* Dataspace ID */
- const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
- const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */
- const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */
- void *tconv_buf = NULL; /* Temporary conversion buffer */
- int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2];
- size_t i, j; /* Local index variables */
+ hid_t dataset; /* Dataset ID */
+ hid_t dxpl; /* Dataset xfer property list ID */
+ hid_t write_dxpl; /* Dataset xfer property list ID for writing */
+ hid_t sid; /* Dataspace ID */
+ const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */
+ const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */
+ void *tconv_buf = NULL; /* Temporary conversion buffer */
+ int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2];
+ size_t i, j; /* Local index variables */
int n = 0;
/* Create the data space */
- if((sid = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((sid = H5Screate_simple(2, size, NULL)) < 0) TEST_ERROR
/*
* Create a small conversion buffer to test strip mining. We
* might as well test all we can!
*/
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error;
+ if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
tconv_buf = HDmalloc((size_t)1000);
- if(H5Pset_buffer(dxpl, (size_t)1000, tconv_buf, NULL) < 0) goto error;
+ if(H5Pset_buffer(dxpl, (size_t)1000, tconv_buf, NULL) < 0) TEST_ERROR
if((write_dxpl = H5Pcopy(dxpl)) < 0) TEST_ERROR;
TESTING(" filters (setup)");
@@ -117,12 +115,12 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
if(H5Pall_filters_avail(dcpl)!=TRUE) {
H5_FAILED();
printf(" Line %d: Incorrect filter availability\n",__LINE__);
- goto error;
+ TEST_ERROR
} /* end if */
/* Create the dataset */
if((dataset = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT,
- dcpl, H5P_DEFAULT)) < 0) goto error;
+ dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
PASSED();
@@ -133,18 +131,18 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
TESTING(" filters (uninitialized read)");
if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
- TEST_ERROR;
+ TEST_ERROR;
for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(0!=check[i][j]) {
- H5_FAILED();
- printf(" Read a non-zero value.\n");
- printf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
- goto error;
- }
- }
+ for(j=0; j<(size_t)size[1]; j++) {
+ if(0!=check[i][j]) {
+ H5_FAILED();
+ printf(" Read a non-zero value.\n");
+ printf(" At index %lu,%lu\n",
+ (unsigned long)i, (unsigned long)j);
+ TEST_ERROR
+ }
+ }
}
PASSED();
@@ -157,13 +155,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
n = 0;
for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- points[i][j] = (int)(n++);
- }
+ for(j=0; j<size[1]; j++) {
+ points[i][j] = (int)(n++);
+ }
}
if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
- TEST_ERROR;
+ TEST_ERROR;
PASSED();
@@ -175,20 +173,20 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
/* Read the dataset back */
if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
- TEST_ERROR;
+ TEST_ERROR;
/* Check that the values read are the same as the values written */
for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- fprintf(stderr," Read different values than written.\n");
- fprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- fprintf(stderr," At original: %d\n", (int)points[i][j]);
- fprintf(stderr," At returned: %d\n", (int)check[i][j]);
- goto error;
- }
- }
+ for(j=0; j<size[1]; j++) {
+ if(points[i][j] != check[i][j]) {
+ H5_FAILED();
+ fprintf(stderr," Read different values than written.\n");
+ fprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ fprintf(stderr," At original: %d\n", (int)points[i][j]);
+ fprintf(stderr," At returned: %d\n", (int)check[i][j]);
+ TEST_ERROR
+ }
+ }
}
PASSED();
@@ -203,28 +201,28 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
TESTING(" filters (modify)");
for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]/2; j++) {
- points[i][j] = (int)HDrandom () % RANDOM_LIMIT;
- }
+ for(j=0; j<size[1]/2; j++) {
+ points[i][j] = (int)HDrandom () % RANDOM_LIMIT;
+ }
}
if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
- TEST_ERROR;
+ TEST_ERROR;
/* Read the dataset back and check it */
if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
- TEST_ERROR;
+ TEST_ERROR;
/* Check that the values read are the same as the values written */
for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
- goto error;
- }
- }
+ for(j=0; j<size[1]; j++) {
+ if(points[i][j] != check[i][j]) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %lu,%lu\n",
+ (unsigned long)i, (unsigned long)j);
+ TEST_ERROR
+ }
+ }
}
PASSED();
@@ -245,14 +243,14 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
/* Check that the values read are the same as the values written */
for(i = 0; i < size[0]; i++)
- for(j = 0; j < size[1]; j++)
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
- goto error;
- } /* end if */
+ for(j = 0; j < size[1]; j++)
+ if(points[i][j] != check[i][j]) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %lu,%lu\n",
+ (unsigned long)i, (unsigned long)j);
+ TEST_ERROR
+ } /* end if */
PASSED();
@@ -265,60 +263,60 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
TESTING(" filters (partial I/O)");
for(i=0; i<(size_t)hs_size[0]; i++) {
- for(j=0; j<(size_t)hs_size[1]; j++) {
- points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] = (int)HDrandom() % RANDOM_LIMIT;
- }
+ for(j=0; j<(size_t)hs_size[1]; j++) {
+ points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] = (int)HDrandom() % RANDOM_LIMIT;
+ }
}
if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size,
- NULL) < 0) TEST_ERROR;
+ NULL) < 0) TEST_ERROR;
/* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing) */
if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points) < 0)
- TEST_ERROR;
+ TEST_ERROR;
if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check) < 0)
- TEST_ERROR;
+ TEST_ERROR;
/* Check that the values read are the same as the values written */
for(i=0; i<(size_t)hs_size[0]; i++) {
- for(j=0; j<(size_t)hs_size[1]; j++) {
- if(points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] !=
+ for(j=0; j<(size_t)hs_size[1]; j++) {
+ if(points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] !=
check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]) {
- H5_FAILED();
- fprintf(stderr," Read different values than written.\n");
- fprintf(stderr," At index %lu,%lu\n",
- (unsigned long)((size_t)hs_offset[0]+i),
- (unsigned long)((size_t)hs_offset[1]+j));
- fprintf(stderr," At original: %d\n",
- (int)points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
- fprintf(stderr," At returned: %d\n",
- (int)check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
- goto error;
- }
- }
+ H5_FAILED();
+ fprintf(stderr," Read different values than written.\n");
+ fprintf(stderr," At index %lu,%lu\n",
+ (unsigned long)((size_t)hs_offset[0]+i),
+ (unsigned long)((size_t)hs_offset[1]+j));
+ fprintf(stderr," At original: %d\n",
+ (int)points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
+ fprintf(stderr," At returned: %d\n",
+ (int)check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
+ TEST_ERROR
+ }
+ }
}
PASSED();
- /* Save the data written to the file for later comparison when the file
+ /* Save the data written to the file for later comparison when the file
* is reopened for read test */
for(i=0; i<size[0]; i++) {
for(j=0; j<size[1]; j++) {
if(!HDstrcmp(name, DSET_DEFLATE_NAME)) {
- points_deflate[i][j] = points[i][j];
+ points_deflate[i][j] = points[i][j];
} else if(!HDstrcmp(name, DSET_DYNLIB1_NAME)) {
- points_dynlib1[i][j] = points[i][j];
+ points_dynlib1[i][j] = points[i][j];
} else if(!HDstrcmp(name, DSET_DYNLIB2_NAME)) {
- points_dynlib2[i][j] = points[i][j];
+ points_dynlib2[i][j] = points[i][j];
} else if(!HDstrcmp(name, DSET_DYNLIB4_NAME)) {
points_dynlib4[i][j] = points[i][j];
}
- }
+ }
}
/* Clean up objects used for this test */
- if(H5Dclose (dataset) < 0) goto error;
- if(H5Sclose (sid) < 0) goto error;
- if(H5Pclose (dxpl) < 0) goto error;
+ if(H5Dclose (dataset) < 0) TEST_ERROR
+ if(H5Sclose (sid) < 0) TEST_ERROR
+ if(H5Pclose (dxpl) < 0) TEST_ERROR
free (tconv_buf);
return(0);
@@ -330,15 +328,15 @@ error:
}
/*-------------------------------------------------------------------------
- * Function: test_filters_for_datasets
+ * Function: test_filters_for_datasets
*
- * Purpose: Tests creating datasets and writing data with dynamically
+ * Purpose: Tests creating datasets and writing data with dynamically
* loaded filters
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 14 March 2013
*
*-------------------------------------------------------------------------
@@ -346,7 +344,7 @@ error:
static herr_t
test_filters_for_datasets(hid_t file)
{
- hid_t dc; /* Dataset creation property list ID */
+ hid_t dc; /* Dataset creation property list ID */
const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
unsigned int compress_level = 9;
unsigned int dynlib4_values[4];
@@ -355,17 +353,16 @@ test_filters_for_datasets(hid_t file)
* STEP 1: Test deflation by itself.
*----------------------------------------------------------
*/
-#ifdef H5_HAVE_FILTER_DEFLATE
puts("Testing deflate filter");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_deflate (dc, 6) < 0) goto error;
+#ifdef H5_HAVE_FILTER_DEFLATE
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk (dc, 2, chunk_size) < 0) TEST_ERROR
+ if(H5Pset_deflate (dc, 6) < 0) TEST_ERROR
- if(test_filter_internal(file,DSET_DEFLATE_NAME,dc) < 0) goto error;
+ if(test_filter_internal(file,DSET_DEFLATE_NAME,dc) < 0) TEST_ERROR
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
+ if(H5Pclose (dc) < 0) TEST_ERROR
#else /* H5_HAVE_FILTER_DEFLATE */
- TESTING("deflate filter");
SKIPPED();
puts(" Deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -374,60 +371,60 @@ test_filters_for_datasets(hid_t file)
* STEP 2: Test DYNLIB1 by itself.
*----------------------------------------------------------
*/
- puts("Testing DYNLIB1 filter");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB1, H5Z_FLAG_MANDATORY, (size_t)1, &compress_level) < 0) goto error;
+ puts(" DYNLIB1 filter");
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk (dc, 2, chunk_size) < 0) TEST_ERROR
+ if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB1, H5Z_FLAG_MANDATORY, (size_t)1, &compress_level) < 0) TEST_ERROR
- if(test_filter_internal(file,DSET_DYNLIB1_NAME,dc) < 0) goto error;
+ if(test_filter_internal(file,DSET_DYNLIB1_NAME,dc) < 0) TEST_ERROR
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
+ if(H5Pclose (dc) < 0) TEST_ERROR
- /* Unregister the dynamic filter DYNLIB1 for testing purpose. The next time when this test is run for
+ /* Unregister the dynamic filter DYNLIB1 for testing purpose. The next time when this test is run for
* the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
* for this filter. */
- if(H5Zunregister(H5Z_FILTER_DYNLIB1) < 0) goto error;
+ if(H5Zunregister(H5Z_FILTER_DYNLIB1) < 0) TEST_ERROR
/*----------------------------------------------------------
* STEP 3: Test DYNLIB2 by itself.
*----------------------------------------------------------
*/
- puts("Testing DYNLIB2 filter");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB2, H5Z_FLAG_MANDATORY, 0, NULL) < 0) goto error;
+ puts(" DYNLIB2 filter");
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk (dc, 2, chunk_size) < 0) TEST_ERROR
+ if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB2, H5Z_FLAG_MANDATORY, 0, NULL) < 0) TEST_ERROR
- if(test_filter_internal(file,DSET_DYNLIB2_NAME,dc) < 0) goto error;
+ if(test_filter_internal(file,DSET_DYNLIB2_NAME,dc) < 0) TEST_ERROR
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
+ if(H5Pclose (dc) < 0) TEST_ERROR
- /* Unregister the dynamic filter DYNLIB2 for testing purpose. The next time when this test is run for
+ /* Unregister the dynamic filter DYNLIB2 for testing purpose. The next time when this test is run for
* the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
* for this filter. */
- if(H5Zunregister(H5Z_FILTER_DYNLIB2) < 0) goto error;
+ if(H5Zunregister(H5Z_FILTER_DYNLIB2) < 0) TEST_ERROR
/*----------------------------------------------------------
* STEP 4: Test DYNLIB4 by itself.
*----------------------------------------------------------
*/
- puts("Testing DYNLIB4 filter");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
+ puts(" DYNLIB4 filter");
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk (dc, 2, chunk_size) < 0) TEST_ERROR
dynlib4_values[0] = 9;
- if(H5get_libversion(&dynlib4_values[1], &dynlib4_values[2], &dynlib4_values[3]) < 0) goto error;
- if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB4, H5Z_FLAG_MANDATORY, (size_t)4, dynlib4_values) < 0) goto error;
+ if(H5get_libversion(&dynlib4_values[1], &dynlib4_values[2], &dynlib4_values[3]) < 0) TEST_ERROR
+ if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB4, H5Z_FLAG_MANDATORY, (size_t)4, dynlib4_values) < 0) TEST_ERROR
- if(test_filter_internal(file,DSET_DYNLIB4_NAME,dc) < 0) goto error;
+ if(test_filter_internal(file,DSET_DYNLIB4_NAME,dc) < 0) TEST_ERROR
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
+ if(H5Pclose (dc) < 0) TEST_ERROR
/* Unregister the dynamic filter DYNLIB4 for testing purpose. The next time when this test is run for
* the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
* for this filter. */
- if(H5Zunregister(H5Z_FILTER_DYNLIB4) < 0) goto error;
+ if(H5Zunregister(H5Z_FILTER_DYNLIB4) < 0) TEST_ERROR
return 0;
@@ -436,14 +433,14 @@ error:
}
/*-------------------------------------------------------------------------
- * Function: test_read_data
+ * Function: test_read_data
*
- * Purpose: Tests reading data and compares values
+ * Purpose: Tests reading data and compares values
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 14 March 2013
*
*-------------------------------------------------------------------------
@@ -451,10 +448,10 @@ error:
static herr_t
test_read_data(hid_t dataset, int *origin_data)
{
- int check[DSET_DIM1][DSET_DIM2];
- const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ int check[DSET_DIM1][DSET_DIM2];
+ const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
int *data_p = origin_data;
- size_t i, j; /* Local index variables */
+ size_t i, j; /* Local index variables */
/* Read the dataset back */
if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
@@ -463,16 +460,16 @@ test_read_data(hid_t dataset, int *origin_data)
/* Check that the values read are the same as the values written */
for(i=0; i<size[0]; i++) {
for(j=0; j<size[1]; j++) {
- if(*data_p != check[i][j]) {
- H5_FAILED();
- fprintf(stderr," Read different values than written.\n");
- fprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- fprintf(stderr," At original: %d\n", *data_p);
- fprintf(stderr," At returned: %d\n", (int)check[i][j]);
- goto error;
- }
+ if(*data_p != check[i][j]) {
+ H5_FAILED();
+ fprintf(stderr," Read different values than written.\n");
+ fprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ fprintf(stderr," At original: %d\n", *data_p);
+ fprintf(stderr," At returned: %d\n", (int)check[i][j]);
+ TEST_ERROR
+ }
data_p++;
- }
+ }
}
PASSED();
@@ -504,9 +501,9 @@ test_read_with_filters(hid_t file)
* STEP 1: Test deflation by itself.
*----------------------------------------------------------
*/
-#ifdef H5_HAVE_FILTER_DEFLATE
- TESTING("Testing deflate filter");
+ TESTING("deflate filter");
+#ifdef H5_HAVE_FILTER_DEFLATE
if(H5Zfilter_avail(H5Z_FILTER_DEFLATE) != TRUE) TEST_ERROR
if((dset = H5Dopen2(file,DSET_DEFLATE_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
@@ -517,7 +514,6 @@ test_read_with_filters(hid_t file)
/* Clean up objects used for this test */
#else /* H5_HAVE_FILTER_DEFLATE */
- TESTING("deflate filter");
SKIPPED();
puts(" Deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -526,7 +522,7 @@ test_read_with_filters(hid_t file)
* STEP 2: Test DYNLIB1 by itself.
*----------------------------------------------------------
*/
- TESTING("Testing DYNLIB1 filter");
+ TESTING(" DYNLIB1 filter");
if((dset = H5Dopen2(file,DSET_DYNLIB1_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
@@ -538,7 +534,7 @@ test_read_with_filters(hid_t file)
* STEP 3: Test Bogus2 by itself.
*----------------------------------------------------------
*/
- TESTING("Testing DYNLIB2 filter");
+ TESTING(" DYNLIB2 filter");
if((dset = H5Dopen2(file,DSET_DYNLIB2_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
@@ -550,7 +546,7 @@ test_read_with_filters(hid_t file)
* STEP 4: Test DYNLIB4 by itself.
*----------------------------------------------------------
*/
- TESTING("Testing DYNLIB4 filter");
+ TESTING(" DYNLIB4 filter");
if((dset = H5Dopen2(file,DSET_DYNLIB4_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
@@ -595,21 +591,21 @@ error:
}
/*-------------------------------------------------------------------------
- * Function: test_noread_with_filters
+ * Function: test_noread_with_filters
*
- * Purpose: Tests reading dataset created with dynamically loaded filters disabled
+ * Purpose: Tests reading dataset created with dynamically loaded filters disabled
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
static herr_t
test_noread_with_filters(hid_t file)
{
- hid_t dset; /* Dataset ID */
+ hid_t dset; /* Dataset ID */
unsigned plugin_state; /* status of plugins */
- TESTING("Testing DYNLIB1 filter with plugins disabled");
+ TESTING("DYNLIB1 filter with plugins disabled");
/* disable filter plugin */
if(H5PLget_loading_state(&plugin_state) < 0) TEST_ERROR
@@ -636,14 +632,14 @@ error:
}
/*-------------------------------------------------------------------------
- * Function: test_filters_for_groups
+ * Function: test_filters_for_groups
*
- * Purpose: Tests creating group with dynamically loaded filters
+ * Purpose: Tests creating group with dynamically loaded filters
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 1 April 2013
*
*-------------------------------------------------------------------------
@@ -651,32 +647,32 @@ error:
static herr_t
test_filters_for_groups(hid_t file)
{
- hid_t gcpl, gid, group;
+ hid_t gcpl, gid, group;
int i;
char gname[256];
- TESTING("Testing DYNLIB3 filter for group");
+ TESTING("DYNLIB3 filter for group");
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto error;
-
- /* Use DYNLIB3 for creating groups */
- if(H5Pset_filter (gcpl, H5Z_FILTER_DYNLIB3, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) goto error;
+ if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+
+ /* Use DYNLIB3 for creating groups */
+ if(H5Pset_filter (gcpl, H5Z_FILTER_DYNLIB3, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) TEST_ERROR
/* Create a group using this filter */
- if((gid = H5Gcreate2(file, "group1", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) goto error;
+ if((gid = H5Gcreate2(file, "group1", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR
/* Create multiple groups under "group1" */
for (i=0; i < GROUP_ITERATION; i++) {
sprintf(gname, "group_%d", i);
- if((group = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Gclose(group) < 0) goto error;
+ if((group = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group) < 0) TEST_ERROR
}
/* Close the group */
- if(H5Gclose(gid) < 0) goto error;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Clean up objects used for this test */
- if(H5Pclose (gcpl) < 0) goto error;
+ if(H5Pclose (gcpl) < 0) TEST_ERROR
PASSED();
@@ -687,14 +683,14 @@ error:
}
/*-------------------------------------------------------------------------
- * Function: test_groups_with_filters
+ * Function: test_groups_with_filters
*
- * Purpose: Tests opening group with dynamically loaded filters
+ * Purpose: Tests opening group with dynamically loaded filters
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 1 April 2013
*
*-------------------------------------------------------------------------
@@ -702,27 +698,218 @@ error:
static herr_t
test_groups_with_filters(hid_t file)
{
- hid_t gid, group;
+ hid_t gid, group;
int i;
char gname[256];
- TESTING("Testing opening groups with DYNLIB3 filter");
+ TESTING("opening groups with DYNLIB3 filter");
/* Open the top group */
- if((gid = H5Gopen2(file, "group1", H5P_DEFAULT)) < 0) goto error;
+ if((gid = H5Gopen2(file, "group1", H5P_DEFAULT)) < 0) TEST_ERROR
/* Create multiple groups under "group1" */
for (i=0; i < GROUP_ITERATION; i++) {
sprintf(gname, "group_%d", i);
- if((group = H5Gopen2(gid, gname, H5P_DEFAULT)) < 0) goto error;
- if(H5Gclose(group) < 0) goto error;
+ if((group = H5Gopen2(gid, gname, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group) < 0) TEST_ERROR
}
/* Close the group */
- if(H5Gclose(gid) < 0) goto error;
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ PASSED();
+
+ return 0;
+
+error:
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_filter_path_apis
+ *
+ * Purpose: Tests accessing the path table for dynamically loaded filters
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_filter_path_apis(void)
+{
+ int i;
+ unsigned int ndx;
+ herr_t ret;
+ char pathname[256];
+
+ puts("Testing access to the filter path table");
+
+ ndx = H5PLsize();
+
+ TESTING(" remove");
+ /* Remove all existing paths*/
+ for (i=ndx; i > 0; i--) {
+ if (H5PLremove(i-1) < 0) {
+ fprintf(stderr," at %d: %s\n", i, pathname);
+ TEST_ERROR
+ }
+ }
+ /* Verify the table is empty */
+ if (H5PLsize() > 0) TEST_ERROR
+ PASSED();
+
+ TESTING(" remove (exceed)");
+ /* Exceed the min path removal */
+ H5E_BEGIN_TRY {
+ ret = H5PLremove(0);
+ } H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
+ PASSED();
+
+ TESTING(" append");
+ /* Create multiple paths to fill table */
+ for (i=0; i < 16; i++) {
+ sprintf(pathname, "a_path_%d", i);
+ if (H5PLappend(pathname) < 0) {
+ fprintf(stderr," at %d: %s\n", i, pathname);
+ TEST_ERROR
+ }
+ }
+ /* Verify the table is full */
+ if (H5PLsize() != 16) TEST_ERROR
+ PASSED();
+ TESTING(" append (exceed)");
+ /* Exceed the max path append */
+ H5E_BEGIN_TRY {
+ sprintf(pathname, "a_path_%d", 16);
+ ret = H5PLappend(pathname);
+ } H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
PASSED();
+ TESTING(" remove (verify for prepend)");
+ /* Remove one path*/
+ if (H5PLremove(8) < 0) TEST_ERROR
+
+ /* Verify that the entries were moved */
+ sprintf(pathname, "%s", H5PLget(8));
+ if (strcmp(pathname, "a_path_9") != 0) {
+ fprintf(stderr," get 8: %s\n", pathname);
+ TEST_ERROR
+ }
+ PASSED();
+
+ /* Verify the table is not full */
+ if (H5PLsize() != 15) TEST_ERROR
+
+ TESTING(" prepend");
+ /* Prepend one path*/
+ sprintf(pathname, "a_path_%d", 17);
+ if (H5PLprepend(pathname) < 0) {
+ fprintf(stderr," prepend 17: %s\n", pathname);
+ TEST_ERROR
+ }
+
+ /* Verify the table is full */
+ if (H5PLsize() != 16) TEST_ERROR
+
+ /* Verify that the entries were moved */
+ sprintf(pathname, "%s", H5PLget(8));
+ if (strcmp(pathname, "a_path_7") != 0) {
+ fprintf(stderr," get 8: %s\n", pathname);
+ TEST_ERROR
+ }
+ sprintf(pathname, "%s", H5PLget(0));
+ if (strcmp(pathname, "a_path_17") != 0) {
+ fprintf(stderr," get 0: %s\n", pathname);
+ TEST_ERROR
+ }
+ PASSED();
+
+ TESTING(" prepend (exceed)");
+ /* Exceed the max path prepend */
+ H5E_BEGIN_TRY {
+ sprintf(pathname, "a_path_%d", 18);
+ ret = H5PLprepend(pathname);
+ } H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
+ PASSED();
+
+ TESTING(" replace");
+ /* Replace one path*/
+ sprintf(pathname, "a_path_%d", 20);
+ if (H5PLput(pathname, 1) < 0) {
+ fprintf(stderr," replace 1: %s\n", pathname);
+ TEST_ERROR
+ }
+
+ /* Verify the table is full */
+ if (H5PLsize() != 16) TEST_ERROR
+
+ /* Verify that the entries were not moved */
+ sprintf(pathname, "%s", H5PLget(0));
+ if (strcmp(pathname, "a_path_17") != 0) {
+ fprintf(stderr," get 0: %s\n", pathname);
+ TEST_ERROR
+ }
+ sprintf(pathname, "%s", H5PLget(2));
+ if (strcmp(pathname, "a_path_1") != 0) {
+ fprintf(stderr," get 2: %s\n", pathname);
+ TEST_ERROR
+ }
+ PASSED();
+
+ TESTING(" remove (verify for insert)");
+ /* Remove one path*/
+ if (H5PLremove(4) < 0) TEST_ERROR
+
+ /* Verify that the entries were moved */
+ sprintf(pathname, "%s", H5PLget(4));
+ if (strcmp(pathname, "a_path_4") != 0) {
+ fprintf(stderr," get 4: %s\n", pathname);
+ TEST_ERROR
+ }
+ PASSED();
+
+ /* Verify the table is not full */
+ if (H5PLsize() != 15) TEST_ERROR
+
+ TESTING(" insert");
+ /* Insert one path*/
+ sprintf(pathname, "a_path_%d", 21);
+ if (H5PLinsert(pathname, 3) < 0){
+ fprintf(stderr," insert 3: %s\n", pathname);
+ TEST_ERROR
+ }
+
+ /* Verify that the entries were moved */
+ sprintf(pathname, "%s", H5PLget(4));
+ if (strcmp(pathname, "a_path_2") != 0){
+ fprintf(stderr," get 4: %s\n", pathname);
+ TEST_ERROR
+ }
+ PASSED();
+
+ /* Verify the table is full */
+ if (H5PLsize() != 16) TEST_ERROR
+
+ TESTING(" insert (exceed)");
+ /* Exceed the max path insert */
+ H5E_BEGIN_TRY {
+ sprintf(pathname, "a_path_%d", 22);
+ ret = H5PLinsert(pathname, 12);
+ } H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
+
+ PASSED ();
+
return 0;
error:
@@ -731,30 +918,30 @@ error:
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Tests the plugin module (H5PL)
+ * Purpose: Tests the plugin module (H5PL)
*
- * Return: Success: exit(0)
+ * Return: Success: exit(EXIT_SUCCESS)
*
- * Failure: exit(1)
+ * Failure: exit(EXIT_FAILURE)
*
- * Programmer: Raymond Lu
- * 14 March 2013
+ * Programmer: Raymond Lu
+ * 14 March 2013
*
*-------------------------------------------------------------------------
*/
int
main(void)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t file, fapl, fapl2;
- hbool_t new_format;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t file, fapl, fapl2;
+ unsigned new_format;
int mdc_nelmts;
size_t rdcc_nelmts;
size_t rdcc_nbytes;
double rdcc_w0;
- int nerrors = 0;
+ int nerrors = 0;
/* Testing setup */
h5_reset();
@@ -762,10 +949,10 @@ main(void)
/* Turn off the chunk cache, so all the chunks are immediately written to disk */
if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
- TEST_ERROR
+ TEST_ERROR
rdcc_nbytes = 0;
if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Copy the file access property list */
if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
@@ -791,22 +978,25 @@ main(void)
/* Create the file for this test */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Test dynamically loaded filters for chunked dataset */
- nerrors += (test_filters_for_datasets(file) < 0 ? 1 : 0);
+ nerrors += (test_filters_for_datasets(file) < 0 ? 1 : 0);
/* Test dynamically loaded filters for groups */
nerrors += (test_filters_for_groups(file) < 0 ? 1 : 0);
if(H5Fclose(file) < 0)
- TEST_ERROR
+ TEST_ERROR
} /* end for */
/* Close FAPL */
if(H5Pclose(fapl2) < 0) TEST_ERROR
if(H5Pclose(fapl) < 0) TEST_ERROR
-
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
puts("\nTesting reading data with with dynamic plugin filters:");
/* Close the library so that all loaded plugin libraries are unloaded */
@@ -815,13 +1005,16 @@ main(void)
/* Reopen the file for testing data reading */
if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Read the data with filters */
- nerrors += (test_read_with_filters(file) < 0 ? 1 : 0);
+ nerrors += (test_read_with_filters(file) < 0 ? 1 : 0);
/* Open the groups with filters */
- nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0);
+ nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0);
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
/* Close the library so that all loaded plugin libraries are unloaded */
h5_reset();
@@ -835,10 +1028,13 @@ main(void)
nerrors += (test_noread_with_filters(file) < 0 ? 1 : 0);
if(H5Fclose(file) < 0)
- TEST_ERROR
+ TEST_ERROR
+
+ /* Test the APIs for access to the filter plugin path table */
+ nerrors += (test_filter_path_apis() < 0 ? 1 : 0);
if(nerrors)
- TEST_ERROR
+ TEST_ERROR
printf("All plugin tests passed.\n");
h5_cleanup(FILENAME, fapl);
diff --git a/test/set_extent.c b/test/set_extent.c
index f6c3766..5df649c 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -20,9 +20,6 @@
* Purpose: Tests the H5Dset_extent call
*/
-#include <time.h>
-#include <stdlib.h>
-#include "hdf5.h"
#include "h5test.h"
/*-------------------------------------------------------------------------
diff --git a/test/vfd.c b/test/vfd.c
index 4ece2ba..94c0a5c 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -80,9 +80,9 @@ 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; /* file ID */
+ hid_t fapl = -1; /* file access property list ID */
+ hid_t access_fapl = -1;
char filename[1024];
int *fhandle = NULL;
hsize_t file_size = 0;
@@ -90,7 +90,8 @@ test_sec2(void)
TESTING("SEC2 file driver");
/* Set property list and file name for SEC2 driver. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_sec2(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
@@ -125,11 +126,12 @@ test_sec2(void)
*/
if(file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[0], fapl);
- if(H5Fclose(file) < 0)
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -184,7 +186,8 @@ test_direct(void)
/* 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((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
@@ -333,7 +336,12 @@ test_direct(void)
HDassert(check);
HDfree(check);
- h5_cleanup(FILENAME, fapl);
+ h5_delete_test_file(FILENAME[1], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
+
PASSED();
return 0;
@@ -387,7 +395,8 @@ test_core(void)
TESTING("CORE file driver");
/* Set property list and file name for CORE driver */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
TEST_ERROR;
if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0)
@@ -558,14 +567,19 @@ test_core(void)
TEST_ERROR;
if(H5Dclose(dset1) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
- TEST_ERROR;
HDassert(points);
HDfree(points);
HDassert(check);
HDfree(check);
- h5_cleanup(FILENAME, fapl);
+ /* Close and delete the file */
+ if(H5Fclose(file) < 0)
+ TEST_ERROR;
+ h5_delete_test_file(FILENAME[5], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
PASSED();
return 0;
@@ -602,7 +616,7 @@ error:
static herr_t
test_family_opens(char *fname, hid_t fa_pl)
{
- hid_t file;
+ hid_t file=-1;
char first_name[1024];
char wrong_name[1024];
int i;
@@ -673,7 +687,7 @@ error:
static herr_t
test_family(void)
{
- hid_t file=(-1), fapl, fapl2=(-1), space=(-1), dset=(-1);
+ hid_t file=-1, fapl=-1, fapl2=-1, space=-1, dset=-1;
hid_t access_fapl = -1;
char filename[1024];
char dname[]="dataset";
@@ -686,11 +700,11 @@ test_family(void)
TESTING("FAMILY file driver");
/* Set property list and file name for FAMILY driver */
- fapl = h5_fileaccess();
-
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
@@ -797,10 +811,15 @@ test_family(void)
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[2], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -808,7 +827,8 @@ error:
H5E_BEGIN_TRY {
H5Sclose(space);
H5Dclose(dset);
- H5Pclose (fapl2);
+ H5Pclose(fapl);
+ H5Pclose(fapl2);
H5Fclose(file);
} H5E_END_TRY;
return -1;
@@ -836,8 +856,8 @@ error:
static herr_t
test_family_compat(void)
{
- hid_t file = (-1), fapl;
- hid_t dset;
+ hid_t file = -1, fapl = -1;
+ hid_t dset = -1;
char dname[]="dataset";
char filename[1024];
char pathname[1024], pathname_individual[1024];
@@ -847,13 +867,13 @@ test_family_compat(void)
TESTING("FAMILY file driver backward compatibility");
/* Set property list and file name for FAMILY driver */
- fapl = h5_fileaccess();
-
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0)
TEST_ERROR;
- h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof filename);
- h5_fixname(FILENAME[3], fapl, newname, sizeof newname);
+ h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof(filename));
+ h5_fixname(FILENAME[3], fapl, newname, sizeof(newname));
pathname[0] = '\0';
HDstrcat(pathname, filename);
@@ -869,7 +889,7 @@ test_family_compat(void)
counter++;
HDsnprintf(newname_individual, sizeof(newname_individual), newname, counter);
HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter);
- }
+ } /* end while */
/* Make sure we can open the file. Use the read and write mode to flush the
* superblock. */
@@ -895,10 +915,14 @@ test_family_compat(void)
if(H5Dclose(dset) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[3], fapl);
- h5_cleanup(FILENAME, fapl);
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
PASSED();
@@ -931,7 +955,7 @@ error:
static herr_t
test_multi_opens(char *fname)
{
- hid_t file;
+ hid_t file=-1;
char super_name[1024]; /*name string "%%s-s.h5"*/
char sf_name[1024]; /*name string "multi_file-s.h5"*/
@@ -963,8 +987,8 @@ test_multi_opens(char *fname)
static herr_t
test_multi(void)
{
- hid_t file=(-1), fapl, fapl2=(-1), dset=(-1), space=(-1);
- hid_t root, attr, aspace, atype;
+ hid_t file=-1, fapl=-1, fapl2=-1, dset=-1, space=-1;
+ hid_t root=-1, attr=-1, aspace=-1, atype=-1;
hid_t access_fapl = -1;
char filename[1024];
int *fhandle2=NULL, *fhandle=NULL;
@@ -982,14 +1006,16 @@ test_multi(void)
int buf[MULTI_SIZE][MULTI_SIZE];
TESTING("MULTI file driver");
+
/* Set file access property list for MULTI driver */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
- HDmemset(memb_map, 0, sizeof memb_map);
- HDmemset(memb_fapl, 0, sizeof memb_fapl);
- HDmemset(memb_name, 0, sizeof memb_name);
- HDmemset(memb_addr, 0, sizeof memb_addr);
- HDmemset(sv, 0, sizeof sv);
+ HDmemset(memb_map, 0, sizeof(memb_map));
+ HDmemset(memb_fapl, 0, sizeof(memb_fapl));
+ HDmemset(memb_name, 0, sizeof(memb_name));
+ HDmemset(memb_addr, 0, sizeof(memb_addr));
+ HDmemset(sv, 0, sizeof(sv));
for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
memb_fapl[mt] = H5P_DEFAULT;
@@ -1106,7 +1132,7 @@ test_multi(void)
/* Create and write attribute for the root group. */
if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ TEST_ERROR
/* Attribute string. */
if((atype = H5Tcopy(H5T_C_S1)) < 0)
@@ -1136,10 +1162,15 @@ test_multi(void)
if(H5Aclose(attr) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[4], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1179,7 +1210,7 @@ error:
static herr_t
test_multi_compat(void)
{
- hid_t file=(-1), fapl, dset=(-1), space=(-1);
+ hid_t file=-1, fapl=-1, dset=-1, space=-1;
char newname[1024];
char filename_s[1024], newname_s[1024];
char filename_r[1024], newname_r[1024];
@@ -1195,7 +1226,8 @@ test_multi_compat(void)
TESTING("MULTI file driver backward compatibility");
/* Set file access property list for MULTI driver */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
HDmemset(memb_map, 0, sizeof memb_map);
HDmemset(memb_fapl, 0, sizeof memb_fapl);
@@ -1303,10 +1335,15 @@ test_multi_compat(void)
if(H5Dclose(dset) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[9], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1350,7 +1387,8 @@ test_log(void)
TESTING("LOG file driver");
/* Set property list and file name for log driver. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
TEST_ERROR;
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
@@ -1387,10 +1425,15 @@ test_log(void)
if(file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[6], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1429,7 +1472,8 @@ test_stdio(void)
TESTING("STDIO file driver");
/* Set property list and file name for STDIO driver. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_stdio(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[7], fapl, filename, sizeof filename);
@@ -1465,10 +1509,15 @@ test_stdio(void)
if(file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[7], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1519,7 +1568,8 @@ test_windows(void)
#else /* H5_HAVE_WINDOWS */
/* Set property list and file name for WINDOWS driver. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_windows(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
@@ -1555,10 +1605,15 @@ test_windows(void)
if(file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[8], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;