diff options
Diffstat (limited to 'test/page_buffer.c')
-rw-r--r-- | test/page_buffer.c | 164 |
1 files changed, 85 insertions, 79 deletions
diff --git a/test/page_buffer.c b/test/page_buffer.c index 73088de..b07ea3f 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -37,23 +37,25 @@ #define FILENAME_LEN 1024 + +/* test routines */ +#ifdef H5_HAVE_PARALLEL +static unsigned verify_page_buffering_disabled(hid_t orig_fapl, + const char *env_h5_drvr); +#else #define NUM_DSETS 5 #define NX 100 #define NY 50 -/* helper routines */ -static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl); -static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size); - -/* test routines */ static unsigned test_args(hid_t fapl, const char *env_h5_drvr); 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); + +/* helper routines */ +static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl); +static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size); #endif /* H5_HAVE_PARALLEL */ const char *FILENAME[] = { @@ -61,6 +63,7 @@ const char *FILENAME[] = { NULL }; +#ifndef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: create_file() @@ -68,9 +71,9 @@ const char *FILENAME[] = { * Purpose: The purpose of this function appears to be a smoke check * intended to exercise the page buffer. * - * Specifically, the function creates a file, and then goes - * through a loop in which it creates four data sets, write - * data to one of them, verifies the data written, and then + * Specifically, the function creates a file, and then goes + * through a loop in which it creates four data sets, write + * data to one of them, verifies the data written, and then * deletes the three that it didn't write to. * * Any data mis-matches or failures reported by the HDF5 @@ -154,7 +157,7 @@ create_file(char *filename, hid_t fcpl, hid_t fapl) HDmemset(data, 0, (size_t)num_elements * sizeof(int)); if((dset_id = H5Dopen2(grp_id, dset_name, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR; if(H5Dclose(dset_id) < 0) @@ -209,7 +212,7 @@ error: * Purpose: The purpose of this function appears to be a smoke check * intended to exercise the page buffer. * - * Specifically, the function opens a file (created by + * Specifically, the function opens a file (created by * create_file()?), and verify the contents of its datasets. * * Any data mis-matches or failures reported by the HDF5 @@ -224,7 +227,7 @@ error: *------------------------------------------------------------------------- */ static unsigned -open_file(char *filename, hid_t fapl, hsize_t page_size, +open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size) { hid_t file_id = -1; @@ -295,6 +298,7 @@ error: } H5E_END_TRY; return 1; } +#endif /* H5_HAVE_PARALLEL */ /* * @@ -356,6 +360,7 @@ error: } /* set_multi_split() */ +#ifndef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: test_args() @@ -364,7 +369,7 @@ error: * * 1) verifying that API errors are caught. * - * 2) verifying that the page buffer behaves more or less + * 2) verifying that the page buffer behaves more or less * as advertized. * * Any data mis-matches or unexpected failures or successes @@ -397,8 +402,8 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) TEST_ERROR; - /* Test setting a page buffer without Paged Aggregation enabled - - * should fail + /* Test setting a page buffer without Paged Aggregation enabled - + * should fail */ if(H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0) TEST_ERROR; @@ -411,8 +416,8 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) TEST_ERROR; - /* Test setting a page buffer with a size smaller than a single - * page size - should fail + /* Test setting a page buffer with a size smaller than a single + * page size - should fail */ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0) TEST_ERROR; @@ -431,8 +436,8 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) TEST_ERROR; - /* Test setting a page buffer with sum of min meta and raw - * data percentage > 100 - should fail + /* Test setting a page buffer with sum of min meta and raw + * data percentage > 100 - should fail */ H5E_BEGIN_TRY { ret = H5Pset_page_buffer_size(fapl, 512, 50, 51); @@ -461,8 +466,8 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) TEST_ERROR; - /* Test setting a page buffer with a size slightly larger than a - * single page size + /* Test setting a page buffer with a size slightly larger than a + * single page size */ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0) TEST_ERROR; @@ -522,7 +527,7 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) if(H5Pclose(fapl) < 0) FAIL_STACK_ERROR; - PASSED() + PASSED(); return 0; error: @@ -548,14 +553,14 @@ error: * * Programmer: unknown * ?? / ?? / ?? - * + * * Changes: Added base_page_cnt field as supporting code. This allows * the test to adjust to the number of page buffer pages * accessed during file open / create. * - * The test for the value of base_page_cnt just after file + * The test for the value of base_page_cnt just after file * open exists detect changes in library behavior. Assuming - * any such change is not indicative of other issues, these + * any such change is not indicative of other issues, these * tests can be modified to reflect the change. * * JRM -- 2/23/17 @@ -608,7 +613,7 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. - * Get the number of pages inserted, and verify that it is the + * Get the number of pages inserted, and verify that it is the * the expected value. */ base_page_cnt = H5SL_count(f->shared->page_buf->slist_ptr); @@ -688,8 +693,8 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt) FAIL_STACK_ERROR; - /* read elements 1200 - 1201, this should read -1 and bring in an - * entire page of addr 1200 + /* read elements 1200 - 1201, this should read -1 and bring in an + * entire page of addr 1200 */ if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*1200), sizeof(int)*1, data) < 0) FAIL_STACK_ERROR; @@ -739,7 +744,7 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) } /* read elements 0 - 800 using the PB.. this should result in all - * what we have written so far and should get the updates from the PB + * what we have written so far and should get the updates from the PB */ if(H5F_block_read(f, H5FD_MEM_DRAW, addr, sizeof(int)*800, data) < 0) FAIL_STACK_ERROR; @@ -754,7 +759,7 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) /* update elements 400 - 1400 to value 0, this will go to disk but * also evict existing pages from the PB (page 400 & 1200 that are - * existing). + * existing). */ for(i=0 ; i<1000 ; i++) data[i] = 0; @@ -796,7 +801,7 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; HDfree(data); - PASSED() + PASSED(); return 0; error: @@ -825,14 +830,14 @@ error: * * Programmer: unknown * ?? / ?? / ?? - * + * * Changes: Added base_page_cnt field as supporting code. This allows * the test to adjust to the number of page buffer pages * accessed during file open / create. * - * The test for the value of base_page_cnt just after file + * The test for the value of base_page_cnt just after file * open exists detect changes in library behavior. Assuming - * any such change is not indicative of other issues, these + * any such change is not indicative of other issues, these * tests can be modified to reflect the change. * * JRM -- 2/23/17 @@ -891,7 +896,7 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. - * Get the number of pages inserted, and verify that it is the + * Get the number of pages inserted, and verify that it is the * the expected value. */ base_page_cnt = H5SL_count(f->shared->page_buf->slist_ptr); @@ -911,7 +916,7 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) /* update the first 100 elements to have values 0-99 - this will be * a page buffer update with 1 page resulting in the page - * buffer. + * buffer. */ for(i=0 ; i<100 ; i++) data[i] = i; @@ -925,7 +930,7 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) TEST_ERROR; /* update elements 300 - 450, with values 300 - 449 - this will - * bring two pages into the page buffer and evict 0. + * bring two pages into the page buffer and evict 0. */ for(i=0 ; i<150 ; i++) data[i] = i+300; @@ -1049,7 +1054,7 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; HDfree(data); - PASSED() + PASSED(); return 0; error: @@ -1067,7 +1072,7 @@ error: /*------------------------------------------------------------------------- * Function: test_min_threshold() * - * Purpose: Tests verifying observation of minimum and maximum + * Purpose: Tests verifying observation of minimum and maximum * raw and metadata page counts in the page buffer. * * Any data mis-matches or failures reported by the HDF5 @@ -1078,16 +1083,16 @@ error: * * Programmer: unknown * ?? / ?? / ?? - * + * * Changes: Added the base_raw_cnt and base_meta_cnt fields and - * supporting code. This allows the test to adjust to the - * number of page buffer pages accessed during file open / + * supporting code. This allows the test to adjust to the + * number of page buffer pages accessed during file open / * create. * * The tests for the values of base_raw_cnt and base_meta_cnt - * just after file open exist detect changes in library - * behavior. Assuming any such change is not indicative of - * other issues, these tests can be modified to reflect the + * just after file open exist detect changes in library + * behavior. Assuming any such change is not indicative of + * other issues, these tests can be modified to reflect the * change. * * JRM -- 2/23/17 @@ -1179,7 +1184,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements))) FAIL_STACK_ERROR; - /* write all raw data, this would end up in page buffer since there + /* write all raw data, this would end up in page buffer since there * is no metadata yet * * Not necessarily -- opening the file may may load a metadata page. @@ -1237,7 +1242,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) /* write and read more raw data and make sure that they don't end up in * page buffer since the minimum metadata is actually the entire - * page buffer + * page buffer */ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0) FAIL_STACK_ERROR; @@ -1313,7 +1318,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements))) TEST_ERROR; - /* write all meta data, this would end up in page buffer since there + /* write all meta data, this would end up in page buffer since there * is no raw data yet */ for(i=0 ; i<100 ; i++) @@ -1368,7 +1373,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) /* write and read more meta data and make sure that they don't end up in * page buffer since the minimum metadata is actually the entire - * page buffer + * page buffer */ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*100), sizeof(int)*50, data) < 0) FAIL_STACK_ERROR; @@ -1400,8 +1405,8 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) HDprintf("\tMinimum metadata threshold = 40%%, Minimum rawdata threshold = 40%%\n"); page_count = 0; - /* keep 5 pages at max in the page buffer 2 meta pages, 2 raw pages - * minimum + /* keep 5 pages at max in the page buffer 2 meta pages, 2 raw pages + * minimum */ if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 40, 40) < 0) TEST_ERROR; @@ -1416,8 +1421,8 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) /* opening the file inserts one or more pages into the page buffer. * - * However, with the current 1 metadata page inserted into the - * the page buffer, it is not necessary to track the base raw and + * However, with the current 1 metadata page inserted into the + * the page buffer, it is not necessary to track the base raw and * metadata entry counts. */ @@ -1496,8 +1501,8 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) if(f->shared->page_buf->raw_count != 2) TEST_ERROR; - /* adding more meta entires should replace meta entries since raw data - * is at its minimum + /* adding more meta entires should replace meta entries since raw data + * is at its minimum */ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*100, data) < 0) FAIL_STACK_ERROR; @@ -1515,8 +1520,8 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*750), sizeof(int)*100, data) < 0) FAIL_STACK_ERROR; - /* adding 2 raw entries (even with 1 call) should only evict 1 meta - * entry and another raw entry + /* adding 2 raw entries (even with 1 call) should only evict 1 meta + * entry and another raw entry */ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*350), sizeof(int)*100, data) < 0) FAIL_STACK_ERROR; @@ -1640,8 +1645,8 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) if(f->shared->page_buf->raw_count != 4) TEST_ERROR; - /* write one more raw entry which should replace another raw entry - * keeping min threshold of meta entries + /* write one more raw entry which should replace another raw entry + * keeping min threshold of meta entries */ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*300), sizeof(int)*100, data) < 0) FAIL_STACK_ERROR; @@ -1655,8 +1660,8 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) if(f->shared->page_buf->raw_count != 4) TEST_ERROR; - /* write a metadata entry that should replace the metadata entry - * at the bottom of the LRU + /* write a metadata entry that should replace the metadata entry + * at the bottom of the LRU */ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*500), sizeof(int)*100, data) < 0) FAIL_STACK_ERROR; @@ -1681,7 +1686,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) HDfree(data); - PASSED() + PASSED(); return 0; @@ -1714,16 +1719,16 @@ error: * * Programmer: unknown * ?? / ?? / ?? - * + * * Changes: Added the base_raw_cnt and base_meta_cnt fields and - * supporting code. This allows the test to adjust to the - * number of page buffer pages accessed during file open / + * supporting code. This allows the test to adjust to the + * number of page buffer pages accessed during file open / * create. * * The tests for the values of base_raw_cnt and base_meta_cnt - * just after file open exist detect changes in library - * behavior. Assuming any such change is not indicative of - * other issues, these tests can be modified to reflect the + * just after file open exist detect changes in library + * behavior. Assuming any such change is not indicative of + * other issues, these tests can be modified to reflect the * change. * * JRM -- 2/23/17 @@ -1780,7 +1785,7 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. - * Get the raw and meta counts now, so we can adjust the expected + * Get the raw and meta counts now, so we can adjust the expected * statistics accordingly. */ HDassert(f); @@ -1987,7 +1992,7 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) HDfree(data); - PASSED() + PASSED(); return 0; error: @@ -2001,12 +2006,13 @@ error: return 1; } /* test_stats_collection */ +#endif /* #ifndef H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- * Function: verify_page_buffering_disabled() * - * Purpose: This function should only be called in parallel + * Purpose: This function should only be called in parallel * builds. * * At present, page buffering should be disabled in parallel @@ -2017,7 +2023,7 @@ error: * * Programmer: John Mainzer * 03/21/17 - * + * * Changes: None. * *------------------------------------------------------------------------- @@ -2064,7 +2070,7 @@ verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr) if(file_id >= 0) TEST_ERROR; - /* now, create a file, close it, and then try to open it with page + /* now, create a file, close it, and then try to open it with page * buffering enabled. */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) @@ -2084,7 +2090,7 @@ verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr) if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR; - /* try to open the file using the fapl prepared above which enables + /* try to open the file using the fapl prepared above which enables * page buffering. Should fail. */ H5E_BEGIN_TRY { @@ -2100,7 +2106,7 @@ verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr) if(H5Pclose(fapl) < 0) FAIL_STACK_ERROR; - PASSED() + PASSED(); return 0; @@ -2150,7 +2156,7 @@ main(void) * Page buffering depends on paged aggregation which is * currently disabled for multi/split drivers. */ - if((0 == HDstrcmp(env_h5_drvr, "multi")) || + if((0 == HDstrcmp(env_h5_drvr, "multi")) || (0 == HDstrcmp(env_h5_drvr, "split"))) { SKIPPED() @@ -2167,7 +2173,7 @@ main(void) if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; -#ifdef H5_HAVE_PARALLEL +#ifdef H5_HAVE_PARALLEL HDputs("Page Buffering is disabled for parallel."); nerrors += verify_page_buffering_disabled(fapl, env_h5_drvr); |