diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-02-24 17:59:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-02-24 17:59:14 (GMT) |
commit | 33a65add7db18a4efd2b34ac8261c2065820ebf9 (patch) | |
tree | 782730a42955d1a247fec9356c5d05f83cce4903 /test | |
parent | e63f0baf7e3a8e36c19f52d7692b483b7440e5eb (diff) | |
download | hdf5-33a65add7db18a4efd2b34ac8261c2065820ebf9.zip hdf5-33a65add7db18a4efd2b34ac8261c2065820ebf9.tar.gz hdf5-33a65add7db18a4efd2b34ac8261c2065820ebf9.tar.bz2 |
[svn-r16514] Description:
Merge r16440:16500 from trunk into revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/big.c | 8 | ||||
-rw-r--r-- | test/cmpd_dset.c | 2 | ||||
-rw-r--r-- | test/dsets.c | 203 | ||||
-rw-r--r-- | test/dt_arith.c | 222 | ||||
-rw-r--r-- | test/dtransform.c | 8 | ||||
-rw-r--r-- | test/earray.c | 4 | ||||
-rw-r--r-- | test/ntypes.c | 12 | ||||
-rw-r--r-- | test/tattr.c | 380 | ||||
-rw-r--r-- | test/tconfig.c | 2 | ||||
-rw-r--r-- | test/tmisc.c | 184 |
11 files changed, 866 insertions, 163 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 3a729fd..ae54149 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -104,8 +104,8 @@ flush2.chkexe_: flush1.chkexe_ # the temporary file name in ways that the makefile is not aware of. CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offset.h5 \ max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \ - huge_chunks.h5 chunk_cache.h5 chunk_fast.h5 extend.h5 istore.h5 \ - extlinks*.h5 frspace.h5 links*.h5 \ + huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_fast.h5 \ + extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 \ extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 dt_arith[1-2] \ links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \ @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define MAX_TRIES 100 #if H5_SIZEOF_LONG_LONG >= 8 -# define GB8LL ((unsigned long_long)8*1024*1024*1024) +# define GB8LL ((unsigned long long)8*1024*1024*1024) #else # define GB8LL 0 /*cannot do the test*/ #endif @@ -53,7 +53,7 @@ static hsize_t values_used[WRT_N]; /*------------------------------------------------------------------------- * Function: randll * - * Purpose: Create a random long_long value. + * Purpose: Create a random long long value. * Ensures that a write at this value doesn't overlap any * previous write. * @@ -577,8 +577,8 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); * because we would generate multi-gigabyte files. */ puts("Checking if file system is adequate for this test..."); - if (sizeof(long_long)<8 || 0==GB8LL) { - puts("Test skipped because sizeof(long_long) is too small. This"); + if (sizeof(long long)<8 || 0==GB8LL) { + puts("Test skipped because sizeof(long long) is too small. This"); puts("hardware apparently doesn't support 64-bit integer types."); usage(); goto quit; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index d1f317f..53c63d7 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -116,7 +116,7 @@ typedef struct { float f, g, h[16], i, j; double k, l, m, n; long o, p, q; - long_long r, s, t; + long long r, s, t; } stype4; #define NX 100u diff --git a/test/dsets.c b/test/dsets.c index 5ea5774..2df76cd 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -51,6 +51,7 @@ const char *FILENAME[] = { "random_chunks", "huge_chunks", "chunk_cache", + "big_chunk", "chunk_fast", NULL }; @@ -173,6 +174,12 @@ const char *FILENAME[] = { #define TOO_HUGE_CHUNK_DIM2_1 ((hsize_t)1024) #define TOO_HUGE_CHUNK_DIM2_2 ((hsize_t)1024) +/* Parameters for testing bypassing chunk cache */ +#define BYPASS_DATASET "Dset" +#define BYPASS_DIM 1000 +#define BYPASS_CHUNK_DIM 500 +#define BYPASS_FILL_VALUE 7 + /* Shared global arrays */ #define DSET_DIM1 100 #define DSET_DIM2 200 @@ -2607,11 +2614,11 @@ test_nbit_int(hid_t file) if((dataset = H5Dcreate2(file, DSET_NBIT_INT_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; - /* Initialize data, assuming size of long_long >= size of int */ + /* Initialize data, assuming size of long long >= size of int */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j] = (int)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision - 1))) << offset); + orig_data[i][j] = (int)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision - 1))) << offset); /* even-numbered values are negtive */ if((i*size[1]+j+1)%2 == 0) @@ -2917,7 +2924,7 @@ test_nbit_double(hid_t file) goto error; /* Check that the values read are the same as the values written - * Assume size of long_long = size of double + * Assume size of long long = size of double */ for(i=0; i<(size_t)size[0]; i++) { for(j=0; j<(size_t)size[1]; j++) { @@ -3019,13 +3026,13 @@ test_nbit_array(hid_t file) if((dataset = H5Dcreate2(file, DSET_NBIT_ARRAY_NAME, array_datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; - /* Initialize data, assuming size of long_long >= size of unsigned int */ + /* Initialize data, assuming size of long long >= size of unsigned int */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) for(m = 0; m < (size_t)adims[0]; m++) for(n = 0; n < (size_t)adims[1]; n++) - orig_data[i][j][m][n] = (unsigned int)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)precision)) << offset); + orig_data[i][j][m][n] = (unsigned int)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)precision)) << offset); PASSED(); #else SKIPPED(); @@ -3201,15 +3208,15 @@ test_nbit_compound(hid_t file) if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; - /* Initialize data, assuming size of long_long >= size of member datatypes */ + /* Initialize data, assuming size of long long >= size of member datatypes */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j].i = (int)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); - orig_data[i][j].c = (char)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); - orig_data[i][j].s = (short)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); + orig_data[i][j].i = (int)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); + orig_data[i][j].c = (char)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); + orig_data[i][j].s = (short)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].f = float_val[i][j]; /* some even-numbered integer values are negtive */ @@ -3448,33 +3455,33 @@ test_nbit_compound_2(hid_t file) if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; - /* Initialize data, assuming size of long_long >= size of member datatypes */ + /* Initialize data, assuming size of long long >= size of member datatypes */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j].a.i = (int)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); - orig_data[i][j].a.c = (char)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); - orig_data[i][j].a.s = (short)(-((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); + orig_data[i][j].a.i = (int)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); + orig_data[i][j].a.c = (char)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); + orig_data[i][j].a.s = (short)(-((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].a.f = float_val[i][j]; - orig_data[i][j].v = (unsigned int)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)precision[3])) << offset[3]); + orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)precision[3])) << offset[3]); for(m = 0; m < (size_t)array_dims[0]; m++) for(n = 0; n < (size_t)array_dims[1]; n++) - orig_data[i][j].b[m][n] = (char)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision[4]-1))) << offset[4]); + orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision[4]-1))) << offset[4]); for(m = 0; m < (size_t)array_dims[0]; m++) for(n = 0; n < (size_t)array_dims[1]; n++) { - orig_data[i][j].d[m][n].i = (int)(-((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); - orig_data[i][j].d[m][n].c = (char)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); - orig_data[i][j].d[m][n].s = (short)(((long_long)HDrandom() % - (long_long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); + orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); + orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); + orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % + (long long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].d[m][n].f = float_val[i][j]; } } @@ -6690,6 +6697,139 @@ error: /*------------------------------------------------------------------------- + * Function: test_big_chunks_bypass_cache + * + * Purpose: When the chunk size is bigger than the cache size and the + * chunk isn't on disk, this test verifies that the library + * bypasses the cache. + * + * Note: This test is not very conclusive - it doesn't actually check + * is the chunks bypass the cache... :-( -QAK + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Raymond Lu + * 11 Feb 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_big_chunks_bypass_cache(hid_t fapl) +{ + char filename[FILENAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t fapl_local = -1; /* File access property list ID */ + hid_t dcpl = -1; /* Dataset creation property list ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dsid = -1; /* Dataset ID */ + hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */ + size_t rdcc_nelmts, rdcc_nbytes; + int fvalue = BYPASS_FILL_VALUE; + hsize_t count, stride, offset, block; + static int wdata[BYPASS_CHUNK_DIM], rdata[BYPASS_DIM]; + int i, j; + herr_t ret; /* Generic return value */ + + TESTING("big chunks bypassing the cache"); + + h5_fixname(FILENAME[9], fapl, filename, sizeof filename); + + /* Copy fapl passed to this function (as we will be modifying it) */ + if((fapl_local = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR + + /* Define cache size to be smaller than chunk size */ + rdcc_nelmts = BYPASS_CHUNK_DIM/5; + rdcc_nbytes = sizeof(int)*BYPASS_CHUNK_DIM/5; + if(H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, 0) < 0) FAIL_STACK_ERROR + + /* Create file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_local)) < 0) FAIL_STACK_ERROR + + /* Create 1-D dataspace */ + dim = BYPASS_DIM; + if((sid = H5Screate_simple(1, &dim, NULL)) < 0) FAIL_STACK_ERROR + + /* Create dataset creation property list */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR + + /* Define chunk size. There will be only 2 chunks in the dataset. */ + chunk_dim = BYPASS_CHUNK_DIM; + if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR + + /* Define fill value, fill time, and chunk allocation time */ + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fvalue) < 0) FAIL_STACK_ERROR + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) FAIL_STACK_ERROR + if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR) < 0) FAIL_STACK_ERROR + + /* Try to create dataset */ + if((dsid = H5Dcreate2(fid, BYPASS_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Select first chunk to write the data */ + offset = 0; + count = 1; + stride = 1; + block = BYPASS_CHUNK_DIM; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &offset, &stride, &count, &block) < 0) + FAIL_STACK_ERROR + + /* Initialize data to write */ + for(i = 0; i < BYPASS_CHUNK_DIM; i++) + wdata[i] = i; + + /* This write should bypass the cache because the chunk is bigger than the cache size + * and it's not allocated on disk. */ + if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0) + FAIL_STACK_ERROR + + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + + /* Reopen the dataset */ + if((dsid = H5Dopen2(fid, BYPASS_DATASET, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Reads both 2 chunks. Reading the second chunk should bypass the cache because the + * chunk is bigger than the cache size and it isn't allocated on disk. */ + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) + FAIL_STACK_ERROR + + for(i = 0; i < BYPASS_CHUNK_DIM; i++) + if(rdata[i] != i) { + printf(" Read different values than written in the 1st chunk.\n"); + printf(" At line %d and index %d, rdata = %d. It should be %d.\n", __LINE__, i, rdata[i], i); + TEST_ERROR + } /* end if */ + + for(j = BYPASS_CHUNK_DIM; j < BYPASS_DIM; j++) + if(rdata[j] != fvalue) { + printf(" Read different values than written in the 2nd chunk.\n"); + printf(" At line %d and index %d, rdata = %d. It should be %d.\n", __LINE__, i, rdata[i], fvalue); + TEST_ERROR + } /* end if */ + + /* Close IDs */ + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Pclose(fapl_local) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Pclose(fapl_local); + H5Dclose(dsid); + H5Sclose(sid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; +} /* end test_big_chunks_bypass_cache() */ + + +/*------------------------------------------------------------------------- * Function: test_chunk_fast * * Purpose: Tests support for extensible arrays as chunk index. @@ -7050,6 +7190,7 @@ main(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0); + nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_fast(my_fapl) < 0 ? 1 : 0); if(H5Fclose(file) < 0) diff --git a/test/dt_arith.c b/test/dt_arith.c index 67885a3..e507fd0 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -1668,8 +1668,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) unsigned hw_uint; long hw_long; unsigned long hw_ulong; - long_long hw_llong; - unsigned long_long hw_ullong; + long long hw_llong; + unsigned long long hw_ullong; /* What are the names of the source and destination types */ if (H5Tequal(src, H5T_NATIVE_SCHAR)) { @@ -1766,7 +1766,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */ src_sign = H5Tget_sign(src); dst_sign = H5Tget_sign(dst); - aligned = HDcalloc(1, sizeof(long_long)); + aligned = HDcalloc(1, sizeof(long long)); /* Allocate and initialize the source buffer through macro INIT_INTEGER. The BUF * will be used for the conversion while the SAVED buffer will be @@ -1789,9 +1789,9 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) } else if(src_type == INT_ULONG) { INIT_INTEGER(unsigned long, ULONG_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts); } else if(src_type == INT_LLONG) { - INIT_INTEGER(long_long, LLONG_MAX, LLONG_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts); + INIT_INTEGER(long long, LLONG_MAX, LLONG_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts); } else if(src_type == INT_ULLONG) { - INIT_INTEGER(unsigned long_long, ULLONG_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts); + INIT_INTEGER(unsigned long long, ULLONG_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts); } else goto error; @@ -1837,12 +1837,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) hw_char = (signed char)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_char = (signed char)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_char = (signed char)(*((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_char = (signed char)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_char = (signed char)(*((unsigned long long*)aligned)); break; default: break; @@ -1883,12 +1883,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) hw_uchar = (unsigned char)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_uchar = (unsigned char)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_uchar = (unsigned char)(*((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_uchar = (unsigned char)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_uchar = (unsigned char)(*((unsigned long long*)aligned)); break; default: break; @@ -1929,12 +1929,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) hw_short = (short)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_short = (short)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_short = (short)(*((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_short = (short)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_short = (short)(*((unsigned long long*)aligned)); break; default: @@ -1976,12 +1976,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) hw_ushort = (unsigned short)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_ushort = (unsigned short)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_ushort = (unsigned short)(*((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_ushort = (unsigned short)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_ushort = (unsigned short)(*((unsigned long long*)aligned)); break; default: break; @@ -2022,12 +2022,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) hw_int = (int)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_int = (int)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_int = (int)(*((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_int = (int)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_int = (int)(*((unsigned long long*)aligned)); break; default: break; @@ -2068,12 +2068,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) hw_uint = (unsigned int)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_uint = (unsigned int)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_uint = (unsigned int)(*((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_uint = (unsigned int)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_uint = (unsigned int)(*((unsigned long long*)aligned)); break; default: break; @@ -2114,12 +2114,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) hw_long = (long int)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_long = (long int)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_long = (long int)(*((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_long = (long int)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_long = (long int)(*((unsigned long long*)aligned)); break; default: break; @@ -2160,12 +2160,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) hw_ulong = (unsigned long)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_ulong = (unsigned long)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_ulong = (unsigned long)(*((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_ulong = (unsigned long)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_ulong = (unsigned long)(*((unsigned long long*)aligned)); break; default: break; @@ -2175,43 +2175,43 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) switch (src_type) { case INT_SCHAR: HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char)); - hw_llong = (long_long)(*((char*)aligned)); + hw_llong = (long long)(*((char*)aligned)); break; case INT_UCHAR: HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char)); - hw_llong = (long_long)(*((unsigned char*)aligned)); + hw_llong = (long long)(*((unsigned char*)aligned)); break; case INT_SHORT: HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short)); - hw_llong = (long_long)(*((short*)aligned)); + hw_llong = (long long)(*((short*)aligned)); break; case INT_USHORT: HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short)); - hw_llong = (long_long)(*((unsigned short*)aligned)); + hw_llong = (long long)(*((unsigned short*)aligned)); break; case INT_INT: HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int)); - hw_llong = (long_long)(*((int*)aligned)); + hw_llong = (long long)(*((int*)aligned)); break; case INT_UINT: HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned)); - hw_llong = (long_long)(*((unsigned*)aligned)); + hw_llong = (long long)(*((unsigned*)aligned)); break; case INT_LONG: HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long)); - hw_llong = (long_long)(*((long*)aligned)); + hw_llong = (long long)(*((long*)aligned)); break; case INT_ULONG: HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long)); - hw_llong = (long_long)(*((unsigned long*)aligned)); + hw_llong = (long long)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_llong = (long_long)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_llong = (long long)(*((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_llong = (long_long)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_llong = (long long)(*((unsigned long long*)aligned)); break; default: break; @@ -2221,43 +2221,43 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) switch (src_type) { case INT_SCHAR: HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char)); - hw_ullong = (unsigned long_long)(*((signed char*)aligned)); + hw_ullong = (unsigned long long)(*((signed char*)aligned)); break; case INT_UCHAR: HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char)); - hw_ullong = (unsigned long_long)(*((unsigned char*)aligned)); + hw_ullong = (unsigned long long)(*((unsigned char*)aligned)); break; case INT_SHORT: HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short)); - hw_ullong = (unsigned long_long)(*((short*)aligned)); + hw_ullong = (unsigned long long)(*((short*)aligned)); break; case INT_USHORT: HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short)); - hw_ullong = (unsigned long_long)(*((unsigned short*)aligned)); + hw_ullong = (unsigned long long)(*((unsigned short*)aligned)); break; case INT_INT: HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int)); - hw_ullong = (unsigned long_long)(*((int*)aligned)); + hw_ullong = (unsigned long long)(*((int*)aligned)); break; case INT_UINT: HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned)); - hw_ullong = (unsigned long_long)(*((unsigned*)aligned)); + hw_ullong = (unsigned long long)(*((unsigned*)aligned)); break; case INT_LONG: HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long)); - hw_ullong = (unsigned long_long)(*((long*)aligned)); + hw_ullong = (unsigned long long)(*((long*)aligned)); break; case INT_ULONG: HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long)); - hw_ullong = (unsigned long_long)(*((unsigned long*)aligned)); + hw_ullong = (unsigned long long)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_ullong = (unsigned long_long)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_ullong = (unsigned long long)(*((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_ullong = (unsigned long_long)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_ullong = (unsigned long long)(*((unsigned long long*)aligned)); break; default: break; @@ -2426,12 +2426,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) printf(" %29lu\n", *((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned)); break; default: break; @@ -2475,12 +2475,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) printf(" %29lu\n", *((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, buf+j*sizeof(long_long), sizeof(long_long)); - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned)); + HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(long long)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, buf+j*sizeof(long_long), sizeof(unsigned long_long)); - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)aligned)); + HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(unsigned long long)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned)); break; default: break; @@ -2516,10 +2516,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) printf(" %29lu\n", *((unsigned long*)hw)); break; case INT_LLONG: - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)hw)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)hw)); break; case INT_ULLONG: - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)hw)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw)); break; default: break; @@ -3478,8 +3478,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) unsigned hw_uint=0; long hw_long=0; unsigned long hw_ulong=0; - long_long hw_llong=0; - unsigned long_long hw_ullong=0; + long long hw_llong=0; + unsigned long long hw_ullong=0; /* What is the name of the source type */ if (H5Tequal(src, H5T_NATIVE_SCHAR)) { @@ -3650,7 +3650,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) dst_size = H5Tget_size(dst); src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */ dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */ - aligned = HDcalloc(1, MAX(sizeof(long double), sizeof(long_long))); + aligned = HDcalloc(1, MAX(sizeof(long double), sizeof(long long))); #ifdef SHOW_OVERFLOWS noverflows_g = 0; #endif @@ -3707,9 +3707,9 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) } else if(src_type == INT_ULONG) { INIT_INTEGER(unsigned long, ULONG_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts); } else if(src_type == INT_LLONG) { - INIT_INTEGER(long_long, LLONG_MAX, LLONG_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts); + INIT_INTEGER(long long, LLONG_MAX, LLONG_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts); } else if(src_type == INT_ULLONG) { - INIT_INTEGER(unsigned long_long, ULLONG_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts); + INIT_INTEGER(unsigned long long, ULLONG_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts); } else if(src_type == FLT_FLOAT) { if(run_test==TEST_NORMAL) { INIT_FP_NORM(float, FLT_MAX, FLT_MIN, FLT_MAX_10_EXP, FLT_MIN_10_EXP, @@ -3795,13 +3795,13 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) hw_float = (float)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_float = (float)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_float = (float)(*((long long*)aligned)); break; #ifdef H5_ULLONG_TO_FP_CAST_WORKS case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_float = (float)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_float = (float)(*((unsigned long long*)aligned)); break; #endif /* H5_ULLONG_TO_FP_CAST_WORKS */ default: @@ -3843,13 +3843,13 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) hw_double = (double)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_double = (double)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_double = (double)(*((long long*)aligned)); break; #ifdef H5_ULLONG_TO_FP_CAST_WORKS case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_double = (double)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_double = (double)(*((unsigned long long*)aligned)); break; #endif /* H5_ULLONG_TO_FP_CAST_WORKS */ default: @@ -3892,13 +3892,13 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) hw_ldouble = (long double)(*((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - hw_ldouble = (long double)(*((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + hw_ldouble = (long double)(*((long long*)aligned)); break; #ifdef H5_ULLONG_TO_FP_CAST_WORKS case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - hw_ldouble = (long double)(*((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + hw_ldouble = (long double)(*((unsigned long long*)aligned)); break; #endif /* H5_ULLONG_TO_FP_CAST_WORKS */ default: @@ -4070,16 +4070,16 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) switch (src_type) { case FLT_FLOAT: HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float)); - hw_llong = (long_long)(*((float*)aligned)); + hw_llong = (long long)(*((float*)aligned)); break; case FLT_DOUBLE: HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double)); - hw_llong = (long_long)(*((double*)aligned)); + hw_llong = (long long)(*((double*)aligned)); break; #if H5_SIZEOF_LONG_DOUBLE !=0 case FLT_LDOUBLE: HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double)); - hw_llong = (long_long)(*((long double*)aligned)); + hw_llong = (long long)(*((long double*)aligned)); break; #endif default: @@ -4090,16 +4090,16 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) switch (src_type) { case FLT_FLOAT: HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float)); - hw_ullong = (unsigned long_long)(*((float*)aligned)); + hw_ullong = (unsigned long long)(*((float*)aligned)); break; case FLT_DOUBLE: HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double)); - hw_ullong = (unsigned long_long)(*((double*)aligned)); + hw_ullong = (unsigned long long)(*((double*)aligned)); break; #if H5_SIZEOF_LONG_DOUBLE !=0 case FLT_LDOUBLE: HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double)); - hw_ullong = (unsigned long_long)(*((long double*)aligned)); + hw_ullong = (unsigned long long)(*((long double*)aligned)); break; #endif default: @@ -4258,10 +4258,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) if((tmp_s+1)==tmp_h || (tmp_s-1)==tmp_h) continue; /*no error*/ } /* end if */ - else if (dst_size==sizeof(unsigned long_long)) { - unsigned long_long tmp_s, tmp_h; - HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned long_long)); - HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned long_long)); + else if (dst_size==sizeof(unsigned long long)) { + unsigned long long tmp_s, tmp_h; + HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned long long)); + HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned long long)); if((tmp_s+1)==tmp_h || (tmp_s-1)==tmp_h) continue; /*no error*/ } /* end if */ @@ -4273,9 +4273,9 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) */ #ifndef H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS if((src_type==FLT_FLOAT || src_type==FLT_DOUBLE) && dst_type==INT_ULLONG) { - unsigned long_long tmp_s, tmp_h; - HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned long_long)); - HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned long_long)); + unsigned long long tmp_s, tmp_h; + HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned long long)); + HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned long long)); if((tmp_s+1)==tmp_h) continue; /*no error*/ } @@ -4347,12 +4347,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) printf(" %29lu\n", *((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)aligned)); + HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned)); break; case FLT_FLOAT: HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float)); @@ -4410,12 +4410,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) printf(" %29lu\n", *((unsigned long*)aligned)); break; case INT_LLONG: - HDmemcpy(aligned, buf+j*sizeof(long_long), sizeof(long_long)); - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned)); + HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(long long)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned)); break; case INT_ULLONG: - HDmemcpy(aligned, buf+j*sizeof(unsigned long_long), sizeof(unsigned long_long)); - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)aligned)); + HDmemcpy(aligned, buf+j*sizeof(unsigned long long), sizeof(unsigned long long)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned)); break; case FLT_FLOAT: HDmemcpy(aligned, buf+j*sizeof(float), sizeof(float)); @@ -4465,10 +4465,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) printf(" %29lu\n", *((unsigned long*)hw)); break; case INT_LLONG: - printf(" %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)hw)); + printf(" %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)hw)); break; case INT_ULLONG: - printf(" %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)hw)); + printf(" %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw)); break; case FLT_FLOAT: printf(" %29f\n", *((float*)hw)); diff --git a/test/dtransform.c b/test/dtransform.c index c5a4fa8..3297fe6 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -265,14 +265,14 @@ int main(void) TEST_TYPE_CONTIG(dxpl_id_utrans_inv, unsigned long, H5T_NATIVE_ULONG, "ulong", transformData, 0); #ifdef H5_LLONG_TO_FP_CAST_WORKS - TEST_TYPE_CONTIG(dxpl_id_c_to_f, long_long, H5T_NATIVE_LLONG, "llong", windchillFfloat, 1); + TEST_TYPE_CONTIG(dxpl_id_c_to_f, long long, H5T_NATIVE_LLONG, "llong", windchillFfloat, 1); #else TESTING("contiguous, with type conversion (float->llong)") SKIPPED() #endif #ifdef H5_ULLONG_TO_FP_CAST_WORKS - TEST_TYPE_CONTIG(dxpl_id_utrans_inv, unsigned long_long, H5T_NATIVE_ULLONG, "ullong", transformData, 0); + TEST_TYPE_CONTIG(dxpl_id_utrans_inv, unsigned long long, H5T_NATIVE_ULLONG, "ullong", transformData, 0); #else TESTING("contiguous, with type conversion (float->ullong)") SKIPPED() @@ -293,14 +293,14 @@ int main(void) TEST_TYPE_CHUNK(dxpl_id_c_to_f, long, H5T_NATIVE_LONG, "long", windchillFfloat, 1); TEST_TYPE_CHUNK(dxpl_id_utrans_inv, unsigned long, H5T_NATIVE_ULONG, "ulong", transformData, 0); #ifdef H5_LLONG_TO_FP_CAST_WORKS - TEST_TYPE_CHUNK(dxpl_id_c_to_f, long_long, H5T_NATIVE_LLONG, "llong", windchillFfloat, 1); + TEST_TYPE_CHUNK(dxpl_id_c_to_f, long long, H5T_NATIVE_LLONG, "llong", windchillFfloat, 1); #else TESTING("chunked, with type conversion (float->llong)") SKIPPED() #endif #ifdef H5_ULLONG_TO_FP_CAST_WORKS - TEST_TYPE_CHUNK(dxpl_id_utrans_inv, unsigned long_long, H5T_NATIVE_ULLONG, "ullong", transformData, 0); + TEST_TYPE_CHUNK(dxpl_id_utrans_inv, unsigned long long, H5T_NATIVE_ULLONG, "ullong", transformData, 0); #else TESTING("chunked, with type conversion (float->ullong)") SKIPPED() diff --git a/test/earray.c b/test/earray.c index 6935a15..7b68e95 100644 --- a/test/earray.c +++ b/test/earray.c @@ -2381,14 +2381,14 @@ main(void) nelmts = (hsize_t)(1 + cparam.idx_blk_elmts + tparam.sblk_info[sblk].start_idx + (tparam.sblk_info[sblk].dblk_nelmts * dblk)); - sprintf(test_str, "setting first element of array's data block #%llu", (unsigned long_long)ndblks); + sprintf(test_str, "setting first element of array's data block #%llu", (unsigned long long)ndblks); nerrors += test_set_elmts(fapl, &cparam, &tparam, nelmts, test_str); /* Test all elements in data block */ nelmts = (hsize_t)(cparam.idx_blk_elmts + tparam.sblk_info[sblk].start_idx + (tparam.sblk_info[sblk].dblk_nelmts * (dblk + 1))); - sprintf(test_str, "setting all elements of array's data block #%llu", (unsigned long_long)ndblks); + sprintf(test_str, "setting all elements of array's data block #%llu", (unsigned long long)ndblks); nerrors += test_set_elmts(fapl, &cparam, &tparam, nelmts, test_str); /* Increment data block being tested */ diff --git a/test/ntypes.c b/test/ntypes.c index c8e7ccd..a82f051 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -284,7 +284,7 @@ test_compound_dtype2(hid_t file) char c; int i; s2 st; - unsigned long_long l; + unsigned long long l; } s1; hid_t dataset, space; hid_t dtype, native_type, tid, tid2, tid_m, tid_m2, @@ -310,7 +310,7 @@ test_compound_dtype2(hid_t file) temp_point->i = n++; temp_point->st.c2 = (short)(i + j); temp_point->st.l2 = (i * 5 + j * 50) * n; - temp_point->l = (unsigned long_long)((i * 10 + j * 100) * n); + temp_point->l = (unsigned long long)((i * 10 + j * 100) * n); } } @@ -531,7 +531,7 @@ test_compound_dtype(hid_t file) typedef struct { char c; unsigned int i; - long_long l; + long long l; } s1; hid_t dataset, space; hid_t dtype, native_type, tid, tid2, mem_id; @@ -703,7 +703,7 @@ test_compound_dtype3(hid_t file) typedef struct { char c; int a[5]; - long_long l; + long long l; } s1; hid_t dataset, space; hid_t dtype, native_type, tid, tid2, tid_m, tid_m2, @@ -902,7 +902,7 @@ test_compound_opaque(hid_t file) typedef struct { char c; unsigned char o[5]; - long_long l; + long long l; } s1; hid_t dataset, space; hid_t dtype, native_type, tid, tid2, tid_m, @@ -1218,7 +1218,7 @@ test_array_dtype(hid_t file) typedef struct { char c; int i; - long_long l; + long long l; } s1; hid_t dataset, space; hid_t dtype, native_type, tid, tid2, tid3, tid_m; diff --git a/test/tattr.c b/test/tattr.c index fe092e6..4b130e6 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -135,6 +135,10 @@ float attr_data5=(float)-5.123; /* Test data for 5th attribute */ #define BUG2_NATTR 100 #define BUG2_NATTR2 16 +#define BUG3_DSET_NAME "dset" +#define BUG3_DT_NAME "dt" +#define BUG3_ATTR_NAME "attr" + /* Attribute iteration struct */ typedef struct { H5_iter_order_t order; /* Direction of iteration */ @@ -9288,7 +9292,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) attr = H5Acreate2(dataset, attrname, attr_tid, big_sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); - /* Check that attribute is shared */ + /* ChecFk that attribute is shared */ is_shared = H5A_is_shared_test(attr); VERIFY(is_shared, TRUE, "H5A_is_shared_test"); @@ -9773,6 +9777,374 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /**************************************************************** ** +** test_attr_bug3(): Test basic H5A (attribute) code. +** Tests creating and deleting attributes which use a +** datatype and/or dataspace stored in the same object +** header. +** +****************************************************************/ +static void +test_attr_bug3(hid_t fcpl, hid_t fapl) +{ + hid_t fid; /* File ID */ + hid_t aid1, aid2; /* Attribute IDs */ + hid_t sid1, sid2; /* Dataspace ID */ + hid_t tid1, tid2; /* Datatype IDs */ + hid_t did; /* Dataset ID */ + hsize_t dims1[2] = {2, 2}, + dims2[2] = {3, 3}; /* Dimensions */ + int wdata1[2][2]; + unsigned wdata2[3][3]; /* Write buffers */ + herr_t ret; /* Generic return status */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Attributes in the Same Header as their Datatypes\n")); + + /* Create dataspaces */ + sid1 = H5Screate_simple(2, dims1, NULL); + CHECK(sid1, FAIL, "H5Screate_simple"); + sid2 = H5Screate_simple(2, dims2, NULL); + CHECK(sid2, FAIL, "H5Screate_simple"); + + /* Create file to operate on */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create datatypes and commit tid1 */ + tid1 = H5Tcopy(H5T_STD_I16BE); + CHECK(tid1, FAIL, "H5Tcopy"); + tid2 = H5Tcopy(H5T_STD_U64LE); + CHECK(tid1, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "dtype", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + + /* Create dataset */ + did = H5Dcreate2(fid, "dset", tid2, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dcreate2"); + + /* Create attribute on datatype, using that datatype as its datatype */ + aid1 = H5Acreate2(tid1, "attr", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid1, FAIL, "H5Acreate2"); + + /* Create attribute on dataset, using its datatype and dataspace */ + aid2 = H5Acreate2(did, "attr", tid2, sid2, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid2, FAIL, "H5Acreate2"); + + /* Close attributes */ + ret = H5Aclose(aid1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aid2); + CHECK(ret, FAIL, "H5Aclose"); + + /* Reopen attributes */ + aid1 = H5Aopen(tid1, "attr", H5P_DEFAULT); + CHECK(aid1, FAIL, "H5Aopen"); + aid2 = H5Aopen(did, "attr", H5P_DEFAULT); + CHECK(aid2, FAIL, "H5Aopen"); + + /* Write data to the attributes (the data is uninitialized, we only care + * that H5Awrite succeeds for now) */ + ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1[0]); + CHECK(ret, FAIL, "H5Awrite"); + ret = H5Awrite(aid2, H5T_NATIVE_UINT, wdata2[0]); + CHECK(ret, FAIL, "H5Awrite"); + + /* Close attributes */ + ret = H5Aclose(aid1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aid2); + CHECK(ret, FAIL, "H5Aclose"); + + /* Delete attributes */ + ret = H5Adelete(tid1, "attr"); + CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete(did, "attr"); + CHECK(ret, FAIL, "H5Adelete"); + + /* Recreate attributes */ + aid1 = H5Acreate2(tid1, "attr", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid1, FAIL, "H5Acreate2"); + aid2 = H5Acreate2(did, "attr", tid2, sid2, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid2, FAIL, "H5Acreate2"); + + /* Delete attributes (note they are still open) */ + ret = H5Adelete(tid1, "attr"); + CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete(did, "attr"); + CHECK(ret, FAIL, "H5Adelete"); + + /* Close dataspaces and transient datatype */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Sclose(sid2); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Tclose(tid2); + CHECK(ret, FAIL, "H5Tclose"); + + /* Close dataset and committed datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + + /* Delete dataset and committed datatype */ + ret = H5Ldelete(fid, "dtype", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Ldelete(fid, "dset", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close attributes */ + ret = H5Aclose(aid1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aid2); + CHECK(ret, FAIL, "H5Aclose"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); +} /* test_attr_bug3() */ + +/**************************************************************** +** +** test_attr_bug4(): Test basic H5A (attribute) code. +** Attempts to trigger a bug which would result in being +** unable to add an attribute to a named datatype. This +** happened when an object header chunk was too small to +** hold a continuation message and could not be extended. +** +****************************************************************/ +static void +test_attr_bug4(hid_t fcpl, hid_t fapl) +{ + hid_t fid; /* File ID */ + hid_t gid; /* Group ID */ + hid_t aid1, aid2, aid3; /* Attribute IDs */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hid_t did; /* Dataset ID */ + hsize_t dims[1] = {5}; /* Attribute dimensions */ + herr_t ret; /* Generic return status */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing that attributes can always be added to named datatypes\n")); + + /* Create dataspace */ + sid = H5Screate_simple(1, dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + /* Create file */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Open root group */ + gid = H5Gopen2(fid, "/", H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gcreate2"); + + /* Create committed datatype */ + tid = H5Tcopy(H5T_STD_I32LE); + CHECK(tid, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "dtype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + + /* Create dataset */ + did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dcreate2"); + + /* Create attributes on group and dataset */ + aid1 = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid1, FAIL, "H5Acreate2"); + aid2 = H5Acreate2(did, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid2, FAIL, "H5Acreate2"); + + /* Create attribute on datatype (this is the main test) */ + aid3 = H5Acreate2(tid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid3, FAIL, "H5Acreate2"); + + /* Close IDs */ + ret = H5Aclose(aid3); + CHECK(ret, FAIL, "H5Aclose"); + + ret = H5Aclose(aid2); + CHECK(ret, FAIL, "H5Aclose"); + + ret = H5Aclose(aid1); + CHECK(ret, FAIL, "H5Aclose"); + + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Tclose(tid); + CHECK(ret, FAIL, "H5Tclose"); + + ret = H5Gclose(gid); + CHECK(ret, FAIL, "H5Gclose"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); +} /* test_attr_bug4() */ + +/**************************************************************** +** +** test_attr_bug5(): Test basic H5A (attribute) code. +** Tests opening an attribute multiple times through +** objects opened through different file handles. +** +****************************************************************/ +static void +test_attr_bug5(hid_t fcpl, hid_t fapl) +{ + hid_t fid1, fid2; /* File IDs */ + hid_t gid1, gid2; /* Group IDs */ + hid_t did1, did2; /* Dataset IDs */ + hid_t tid1, tid2; /* Datatype IDs */ + hid_t aidg1, aidg2, + aidd1, aidd2, + aidt1, aidt2; /* Attribute IDs */ + hid_t sid; /* Dataspace ID */ + hsize_t dims[1] = {5}; /* Attribute dimensions */ + herr_t ret; /* Generic return status */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Opening an Attribute Through Multiple Files Concurrently\n")); + + /* Create dataspace ID for attributes and datasets */ + sid = H5Screate_simple(1, dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + /* Create file */ + fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid1, FAIL, "H5Fcreate"); + + /* Open root group */ + gid1 = H5Gopen2(fid1, "/", H5P_DEFAULT); + CHECK(gid1, FAIL, "H5Gopen2"); + + /* Create and commit datatype */ + tid1 = H5Tcopy(H5T_STD_I32LE); + CHECK(tid1, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid1, BUG3_DT_NAME, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + + /* Create dataset */ + did1 = H5Dcreate2(fid1, BUG3_DSET_NAME, tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(did1, FAIL, "H5Dcreate2"); + + /* Create attribute on root group */ + aidg1 = H5Acreate2(gid1, BUG3_ATTR_NAME, tid1, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aidg1, FAIL, "H5Acreate2"); + + /* Create attribute on dataset */ + aidd1 = H5Acreate2(did1, BUG3_ATTR_NAME, tid1, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aidd1, FAIL, "H5Acreate2"); + + /* Create attribute on datatype */ + aidt1 = H5Acreate2(tid1, BUG3_ATTR_NAME, tid1, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aidt1, FAIL, "H5Acreate2"); + + /* Close all IDs */ + ret = H5Aclose(aidt1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aidd1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aidg1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Dclose(did1); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Gclose(gid1); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + + /* Open file twice */ + fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, fapl); + CHECK(fid1, FAIL, "H5Fopen"); + fid2 = H5Fopen(FILENAME, H5F_ACC_RDONLY, fapl); + CHECK(fid2, FAIL, "H5Fopen"); + + /* Open the root group twice */ + gid1 = H5Gopen2(fid1, "/", H5P_DEFAULT); + CHECK(gid1, FAIL, "H5Gopen2"); + gid2 = H5Gopen2(fid2, "/", H5P_DEFAULT); + CHECK(gid2, FAIL, "H5Gopen2"); + + /* Open the root group attribute twice */ + aidg1 = H5Aopen(gid1, BUG3_ATTR_NAME, H5P_DEFAULT); + CHECK(aidg1, FAIL, "H5Aopen"); + aidg2 = H5Aopen(gid2, BUG3_ATTR_NAME, H5P_DEFAULT); + CHECK(aidg1, FAIL, "H5Aopen"); + + /* Open the dataset twice */ + did1 = H5Dopen2(fid1, BUG3_DSET_NAME, H5P_DEFAULT); + CHECK(did1, FAIL, "H5Dopen2"); + did2 = H5Dopen2(fid2, BUG3_DSET_NAME, H5P_DEFAULT); + CHECK(did2, FAIL, "H5Dopen2"); + + /* Open the dataset attribute twice */ + aidd1 = H5Aopen(did1, BUG3_ATTR_NAME, H5P_DEFAULT); + CHECK(aidd1, FAIL, "H5Aopen"); + aidd2 = H5Aopen(did2, BUG3_ATTR_NAME, H5P_DEFAULT); + CHECK(aidd1, FAIL, "H5Aopen"); + + /* Open the datatype twice */ + tid1 = H5Topen2(fid1, BUG3_DT_NAME, H5P_DEFAULT); + CHECK(tid1, FAIL, "H5Topen2"); + tid2 = H5Topen2(fid2, BUG3_DT_NAME, H5P_DEFAULT); + CHECK(tid2, FAIL, "H5Topen2"); + + /* Open the datatype attribute twice */ + aidt1 = H5Aopen(tid1, BUG3_ATTR_NAME, H5P_DEFAULT); + CHECK(aidt1, FAIL, "H5Aopen"); + aidt2 = H5Aopen(tid2, BUG3_ATTR_NAME, H5P_DEFAULT); + CHECK(aidt2, FAIL, "H5Aopen"); + + /* Close all attributes */ + ret = H5Aclose(aidg1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aidg2); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aidd1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aidd2); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aidt1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aidt2); + CHECK(ret, FAIL, "H5Aclose"); + + /* Close root groups */ + ret = H5Gclose(gid1); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Gclose(gid2); + CHECK(ret, FAIL, "H5Gclose"); + + /* Close datasets */ + ret = H5Dclose(did1); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Dclose(did2); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close datatypes */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Tclose(tid2); + CHECK(ret, FAIL, "H5Tclose"); + + /* Close files */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); +} /* test_attr_bug5() */ + +/**************************************************************** +** ** test_attr(): Main H5A (attribute) testing routine. ** ****************************************************************/ @@ -9913,6 +10285,9 @@ test_attr(void) /* Tests that address specific bugs */ test_attr_bug1(my_fcpl, my_fapl); /* Test odd allocation operations */ test_attr_bug2(my_fcpl, my_fapl); /* Test many deleted attributes */ + test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */ + test_attr_bug4(my_fcpl, my_fapl); /* Test attributes on named datatypes */ + test_attr_bug5(my_fcpl, my_fapl); /* Test opening/closing attributes through different file handles */ } /* end for */ } /* end if */ else { @@ -9933,6 +10308,9 @@ test_attr(void) /* Tests that address specific bugs */ test_attr_bug1(fcpl, my_fapl); /* Test odd allocation operations */ test_attr_bug2(fcpl, my_fapl); /* Test many deleted attributes */ + test_attr_bug3(fcpl, my_fapl); /* Test "self referential" attributes */ + test_attr_bug4(fcpl, my_fapl); /* Test attributes on named datatypes */ + test_attr_bug5(fcpl, my_fapl); /* Test opening/closing attributes through different file handles */ } /* end else */ } /* end for */ diff --git a/test/tconfig.c b/test/tconfig.c index d4d7d4b..355191d 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -127,7 +127,7 @@ test_config_ctypes(void) /* standard C99 basic types */ #if H5_SIZEOF_LONG_LONG > 0 - vrfy_cint_type(long_long, unsigned long_long, H5_SIZEOF_LONG_LONG); + vrfy_cint_type(long long, unsigned long long, H5_SIZEOF_LONG_LONG); #endif #if H5_SIZEOF_INT8_T > 0 diff --git a/test/tmisc.c b/test/tmisc.c index 746af5d..9ac2bc4 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -300,6 +300,11 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset #define MISC27_FILE "tbad_msg_count.h5" #define MISC27_GROUP "Group" +/* Definitions for misc. test #28 */ +#define MISC28_FILE "tmisc28.h5" +#define MISC28_SIZE 10 +#define MISC28_NSLOTS 10000 + /**************************************************************** ** ** test_misc1(): test unlinking a dataset from a group and immediately @@ -4854,6 +4859,183 @@ test_misc27(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc27() */ + +/**************************************************************** +** +** test_misc28(): Ensure that the dataset chunk cache will hold +** the correct number of chunks in cache without +** evicting them. +** +****************************************************************/ +static void +test_misc28(void) +{ + hid_t fid; /* File ID */ + hid_t sidf; /* File Dataspace ID */ + hid_t sidm; /* Memory Dataspace ID */ + hid_t did; /* Dataset ID */ + hid_t dcpl, fapl; /* Property List IDs */ + hsize_t dims[] = {MISC28_SIZE, MISC28_SIZE}; + hsize_t mdims[] = {MISC28_SIZE}; + hsize_t cdims[] = {1, 1}; + hsize_t start[] = {0,0}; + hsize_t count[] = {MISC28_SIZE, 1}; + size_t nbytes_used; + int nused; + char buf[MISC28_SIZE]; + int i; + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Dataset chunk cache\n")); + + /* Create the fapl and set the cache size. Set nelmts to larger than the + * file size so we can be guaranteed that no chunks will be evicted due to + * a hash collision. Set nbytes to fit exactly 1 column of chunks (10 + * bytes). */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75); + CHECK(ret, FAIL, "H5Pset_cache"); + + /* Create the dcpl and set the chunk size */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + ret = H5Pset_chunk(dcpl, 2, cdims); + CHECK(ret, FAIL, "H5Pset_chunk"); + + + /* Create a new file and datasets within that file that use these + * property lists + */ + fid = H5Fcreate(MISC28_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + sidf = H5Screate_simple(2, dims, NULL); + CHECK(sidf, FAIL, "H5Screate_simple"); + + did = H5Dcreate2(fid, "dataset", H5T_NATIVE_CHAR, sidf, H5P_DEFAULT, dcpl, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dcreate2"); + + /* Verify that the chunk cache is empty */ + ret = H5D_current_cache_size_test(did, &nbytes_used, &nused); + CHECK(ret, FAIL, "H5D_current_cache_size_test"); + VERIFY(nbytes_used, (size_t) 0, "H5D_current_cache_size_test"); + VERIFY(nused, 0, "H5D_current_cache_size_test"); + + /* Initialize write buffer */ + for(i=0; i<MISC28_SIZE; i++) + buf[i] = i; + + /* Create memory dataspace and selection in file dataspace */ + sidm = H5Screate_simple(1, mdims, NULL); + CHECK(sidm, FAIL, "H5Screate_simple"); + + ret = H5Sselect_hyperslab(sidf, H5S_SELECT_SET, start, NULL, count, NULL); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Write hypserslab */ + ret = H5Dwrite(did, H5T_NATIVE_CHAR, sidm, sidf, H5P_DEFAULT, buf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Verify that all 10 chunks written have been cached */ + ret = H5D_current_cache_size_test(did, &nbytes_used, &nused); + CHECK(ret, FAIL, "H5D_current_cache_size_test"); + VERIFY(nbytes_used, (size_t) MISC28_SIZE, "H5D_current_cache_size_test"); + VERIFY(nused, MISC28_SIZE, "H5D_current_cache_size_test"); + + /* Initialize write buffer */ + for(i=0; i<MISC28_SIZE; i++) + buf[i] = MISC28_SIZE - 1 - i; + + /* Select new hyperslab */ + start[1] = 1; + ret = H5Sselect_hyperslab(sidf, H5S_SELECT_SET, start, NULL, count, NULL); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Write hyperslab */ + ret = H5Dwrite(did, H5T_NATIVE_CHAR, sidm, sidf, H5P_DEFAULT, buf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Verify that the size of the cache remains at 10 */ + ret = H5D_current_cache_size_test(did, &nbytes_used, &nused); + CHECK(ret, FAIL, "H5D_current_cache_size_test"); + VERIFY(nbytes_used, (size_t) MISC28_SIZE, "H5D_current_cache_size_test"); + VERIFY(nused, MISC28_SIZE, "H5D_current_cache_size_test"); + + /* Close dataset */ + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + + + /* Re open dataset */ + did = H5Dopen2(fid, "dataset", H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); + + /* Verify that the chunk cache is empty */ + ret = H5D_current_cache_size_test(did, &nbytes_used, &nused); + CHECK(ret, FAIL, "H5D_current_cache_size_test"); + VERIFY(nbytes_used, (size_t) 0, "H5D_current_cache_size_test"); + VERIFY(nused, 0, "H5D_current_cache_size_test"); + + /* Select hyperslabe for reading */ + start[1] = 0; + ret = H5Sselect_hyperslab(sidf, H5S_SELECT_SET, start, NULL, count, NULL); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Read hypserslab */ + ret = H5Dread(did, H5T_NATIVE_CHAR, sidm, sidf, H5P_DEFAULT, buf); + CHECK(ret, FAIL, "H5Dread"); + + /* Verify the data read */ + for(i=0; i<MISC28_SIZE; i++) + VERIFY(buf[i], i, "H5Dread"); + + /* Verify that all 10 chunks read have been cached */ + ret = H5D_current_cache_size_test(did, &nbytes_used, &nused); + CHECK(ret, FAIL, "H5D_current_cache_size_test"); + VERIFY(nbytes_used, (size_t) MISC28_SIZE, "H5D_current_cache_size_test"); + VERIFY(nused, MISC28_SIZE, "H5D_current_cache_size_test"); + + /* Select new hyperslab */ + start[1] = 1; + ret = H5Sselect_hyperslab(sidf, H5S_SELECT_SET, start, NULL, count, NULL); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Read hyperslab */ + ret = H5Dread(did, H5T_NATIVE_CHAR, sidm, sidf, H5P_DEFAULT, buf); + CHECK(ret, FAIL, "H5Dread"); + + /* Verify the data read */ + for(i=0; i<MISC28_SIZE; i++) + VERIFY(buf[i], MISC28_SIZE - 1 - i, "H5Dread"); + + /* Verify that the size of the cache remains at 10 */ + ret = H5D_current_cache_size_test(did, &nbytes_used, &nused); + CHECK(ret, FAIL, "H5D_current_cache_size_test"); + VERIFY(nbytes_used, (size_t) MISC28_SIZE, "H5D_current_cache_size_test"); + VERIFY(nused, MISC28_SIZE, "H5D_current_cache_size_test"); + + /* Close dataset */ + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + + + /* Close the dataspaces and file */ + ret = H5Sclose(sidf); + CHECK_I(ret, "H5Sclose"); + ret = H5Sclose(sidm); + CHECK_I(ret, "H5Sclose"); + ret = H5Fclose(fid); + CHECK_I(ret, "H5Fclose"); + + /* Close the property lists. */ + ret = H5Pclose(dcpl); + CHECK_I(ret, "H5Pclose"); + ret = H5Pclose(fapl); + CHECK_I(ret, "H5Pclose"); +} /* end test_misc28() */ + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -4896,6 +5078,7 @@ test_misc(void) test_misc25c(); /* Exercise another null object header message merge bug */ test_misc26(); /* Test closing property lists with long filter pipelines */ test_misc27(); /* Test opening file with object that has bad # of object header messages */ + test_misc28(); /* Test that chunks are cached appropriately */ } /* test_misc() */ @@ -4950,5 +5133,6 @@ cleanup_misc(void) HDremove(MISC25A_FILE); HDremove(MISC25C_FILE); HDremove(MISC26_FILE); + HDremove(MISC28_FILE); } |