diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-07-27 17:50:58 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-07-27 17:50:58 (GMT) |
commit | 3333acc05a6b3be7ed93c1291b7d4c69ed262f72 (patch) | |
tree | 7e618cad0faa94057b00a9a6d5b54d2d8e0dfe25 /hl/test | |
parent | 3a6b7da5f338388d83036ec7f9c3d64c01ff8ed1 (diff) | |
download | hdf5-3333acc05a6b3be7ed93c1291b7d4c69ed262f72.zip hdf5-3333acc05a6b3be7ed93c1291b7d4c69ed262f72.tar.gz hdf5-3333acc05a6b3be7ed93c1291b7d4c69ed262f72.tar.bz2 |
Merge of HDFFV-10845, 10529 from develop
Diffstat (limited to 'hl/test')
-rw-r--r-- | hl/test/CMakeLists.txt | 85 | ||||
-rw-r--r-- | hl/test/CMakeTests.cmake | 78 | ||||
-rw-r--r-- | hl/test/test_ds.c | 253 |
3 files changed, 221 insertions, 195 deletions
diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 327c50b..f380b4e 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -17,54 +17,83 @@ configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ON # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- -MACRO (HL_ADD_EXE hl_name) +macro (HL_ADD_EXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) - target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (hl_${hl_name} STATIC) - target_link_libraries (hl_${hl_name} PRIVATE - ${HDF5_HL_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} - ${HDF5_LIB_TARGET} - ) + target_include_directories (hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_${hl_name} STATIC) + target_link_libraries (hl_${hl_name} PRIVATE + ${HDF5_HL_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) + else () + TARGET_C_PROPERTIES (hl_${hl_name} SHARED) + target_link_libraries (hl_${hl_name} PRIVATE + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_TEST_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} + ) + endif () set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl) -ENDMACRO () +endmacro () -MACRO (HL_ADD_SHEXE hl_name) +macro (HL_ADD_ZEXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) - target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (hl_${hl_name} SHARED) - target_link_libraries (hl_${hl_name} PRIVATE - ${HDF5_HL_LIBSH_TARGET} - ${HDF5_TEST_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} - ) + target_include_directories (hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_${hl_name} STATIC) + target_link_libraries (hl_${hl_name} PRIVATE + ${HDF5_HL_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_LIB_TARGET} + ${LINK_COMP_LIBS} + ) + else () + TARGET_C_PROPERTIES (hl_${hl_name} SHARED) + target_link_libraries (hl_${hl_name} PRIVATE + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_TEST_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} + ${LINK_COMP_LIBS} + ) + endif () set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl) -ENDMACRO () +endmacro () HL_ADD_EXE (test_ds) -HL_ADD_EXE (test_dset_opt) +HL_ADD_ZEXE (test_dset_opt) HL_ADD_EXE (test_image) HL_ADD_EXE (test_lite) HL_ADD_EXE (test_table) # test_packet has two source files add_executable (hl_test_packet test_packet.c test_packet_vlen.c) -target_include_directories(hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (hl_test_packet STATIC) -target_link_libraries (hl_test_packet PRIVATE - ${HDF5_HL_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} - ${HDF5_LIB_TARGET} -) +target_include_directories (hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_test_packet STATIC) + target_link_libraries (hl_test_packet PRIVATE + ${HDF5_HL_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) +else () + TARGET_C_PROPERTIES (hl_test_packet SHARED) + target_link_libraries (hl_test_packet PRIVATE + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_TEST_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} + ) +endif () set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl) # -------------------------------------------------------------------- # This executable is used to generate test files for the test_ds test. # It should only be run during development when new test files are needed # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (hl_gen_test_ds gen_test_ds.c) - target_include_directories(hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_gen_test_ds STATIC) target_link_libraries (hl_gen_test_ds PRIVATE ${HDF5_HL_LIB_TARGET} diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index 6648edd..c4c8023 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -42,14 +42,48 @@ foreach (h5_file ${HL_REFERENCE_TEST_FILES}) endforeach () add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tests" DEPENDS ${hl_test_files_list}) +# Remove any output file left over from previous test run +set (test_hl_CLEANFILES + combine_tables1.h5 + combine_tables2.h5 + test_detach.h5 + test_ds1.h5 + test_ds2.h5 + test_ds3.h5 + test_ds4.h5 + test_ds5.h5 + test_ds6.h5 + test_ds7.h5 + test_ds8.h5 + test_ds9.h5 + test_ds10.h5 + test_dectris.h5 + test_image1.h5 + test_image2.h5 + test_image3.h5 + test_lite1.h5 + test_lite2.h5 + test_lite3.h5 + test_lite4.h5 + test_packet_compress.h5 + test_packet_table.h5 + test_table.h5 +) +add_test ( + NAME HL_test-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_hl_CLEANFILES} +) +set_tests_properties (HL_test-clear-objects PROPERTIES FIXTURES_SETUP clear_test_hl) + # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- macro (HL_ADD_TEST hl_name) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>) + add_test (NAME HL_${hl_name} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_${hl_name}>) else () add_test (NAME HL_${hl_name} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:hl_${hl_name}>" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -60,49 +94,13 @@ macro (HL_ADD_TEST hl_name) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (last_test) - set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test} + set_tests_properties (HL_${hl_name} PROPERTIES + FIXTURES_REQUIRED clear_test_hl ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR} - ) - endif () + ) endmacro () -# Remove any output file left over from previous test run -add_test ( - NAME HL_test-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - combine_tables1.h5 - combine_tables2.h5 - test_detach.h5 - test_ds1.h5 - test_ds2.h5 - test_ds3.h5 - test_ds4.h5 - test_ds5.h5 - test_ds6.h5 - test_ds7.h5 - test_ds8.h5 - test_ds9.h5 - test_ds10.h5 - test_dectris.h5 - test_image1.h5 - test_image2.h5 - test_image3.h5 - test_lite1.h5 - test_lite2.h5 - test_lite3.h5 - test_lite4.h5 - test_packet_compress.h5 - test_packet_table.h5 - test_table.h5 -) -if (last_test) - set_tests_properties (HL_test-clear-objects PROPERTIES DEPENDS ${last_test}) -endif () -set (last_test "HL_test-clear-objects") - HL_add_test (test_ds) HL_add_test (test_dset_opt) HL_add_test (test_image) diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 5560f03..f2d4b8f 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -186,11 +186,11 @@ int main(void) if(nerrors) goto error; - printf("All dimension scales tests passed.\n"); + HDprintf("All dimension scales tests passed.\n"); return 0; error: - printf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); return 1; } @@ -1103,7 +1103,7 @@ herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *sc if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) { if(H5DSis_attached(did, dsid, idx) == 1) { if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) { - name_out = (char*)HDmalloc((name_len+1) * sizeof (char)); + name_out = (char*)HDmalloc((name_len+1) * sizeof (char)); if(name_out != NULL) { if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) >= 0) { if(HDstrcmp(scalename,name_out)==0) { @@ -1131,7 +1131,7 @@ static int test_detachscales(void) int rank3 = 3; hsize_t dims[] = {1,2,3}; /*some bogus numbers, not important for the test*/ int *buf = NULL; - char dname[10]; + char dname[16]; int i; /* This tests creates two three dimensional datasets; then it creates @@ -1149,7 +1149,7 @@ static int test_detachscales(void) sprintf(dname,"D%d", i); if(H5LTmake_dataset_int(fid, dname, rank3, dims, buf) < 0) goto out; - } + } /* create datasets and make them dim. scales */ for (i=0; i < 4; i++) { @@ -1157,11 +1157,11 @@ static int test_detachscales(void) if(H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0) goto out; } - /* attach scales to the first dataset; first dimension will have + /* attach scales to the first dataset; first dimension will have two scales attached */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) { for (i=0; i<4; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, (unsigned int) i%3) < 0) @@ -1178,7 +1178,7 @@ static int test_detachscales(void) /* attach scales to the second dataset */ if((did = H5Dopen2(fid, "D1", H5P_DEFAULT)) >= 0) { for (i=0; i<3; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, (unsigned int) i) < 0) @@ -1199,20 +1199,20 @@ static int test_detachscales(void) goto out; for (i=0; i<2; i++) { - sprintf(dname, "D%d", i); + HDsprintf(dname, "D%d", i); if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSdetach_scale(did, dsid, (unsigned int)0) < 0) goto out; if(H5Dclose(did) < 0) goto out; - } + } /* Check that attribute "REFERENCE_LIST" doesn't exist anymore */ if(H5Aexists(dsid, REFERENCE_LIST)!= 0) goto out; if(H5Dclose(dsid) < 0) goto out; - /* Check that DS3 is the only dim. scale attached to the first + /* Check that DS3 is the only dim. scale attached to the first dimension of D0 */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) < 0) goto out; @@ -1225,11 +1225,11 @@ static int test_detachscales(void) if(H5Dclose(dsid) < 0) goto out; - /* Detach the rest of the scales DS3, DS1, DS2 from D0 and make + /* Detach the rest of the scales DS3, DS1, DS2 from D0 and make sure that attribute "DIMENSION_LIST" doesn't exist anymore */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) { for (i=1; i<4; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSdetach_scale(did, dsid, (unsigned int) i%3) < 0) @@ -1246,7 +1246,7 @@ static int test_detachscales(void) else goto out; - + PASSED(); H5Fclose(fid); @@ -2874,10 +2874,10 @@ static int test_simple(void) if((sid = H5Screate_simple(rank,dims,NULL)) < 0) goto out; for(i = 0; i < 5; i++) { - sprintf(dname,"dset_%d",i); + HDsprintf(dname,"dset_%d",i); if((did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - sprintf(sname,"ds_%d",i); + HDsprintf(sname,"ds_%d",i); if((dsid = H5Dcreate2(gid, sname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5DSset_scale(dsid,"scale") < 0) @@ -2894,11 +2894,11 @@ static int test_simple(void) */ for(i = 0; i < 5; i++) { - sprintf(dname, "dset_%d", i); + HDsprintf(dname, "dset_%d", i); if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for(j = 0; j < 5; j++) { - sprintf(sname, "ds_%d", j); + HDsprintf(sname, "ds_%d", j); if((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, DIM0) < 0) @@ -2916,7 +2916,7 @@ static int test_simple(void) */ for(i = 0; i < 5; i++) { - sprintf(dname, "dset_%d", i); + HDsprintf(dname, "dset_%d", i); if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for(j = 0; j < 5; j++) { @@ -2939,7 +2939,7 @@ static int test_simple(void) */ for(i=0; i<5; i++) { - sprintf(dname,"dset_%d",i); + HDsprintf(dname,"dset_%d",i); if((did = H5Dopen2(gid,dname, H5P_DEFAULT)) < 0) goto out; for(j=0; j<5; j++) { @@ -3081,7 +3081,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- - * get the label using a static buffer smaller than the string lenght + * get the label using a static buffer smaller than the string length *------------------------------------------------------------------------- */ @@ -3119,7 +3119,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - /* get the lenght of the scale name (pass NULL in name) */ + /* get the length of the scale name (pass NULL in name) */ if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) < 0) goto out; @@ -3152,7 +3152,7 @@ static int test_simple(void) goto out; /*------------------------------------------------------------------------- - * get the scale name using a static buffer smaller than the string lenght + * get the scale name using a static buffer smaller than the string length *------------------------------------------------------------------------- */ @@ -3542,7 +3542,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor for(i=0; i<nelmts; i++) { if(buf[i] != data[i]) { - printf("read and write buffers differ\n"); + HDprintf("read and write buffers differ\n"); goto out; } } @@ -4871,8 +4871,7 @@ static int read_data( const char* fname, HDstrcpy(data_file, ""); /* compose the name of the file to open, using the srcdir, if appropriate */ - if(srcdir) - { + if(srcdir) { HDstrcpy(data_file, srcdir); HDstrcat(data_file, "/"); } @@ -4894,7 +4893,7 @@ static int read_data( const char* fname, *buf = (float*) HDmalloc (nelms * sizeof( float )); - if ( *buf == NULL ) { + if (*buf == NULL) { printf( "memory allocation failed\n" ); HDfclose(f); return -1; @@ -4924,7 +4923,7 @@ static int test_errors2(void) hsize_t dimd[2] = {3,3}; /* size of data dataset */ hsize_t dims[1] = {3}; /* size of scale dataset */ char lbuf[255]; /* label buffer */ - ssize_t label_len; /* label lenght */ + ssize_t label_len; /* label length */ int scale_idx; /* scale index */ int nscales; /* number of scales in DIM */ int count; /* visitor data */ @@ -5013,7 +5012,7 @@ static int test_errors2(void) goto out; if ((label_len=H5DSget_label(did,0,NULL,0)) < 0) goto out; - if ( label_len != strlen("label") ) + if (label_len != HDstrlen("label")) goto out; if (H5DSget_label(did,0,lbuf,sizeof(lbuf)) < 0) goto out; @@ -5124,128 +5123,128 @@ static int test_attach_detach(void) TESTING2("permutations of attaching and detaching"); if((fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + goto out; if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) - goto out; + goto out; /* Create dimension scale. */ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - - if((sid = H5Screate_simple(1, dims, dims)) < 0) - goto out; + goto out; + + if((sid = H5Screate_simple(1, dims, dims)) < 0) + goto out; if((dsid = H5Dcreate2(gid, DS_3_NAME, H5T_IEEE_F32BE, sid, - H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) - goto out; + H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto out; - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl_id) < 0) - goto out; + if(H5Sclose(sid) < 0) + goto out; + if(H5Pclose(dcpl_id) < 0) + goto out; - if(H5DSset_scale(dsid, DS_3_NAME) < 0) - goto out; + if(H5DSset_scale(dsid, DS_3_NAME) < 0) + goto out; /* Create a variable that uses this dimension scale. */ - if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) - goto out; + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + goto out; if((var1_id = H5Dcreate2(gid, DS_31_NAME, H5T_NATIVE_FLOAT, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; - if(H5Sclose(sid) < 0) - goto out; + if(H5Sclose(sid) < 0) + goto out; - if(H5DSattach_scale(var1_id, dsid, 0) < 0) - goto out; + if(H5DSattach_scale(var1_id, dsid, 0) < 0) + goto out; /* Create another variable that uses this dimension scale. */ - if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; - if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) - goto out; + if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) + goto out; - if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) - goto out; + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + goto out; if((var2_id = H5Dcreate2(gid, DS_32_NAME, H5T_NATIVE_FLOAT, sid, - H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) - goto out; + H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) + goto out; - if(H5Pclose(dcpl_id) < 0) - goto out; + if(H5Pclose(dcpl_id) < 0) + goto out; - if(H5Sclose(sid) < 0) - goto out; + if(H5Sclose(sid) < 0) + goto out; /* Create 3rd variable that uses this dimension scale. */ - if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; - if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) - goto out; + if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) + goto out; - if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) - goto out; + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + goto out; if((var3_id = H5Dcreate2(gid, DS_33_NAME, H5T_NATIVE_FLOAT, sid, - H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) - goto out; + H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) + goto out; - if(H5Pclose(dcpl_id) < 0) - goto out; + if(H5Pclose(dcpl_id) < 0) + goto out; + + if(H5Sclose(sid) < 0) + goto out; - if(H5Sclose(sid) < 0) - goto out; - /* Attached var2 scale */ - if(H5DSattach_scale(var2_id, dsid, 0) < 0) - goto out; + if(H5DSattach_scale(var2_id, dsid, 0) < 0) + goto out; /* Detach the var2 scale */ - if(H5DSdetach_scale(var2_id, dsid, 0) < 0) - goto out; + if(H5DSdetach_scale(var2_id, dsid, 0) < 0) + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; /* Detach the var1 scale */ - if(H5DSdetach_scale(var1_id, dsid, 0) < 0) - goto out; + if(H5DSdetach_scale(var1_id, dsid, 0) < 0) + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; /* Attach the DS again and remove them in the opposite order */ - if(H5DSattach_scale(var1_id, dsid, 0) < 0) - goto out; + if(H5DSattach_scale(var1_id, dsid, 0) < 0) + goto out; - if(H5DSattach_scale(var2_id, dsid, 0) < 0) - goto out; + if(H5DSattach_scale(var2_id, dsid, 0) < 0) + goto out; /* Detach the var1 scale */ if(H5DSdetach_scale(var1_id, dsid, 0) < 0) - goto out; + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) == 0) /* should still be attached */ - goto out; + goto out; /* Detach the var2 scale */ if(H5DSdetach_scale(var2_id, dsid, 0) < 0) @@ -5253,78 +5252,78 @@ static int test_attach_detach(void) /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; /*************************************************** * Attach Three DS and remove the middle one first *****************************************************/ - if(H5DSattach_scale(var1_id, dsid, 0) < 0) - goto out; + if(H5DSattach_scale(var1_id, dsid, 0) < 0) + goto out; - if(H5DSattach_scale(var2_id, dsid, 0) < 0) - goto out; + if(H5DSattach_scale(var2_id, dsid, 0) < 0) + goto out; - if(H5DSattach_scale(var3_id, dsid, 0) < 0) - goto out; + if(H5DSattach_scale(var3_id, dsid, 0) < 0) + goto out; /* Detach the var2 scale */ if(H5DSdetach_scale(var2_id, dsid, 0) < 0) - goto out; + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var3_id, dsid, 0) == 0) /* should still be attached */ - goto out; + goto out; /* Detach the var3 scale */ if(H5DSdetach_scale(var3_id, dsid, 0) < 0) - goto out; + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; /* Detach the var1 scale */ if(H5DSdetach_scale(var1_id, dsid, 0) < 0) - goto out; + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - if(H5Dclose(var1_id) < 0) - goto out; - if(H5Dclose(var2_id) < 0) - goto out; - if(H5Dclose(var3_id) < 0) - goto out; - if(H5Dclose(dsid) < 0) - goto out; - if(H5Gclose(gid) < 0) - goto out; + if(H5Dclose(var1_id) < 0) + goto out; + if(H5Dclose(var2_id) < 0) + goto out; + if(H5Dclose(var3_id) < 0) + goto out; + if(H5Dclose(dsid) < 0) + goto out; + if(H5Gclose(gid) < 0) + goto out; if(H5Fclose(fid) < 0) - goto out; + goto out; PASSED(); @@ -5334,9 +5333,9 @@ static int test_attach_detach(void) out: H5E_BEGIN_TRY { - H5Dclose(var1_id); - H5Dclose(var2_id); - H5Dclose(var3_id); + H5Dclose(var1_id); + H5Dclose(var2_id); + H5Dclose(var3_id); H5Dclose(dsid); H5Gclose(gid); H5Fclose(fid); |