diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-06-11 03:28:57 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-06-11 03:28:57 (GMT) |
commit | 19e0ec17dd066748a739ecb9ac4cd584479ea92c (patch) | |
tree | 10f1b1e29b98545f0c92965128dab721595b22a7 /test/mf.c | |
parent | 4d2449d3827d2b9fc882b07fcd19243a3355df71 (diff) | |
download | hdf5-19e0ec17dd066748a739ecb9ac4cd584479ea92c.zip hdf5-19e0ec17dd066748a739ecb9ac4cd584479ea92c.tar.gz hdf5-19e0ec17dd066748a739ecb9ac4cd584479ea92c.tar.bz2 |
[svn-r17029] Description:
Adjust 'temporary' file space code to always be within the file's
address space, even when the file uses 32-bit addresses. (It's not really
necessary to be within the file's address space, since objects with temporary
addresses can't be written to the file, but it can't really hurt and it makes
the testing easier)
Tested on:
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode and with 'make check-vfd'
Diffstat (limited to 'test/mf.c')
-rw-r--r-- | test/mf.c | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -742,14 +742,19 @@ static unsigned test_mf_tmp(const char *env_h5_drvr, hid_t fapl) { hid_t file = -1; /* File ID */ + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("'temporary' file space allocation"); - /* Can't run this test with multi-file VFDs */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { + /* Skip test when using VFDs that has different address spaces for each + * type of metadata allocation. + */ + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ + haddr_t maxaddr; /* File's max. address */ haddr_t tmp_addr; /* Temporary space file address */ haddr_t norm_addr; /* Normal space file address */ haddr_t check_addr; /* File address for checking for errors */ @@ -780,12 +785,16 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Retrieve the file's maxaddr */ + if(H5F_get_maxaddr_test(file, &maxaddr) < 0) + FAIL_STACK_ERROR + /* Allocate some temporary address space */ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)TEST_BLOCK_SIZE30))) FAIL_STACK_ERROR /* Check if temporary file address is valid */ - if(tmp_addr < (haddr_t)(HADDR_MAX - TEST_BLOCK_SIZE30)) + if(tmp_addr < (haddr_t)(maxaddr - TEST_BLOCK_SIZE30)) TEST_ERROR /* Reading & writing with a temporary address value should fail */ @@ -829,29 +838,29 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Allocate 1/3 of the file as temporary address space */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)(HADDR_MAX / 3)))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3)))) FAIL_STACK_ERROR /* Allocate 1/3 of the file as normal address space */ - if(HADDR_UNDEF == (norm_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(HADDR_MAX / 3)))) + if(HADDR_UNDEF == (norm_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(maxaddr / 3)))) FAIL_STACK_ERROR /* Test that pushing temporary space allocation into normal space fails */ H5E_BEGIN_TRY { - check_addr = H5MF_alloc_tmp(f, (hsize_t)(HADDR_MAX / 3)); + check_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3)); } H5E_END_TRY; if(H5F_addr_defined(check_addr)) TEST_ERROR /* Test that pushing normal space allocation into temporary space fails */ H5E_BEGIN_TRY { - check_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(HADDR_MAX / 3)); + check_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(maxaddr / 3)); } H5E_END_TRY; if(H5F_addr_defined(check_addr)) TEST_ERROR /* Free the normal block (so the file doesn't blow up to a huge size) */ - if(H5MF_xfree(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, norm_addr, (hsize_t)(HADDR_MAX / 3)) < 0) + if(H5MF_xfree(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, norm_addr, (hsize_t)(maxaddr / 3)) < 0) FAIL_STACK_ERROR /* Close the file */ |