summaryrefslogtreecommitdiffstats
path: root/tools/h5copy/CMakeLists.txt
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2011-03-08 20:17:17 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2011-03-08 20:17:17 (GMT)
commit8245bf15728bb73ee4290cb70e08a63ada205657 (patch)
tree3bc66984ad197509630fb361de5f66f629a506d1 /tools/h5copy/CMakeLists.txt
parent9d115d89f2297f3c6e1ae6c3ca35be4b1a9a8cc9 (diff)
downloadhdf5-8245bf15728bb73ee4290cb70e08a63ada205657.zip
hdf5-8245bf15728bb73ee4290cb70e08a63ada205657.tar.gz
hdf5-8245bf15728bb73ee4290cb70e08a63ada205657.tar.bz2
[svn-r20203] Purpose:
Fix Bug 2120 - h5copy: improve to copy an object into same HDF file Description: Before the fix users can't copy an object (dataset or group) with different name if input file (-i) and output file (-o) is same. This feature would be useful to clone any object with different name and reuse contents. Tested: jam (linux32-LE), amani (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Cmake (jam)
Diffstat (limited to 'tools/h5copy/CMakeLists.txt')
-rw-r--r--tools/h5copy/CMakeLists.txt39
1 files changed, 34 insertions, 5 deletions
diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt
index 180dc9d..4d279b6 100644
--- a/tools/h5copy/CMakeLists.txt
+++ b/tools/h5copy/CMakeLists.txt
@@ -76,10 +76,9 @@ IF (BUILD_TESTING)
##############################################################################
##############################################################################
- MACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
- ADD_H5COPY_TEST (${testname} ${resultcode} ${testfile}.h5 ${testfile}.out.h5 ${vparam} ${srcname} ${dstname} ${ARGN})
- ENDMACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
-
+ #
+ # Perform h5copy according to passing parmeters
+ #
MACRO (ADD_H5COPY_TEST testname resultcode infile outfile vparam srcname dstname)
IF (NOT "${ARGN}" STREQUAL "")
@@ -107,8 +106,19 @@ IF (BUILD_TESTING)
SET_TESTS_PROPERTIES (H5COPY-${testname} PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5COPY-DIFF_${testname}")
- ENDMACRO (ADD_H5COPY_TEST testname resultcode testfile vparam srcname dstname)
+ ENDMACRO (ADD_H5COPY_TEST)
+
+ #
+ # call ADD_H5COPY_TEST macro with assumption that source and target file
+ # is different
+ #
+ MACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
+ ADD_H5COPY_TEST (${testname} ${resultcode} ${testfile}.h5 ${testfile}.out.h5 ${vparam} ${srcname} ${dstname} ${ARGN})
+ ENDMACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
+ #
+ # Test result with h5ls
+ #
MACRO (ADD_H5LS_TEST file filetest)
# If using memchecker add tests without using scripts
IF (HDF5_ENABLE_USING_MEMCHECKER)
@@ -133,6 +143,10 @@ IF (BUILD_TESTING)
SET (last_test "H5COPY-H5LS_${file}-${filetest}")
ENDMACRO (ADD_H5LS_TEST file filetest)
+ #
+ # Similiar to ADD_H5_TEST macro. Compare to outputs from source & target
+ # files instead of checking with h5ls.
+ #
MACRO (ADD_H5_CMP_TEST testname resultcode testfile vparam srcname dstname)
# If using memchecker add tests without using scripts
IF (HDF5_ENABLE_USING_MEMCHECKER)
@@ -170,6 +184,7 @@ IF (BUILD_TESTING)
SET (HDF_FILE2 h5copy_ref)
SET (HDF_EXT_SRC_FILE h5copy_extlinks_src)
SET (HDF_EXT_TRG_FILE h5copy_extlinks_trg)
+ SET (HDF_FILE1_TMP h5copytst_tmp)
# Remove any output file left over from previous test run
ADD_TEST (
@@ -312,15 +327,29 @@ IF (BUILD_TESTING)
./testfiles/${HDF_FILE1}.out.h5
./testfiles/${HDF_FILE1}.out.out
./testfiles/${HDF_FILE1}.out.out.err
+ ./testfiles/${HDF_FILE1_TMP}.h5
)
IF (NOT "${last_test}" STREQUAL "")
SET_TESTS_PROPERTIES (H5COPY-clear-misc PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5COPY-clear-misc")
+ #-----------------------------------------------------------------
# "Test copying object into group which doesn't exist, without -p"
+ #
ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1} v /simple /g1/g2/simple)
+ #-------------------------------------------
+ # "Test copying objects to the same file "
+ #
+ # create temporary test file with some objects
+ ADD_H5COPY_TEST (samefile1_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1_TMP}.h5 v /simple /simple)
+ ADD_H5COPY_TEST (samefile2_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1_TMP}.h5 v /grp_dsets /grp_dsets)
+ # actual test cases
+ # - dataset
+ ADD_H5COPY_TEST (samefile1 0 ${HDF_FILE1_TMP}.h5 ${HDF_FILE1_TMP}.h5 v /simple /simple_cp)
+ # - group with some datasets
+ ADD_H5COPY_TEST (samefile2 0 ${HDF_FILE1_TMP}.h5 ${HDF_FILE1_TMP}.h5 v /grp_dsets /grp_dsets_cp)
ENDIF (BUILD_TESTING)
##############################################################################