blob: e00d8ae15ce14463073a76b6beffcef834eb645c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
cmake_minimum_required (VERSION 2.8)
PROJECT (HDF5_TOOLS_H5STAT)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
# Add the h5stat executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5stat ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat.c)
H5_NAMING (h5stat)
TARGET_WIN_PROPERTIES (h5stat)
TARGET_LINK_LIBRARIES (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5stat)
##############################################################################
##############################################################################
### T E S T I N G ###
##############################################################################
##############################################################################
IF (BUILD_TESTING)
# --------------------------------------------------------------------
# Add the h5stat test executables
# --------------------------------------------------------------------
IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5stat_gentest ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat_gentest.c)
H5_NAMING (h5stat_gentest)
TARGET_WIN_PROPERTIES (h5stat_gentest)
TARGET_LINK_LIBRARIES (h5stat_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
#ADD_TEST (NAME h5stat_gentest COMMAND $<TARGET_FILE:h5stat_gentest>)
ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
# --------------------------------------------------------------------
# Copy all the HDF5 files from the test directory into the source directory
# --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
h5stat_help1.ddl
h5stat_help2.ddl
h5stat_filters.ddl
h5stat_filters-file.ddl
h5stat_filters-F.ddl
h5stat_filters-d.ddl
h5stat_filters-g.ddl
h5stat_filters-dT.ddl
h5stat_filters-UD.ddl
h5stat_filters-UT.ddl
h5stat_tsohm.ddl
h5stat_newgrat.ddl
h5stat_newgrat-UG.ddl
h5stat_newgrat-UA.ddl
)
SET (HDF5_REFERENCE_TEST_FILES
h5stat_filters.h5
h5stat_tsohm.h5
h5stat_newgrat.h5
)
FOREACH (ddl_file ${HDF5_REFERENCE_FILES})
SET (ddldest "${PROJECT_BINARY_DIR}/${ddl_file}")
#MESSAGE (STATUS " Translating ${ddl_file}")
ADD_CUSTOM_COMMAND (
TARGET h5stat
POST_BUILD
COMMAND ${XLATE_UTILITY}
ARGS ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} -l3
)
ENDFOREACH (ddl_file ${HDF5_REFERENCE_FILES})
FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
#MESSAGE (STATUS " Copying ${h5_file}")
ADD_CUSTOM_COMMAND (
TARGET h5stat
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${h5_file} ${dest}
)
ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
##############################################################################
##############################################################################
### T H E T E S T S M A C R O S ###
##############################################################################
##############################################################################
MACRO (ADD_H5_TEST resultfile resultcode)
ADD_TEST (
NAME H5STAT-${resultfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5stat>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.ddl"
-P "${HDF5_RESOURCES_DIR}/runTest.cmake"
)
ENDMACRO (ADD_H5_TEST file)
##############################################################################
##############################################################################
### T H E T E S T S ###
##############################################################################
##############################################################################
# Remove any output file left over from previous test run
ADD_TEST (
NAME H5STAT-clearall-objects
COMMAND ${CMAKE_COMMAND}
-E remove
h5stat_help1.out
h5stat_help1.out.err
h5stat_help2.out
h5stat_help2.out.err
h5stat_filters.out
h5stat_filters.out.err
h5stat_filters-file.out
h5stat_filters-file.out.err
h5stat_filters-F.out
h5stat_filters-F.out.err
h5stat_filters-d.out
h5stat_filters-d.out.err
h5stat_filters-g.out
h5stat_filters-g.out.err
h5stat_filters-dT.out
h5stat_filters-dT.out.err
h5stat_filters-UD.out
h5stat_filters-UD.out.err
h5stat_filters-UT.out
h5stat_filters-UT.out.err
h5stat_tsohm.out
h5stat_tsohm.out.err
h5stat_newgrat.out
h5stat_newgrat.out.err
h5stat_newgrat-UG.out
h5stat_newgrat-UG.out.err
h5stat_newgrat-UA.out
h5stat_newgrat-UA.out.err
)
# If using memchecker add tests without using scripts
IF (HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (NAME H5STAT-help COMMAND h5stat -h)
ADD_TEST (NAME H5STAT-filters COMMAND h5stat h5stat_filters.h5)
ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
# Test for help flag
ADD_H5_TEST (h5stat_help1 0 -h)
ADD_H5_TEST (h5stat_help2 0 --help)
# Test file with groups, compressed datasets, user-applied fileters, etc.
# h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4
ADD_H5_TEST (h5stat_filters 0 h5stat_filters.h5)
ADD_H5_TEST (h5stat_filters-file 0 -f h5stat_filters.h5)
ADD_H5_TEST (h5stat_filters-F 0 -F h5stat_filters.h5)
ADD_H5_TEST (h5stat_filters-d 0 -d h5stat_filters.h5)
ADD_H5_TEST (h5stat_filters-g 0 -g h5stat_filters.h5)
ADD_H5_TEST (h5stat_filters-dT 0 -dT h5stat_filters.h5)
ADD_H5_TEST (h5stat_filters-UD 0 -D h5stat_filters.h5)
ADD_H5_TEST (h5stat_filters-UT 0 -T h5stat_filters.h5)
# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
# as of release 1.8.0-alpha4
ADD_H5_TEST (h5stat_tsohm 0 h5stat_tsohm.h5)
# h5stat_newgrat.h5 is generated by h5stat_gentest.c
ADD_H5_TEST (h5stat_newgrat 0 h5stat_newgrat.h5)
ADD_H5_TEST (h5stat_newgrat-UG 0 -G h5stat_newgrat.h5)
ADD_H5_TEST (h5stat_newgrat-UA 0 -A h5stat_newgrat.h5)
ENDIF (BUILD_TESTING)
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
##############################################################################
##############################################################################
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
INSTALL (
TARGETS
h5stat
RUNTIME DESTINATION
${HDF5_INSTALL_BIN_DIR}/tools
COMPONENT
toolsapplications
)
|