summaryrefslogtreecommitdiffstats
path: root/test/page_buffer.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2017-04-11 15:40:00 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2017-04-11 15:40:00 (GMT)
commitda4b69097756158fdbfcbf52b5b552e2034d263d (patch)
tree51d646d6a737c1e4216f04b9c9fa16a0afc49277 /test/page_buffer.c
parenta77bf61074122d4e6a100c09f23a684cd9655ff8 (diff)
parentccb4e9ed9a5e0af27db9f1504a628e35d7f4cf92 (diff)
downloadhdf5-da4b69097756158fdbfcbf52b5b552e2034d263d.zip
hdf5-da4b69097756158fdbfcbf52b5b552e2034d263d.tar.gz
hdf5-da4b69097756158fdbfcbf52b5b552e2034d263d.tar.bz2
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into merge_hyperslab_updates
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: