summaryrefslogtreecommitdiffstats
path: root/test/page_buffer.c
diff options
context:
space:
mode:
authormainzer <mainzer#hdfgroup.org>2017-03-28 16:21:40 (GMT)
committermainzer <mainzer#hdfgroup.org>2017-03-28 16:21:40 (GMT)
commitafd8f64c29f7cffde895232406a3a388c6d77e77 (patch)
treeb142b9a9d70ce2dc9fcc3aa1ab27f57b149c5aed /test/page_buffer.c
parentbe028580c8789301e4106d8d6e79a8fc8300e706 (diff)
downloadhdf5-afd8f64c29f7cffde895232406a3a388c6d77e77.zip
hdf5-afd8f64c29f7cffde895232406a3a388c6d77e77.tar.gz
hdf5-afd8f64c29f7cffde895232406a3a388c6d77e77.tar.bz2
Omnibus checkin for several relatively minor modifications:
1) Added code test/page_buffer.c to verify that page buffering is disabled in parallel builds. 2) Added code to test/cache_image.c to verify correct interaction between evict on close and cache image -- in particular management of a file containing a cache image containing dirty metadata that has been opened R/O. Also fix for the bug exposed. 3) Added code to testpar/t_cache_image.c to verify expected procedure for reading cache images, and also supporting stats collection code needed for the test. 4) Repair of an overactive sanity check in H5C__reconstruct_cache_contents(). 5) Other minor tidies in passing. Tested serial and parallel, debug and production on Jelly.
Diffstat (limited to 'test/page_buffer.c')
-rw-r--r--test/page_buffer.c135
1 files changed, 128 insertions, 7 deletions
diff --git a/test/page_buffer.c b/test/page_buffer.c
index b94ad03..54a25d6 100644
--- a/test/page_buffer.c
+++ b/test/page_buffer.c
@@ -52,6 +52,10 @@ static unsigned test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr)
static unsigned test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr);
static unsigned test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr);
static unsigned test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr);
+#ifdef H5_HAVE_PARALLEL
+static unsigned verify_page_buffering_disabled(hid_t orig_fapl,
+ const char *env_h5_drvr);
+#endif /* H5_HAVE_PARALLEL */
const char *FILENAME[] = {
"filepaged",
@@ -2007,6 +2011,121 @@ error:
/*-------------------------------------------------------------------------
+ * Function: verify_page_buffering_disabled()
+ *
+ * Purpose: This function should only be called in parallel
+ * builds.
+ *
+ * At present, page buffering should be disabled in parallel
+ * builds. Verify this.
+ *
+ * Return: 0 if test is sucessful
+ * 1 if test fails
+ *
+ * Programmer: John Mainzer
+ * 03/21/17
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifdef H5_HAVE_PARALLEL
+static unsigned
+verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr)
+{
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+
+ TESTING("Page Buffering Disabled");
+ h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
+
+
+ /* first, try to create a file with page buffering enabled */
+
+ if((fapl = H5Pcopy(orig_fapl)) < 0)
+ TEST_ERROR
+
+ if(set_multi_split(env_h5_drvr, fapl, 4096) != 0)
+ TEST_ERROR;
+
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, 4096) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_page_buffer_size(fapl, 4096*8, 0, 0) < 0)
+ FAIL_STACK_ERROR;
+
+ /* try to create the file -- should fail */
+ H5E_BEGIN_TRY {
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
+ } H5E_END_TRY;
+
+ if(file_id >= 0)
+ TEST_ERROR;
+
+ /* now, create a file, close it, and then try to open it with page
+ * buffering enabled.
+ */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, 4096) < 0)
+ FAIL_STACK_ERROR;
+
+ /* create the file */
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* close the file */
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+
+ /* try to open the file using the fapl prepared above which enables
+ * page buffering. Should fail.
+ */
+ H5E_BEGIN_TRY {
+ file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl);
+ } H5E_END_TRY;
+
+ if(file_id >= 0)
+ TEST_ERROR;
+
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pclose(fapl) < 0)
+ FAIL_STACK_ERROR;
+
+ PASSED()
+
+ return 0;
+
+error:
+
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+
+ return 1;
+
+} /* verify_page_buffering_disabled() */
+#endif /* H5_HAVE_PARALLEL */
+
+
+/*-------------------------------------------------------------------------
* Function: main()
*
* Purpose: Main function for the page buffer tests.
@@ -2026,8 +2145,6 @@ main(void)
unsigned nerrors = 0; /* Cumulative error count */
const char *env_h5_drvr = NULL; /* File Driver value from environment */
-#ifndef H5_HAVE_PARALLEL
-
h5_reset();
/* Get the VFD to use */
@@ -2052,12 +2169,21 @@ main(void)
PUTS_ERROR("Can't get VFD-dependent fapl")
} /* end if */
+#ifdef H5_HAVE_PARALLEL
+
+ HDputs("Page Buffering is disabled for parallel.");
+ nerrors += verify_page_buffering_disabled(fapl, env_h5_drvr);
+
+#else /* H5_HAVE_PARALLEL */
+
nerrors += test_args(fapl, env_h5_drvr);
nerrors += test_raw_data_handling(fapl, env_h5_drvr);
nerrors += test_lru_processing(fapl, env_h5_drvr);
nerrors += test_min_threshold(fapl, env_h5_drvr);
nerrors += test_stats_collection(fapl, env_h5_drvr);
+#endif /* H5_HAVE_PARALLEL */
+
h5_clean_files(FILENAME, fapl);
if(nerrors)
@@ -2065,11 +2191,6 @@ main(void)
HDputs("All Page Buffering tests passed.");
-#else
- SKIPPED()
- HDputs("Page Buffering is disabled for parallel.");
-#endif
-
HDexit(EXIT_SUCCESS);
error: