diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-10-15 01:46:34 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-10-15 01:46:34 (GMT) |
commit | 0e51a4244e8de0402fe9d329d6ad3cc1e9d20418 (patch) | |
tree | 12fe8ea3e734869c51d57efd98fa7c986a3dcb71 /test/enum.c | |
parent | bea2e1790d2a708f9f0c794254f9e869f77f0f88 (diff) | |
download | hdf5-0e51a4244e8de0402fe9d329d6ad3cc1e9d20418.zip hdf5-0e51a4244e8de0402fe9d329d6ad3cc1e9d20418.tar.gz hdf5-0e51a4244e8de0402fe9d329d6ad3cc1e9d20418.tar.bz2 |
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) 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
Diffstat (limited to 'test/enum.c')
-rw-r--r-- | test/enum.c | 178 |
1 files changed, 80 insertions, 98 deletions
diff --git a/test/enum.c b/test/enum.c index 3196195..91a3790 100644 --- a/test/enum.c +++ b/test/enum.c @@ -211,58 +211,48 @@ test_tr1(hid_t file) static c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED}; c_e1 data2[10]; - const char *envval = NULL; TESTING("O(1) conversions"); - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "split")) { - if((cwg = H5Gcreate2(file, "test_tr1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - if((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "RED", CPTR(eval, E1_RED )) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "GREEN", CPTR(eval, E1_GREEN)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "BLUE", CPTR(eval, E1_BLUE )) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "WHITE", CPTR(eval, E1_WHITE)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "BLACK", CPTR(eval, E1_BLACK)) < 0) FAIL_STACK_ERROR - - - if((f_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "RED", CPTR(ival, 105)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "GREEN", CPTR(ival, 104)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "BLUE", CPTR(ival, 103)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "WHITE", CPTR(ival, 102)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "BLACK", CPTR(ival, 101)) < 0) FAIL_STACK_ERROR - - if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR - if((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR - if(H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR - - for(i = 0; i < (size_t)ds_size[0]; i++) - if(data1[i] != data2[i]) { - H5_FAILED(); - printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", - (unsigned long)i, (int)(data1[i]), - (unsigned long)i, (int)(data2[i])); - goto error; - } - - if(H5Dclose(dset) < 0) FAIL_STACK_ERROR - if(H5Sclose(space) < 0) FAIL_STACK_ERROR - if(H5Tclose(m_type) < 0) FAIL_STACK_ERROR - if(H5Tclose(f_type) < 0) FAIL_STACK_ERROR - if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR - - PASSED(); - } - else - { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } + if((cwg = H5Gcreate2(file, "test_tr1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + if((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "RED", CPTR(eval, E1_RED )) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "GREEN", CPTR(eval, E1_GREEN)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "BLUE", CPTR(eval, E1_BLUE )) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "WHITE", CPTR(eval, E1_WHITE)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "BLACK", CPTR(eval, E1_BLACK)) < 0) FAIL_STACK_ERROR + + + if((f_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "RED", CPTR(ival, 105)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "GREEN", CPTR(ival, 104)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "BLUE", CPTR(ival, 103)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "WHITE", CPTR(ival, 102)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "BLACK", CPTR(ival, 101)) < 0) FAIL_STACK_ERROR + + if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR + if((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR + if(H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR + + for(i = 0; i < (size_t)ds_size[0]; i++) + if(data1[i] != data2[i]) { + H5_FAILED(); + printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + (unsigned long)i, (int)(data1[i]), + (unsigned long)i, (int)(data2[i])); + goto error; + } + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Tclose(m_type) < 0) FAIL_STACK_ERROR + if(H5Tclose(f_type) < 0) FAIL_STACK_ERROR + if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; error: @@ -304,56 +294,47 @@ test_tr2(hid_t file) static c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED}; c_e1 data2[10]; - const char *envval = NULL; TESTING("O(log N) converions"); - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "split")) { - if((cwg = H5Gcreate2(file, "test_tr2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - if((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "RED", CPTR(val1, E1_RED )) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "GREEN", CPTR(val1, E1_GREEN)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "BLUE", CPTR(val1, E1_BLUE )) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "WHITE", CPTR(val1, E1_WHITE)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "BLACK", CPTR(val1, E1_BLACK)) < 0) FAIL_STACK_ERROR - - if((f_type = H5Tcreate(H5T_ENUM, sizeof(int))) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "RED", CPTR(val2, 1050)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "GREEN", CPTR(val2, 1040)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "BLUE", CPTR(val2, 1030)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "WHITE", CPTR(val2, 1020)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "BLACK", CPTR(val2, 1010)) < 0) FAIL_STACK_ERROR - - if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR - if((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR - if(H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR - - for(i = 0; i < (size_t)ds_size[0]; i++) - if(data1[i] != data2[i]) { - H5_FAILED(); - printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", - (unsigned long)i, (int)(data1[i]), - (unsigned long)i, (int)(data2[i])); - goto error; - } - - if(H5Dclose(dset) < 0) FAIL_STACK_ERROR - if(H5Sclose(space) < 0) FAIL_STACK_ERROR - if(H5Tclose(m_type) < 0) FAIL_STACK_ERROR - if(H5Tclose(f_type) < 0) FAIL_STACK_ERROR - if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR - - PASSED(); - } - else { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } + if((cwg = H5Gcreate2(file, "test_tr2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + if((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "RED", CPTR(val1, E1_RED )) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "GREEN", CPTR(val1, E1_GREEN)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "BLUE", CPTR(val1, E1_BLUE )) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "WHITE", CPTR(val1, E1_WHITE)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "BLACK", CPTR(val1, E1_BLACK)) < 0) FAIL_STACK_ERROR + + if((f_type = H5Tcreate(H5T_ENUM, sizeof(int))) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "RED", CPTR(val2, 1050)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "GREEN", CPTR(val2, 1040)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "BLUE", CPTR(val2, 1030)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "WHITE", CPTR(val2, 1020)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "BLACK", CPTR(val2, 1010)) < 0) FAIL_STACK_ERROR + + if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR + if((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR + if(H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR + + for(i = 0; i < (size_t)ds_size[0]; i++) + if(data1[i] != data2[i]) { + H5_FAILED(); + printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + (unsigned long)i, (int)(data1[i]), + (unsigned long)i, (int)(data2[i])); + goto error; + } + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Tclose(m_type) < 0) FAIL_STACK_ERROR + if(H5Tclose(f_type) < 0) FAIL_STACK_ERROR + if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; error: @@ -473,7 +454,8 @@ test_funcs(void) { hid_t type=-1; c_e1 val; - int size; + size_t size; + int offset; H5T_pad_t inpad; H5T_cset_t cset; herr_t ret; @@ -490,7 +472,7 @@ test_funcs(void) if ((size=H5Tget_precision(type))==0) goto error; if ((size=H5Tget_size(type))==0) goto error; - if ((size=H5Tget_offset(type))<0) goto error; + if ((offset=H5Tget_offset(type))<0) goto error; if (H5Tget_sign(type)<0) goto error; if (H5Tget_super(type)<0) goto error; |