File: CMakeTests.cmake

package info (click to toggle)
libhdf4 4.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 30,384 kB
  • sloc: ansic: 128,700; sh: 15,015; fortran: 12,444; java: 5,863; xml: 1,205; makefile: 794; yacc: 678; pascal: 418; perl: 360; javascript: 203; lex: 163; csh: 41
file content (200 lines) | stat: -rw-r--r-- 5,472 bytes parent folder | download | duplicates (4)
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
193
194
195
196
197
198
199
200

##############################################################################
##############################################################################
###           T E S T I N G                                                ###
##############################################################################
##############################################################################

file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/TEST")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/TEST/testdir")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/TEST/testfiles")

#-- Copy all the dat files from the test directory into the source directory
set (HDF4_REFERENCE_TEST_FILES
    8bit.dat
    bitio.dat
    gr_r24.dat
    greyjpeg.dat
    jpeg.dat
    litend.dat
    nbit.dat
    tmgr.dat
    tvattr.dat
    grtdfui83.hdf
)

foreach (h4_file ${HDF4_REFERENCE_TEST_FILES})
  HDFTEST_COPY_FILE("${HDF4_HDF_TEST_SOURCE_DIR}/test_files/${h4_file}" "${PROJECT_BINARY_DIR}/TEST/test_files/${h4_file}" "hdf_test_files")
endforeach ()
add_custom_target(hdf_test_files ALL COMMENT "Copying files needed by hdf tests" DEPENDS ${hdf_test_files_list})

# Remove any output file left over from previous test run
set (HDF4_TESTHDF_FILES
    Block_info.hdf
    ChunkedGR.hdf
    ChunkedGR_DF.hdf
    ChunkedGR_NO.hdf
    ChunkedGR_RL.hdf
    ChunkedGR_SK.hdf
    datainfo_annot.hdf
    datainfo_dfri.hdf
    datainfo_images.hdf
    datainfo_linkblock.hdf
    datainfo_simple.hdf
    gr2.hdf
    gr_chunkcomp.hdf
    gr_comp.hdf
    gr_double_test.hdf
    gr_gzip.hdf
    gr_jpeg.hdf
    gr_r8.hdf
    nntcheck.hdf
    ntcheck.hdf
    RI_8.hdf
    RI_16.hdf
    RI_32.hdf
    RI_fl32.hdf
    RI_fl64.hdf
    RIchunkedziped.hdf
    s1w.hdf
    s3w.hdf
    s4w.hdf
    sdstrings.hdf
    swf32.hdf
    swf64.hdf
    swi8.hdf
    swi16.hdf
    swi32.hdf
    swin.hdf
    swui8.hdf
    swui16.hdf
    swui32.hdf
    swuin.hdf
    t.hdf
    t1.hdf
    t2.hdf
    t3.hdf
    t4.hdf
    tbitio.hdf
    tblocks.hdf
    tchunks.hdf
    tcomp.hdf
    tdf24.hdf
    tdfan.hdf
    temp.hdf
    thf.hdf
    tjpeg.hdf
    tlongnames.hdf
    tman.hdf
    tmgr.hdf
    tmgratt.hdf
    tmgrchk.hdf
    tnbit.hdf
    tref.hdf
    tuservds.hdf
    tuservgs.hdf
    tvattr.hdf
    tvpack.hdf
    tvsempty.hdf
    tvset.hdf
    tvsetext.hdf
    tx.hdf
    Tables_External_File
)
add_test (
    NAME HDF_TEST-testhdf-clearall-objects
    COMMAND ${CMAKE_COMMAND} -E remove ${HDF4_TESTHDF_FILES}
    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/TEST
)
set_tests_properties (HDF_TEST-testhdf-clearall-objects PROPERTIES
    LABELS ${PROJECT_NAME}
    FIXTURES_SETUP clear_HDF_TEST
)
if (NOT "${last_test}" STREQUAL "")
  set_tests_properties (HDF_TEST-testhdf-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "HDF_TEST-testhdf-clearall-objects")

set (HDF4_TESTHDF_THF0_FILES
    thf0.hdf
    thf1.hdf
    thf2.hdf
    thf3.hdf
    thf4.hdf
    thf5.hdf
    thf6.hdf
    thf7.hdf
    thf8.hdf
    thf9.hdf
)
add_test (
    NAME HDF_TEST-testhdf_thf0-clearall-objects
    COMMAND ${CMAKE_COMMAND} -E remove ${HDF4_TESTHDF_THF0_FILES}
    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/TEST
)
set_tests_properties (HDF_TEST-testhdf_thf0-clearall-objects PROPERTIES
    LABELS ${PROJECT_NAME}
    FIXTURES_REQUIRED clear_HDF_TEST
)
if (NOT "${last_test}" STREQUAL "")
  set_tests_properties (HDF_TEST-testhdf_thf0-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "HDF_TEST-testhdf_thf0-clearall-objects")

set (thf_decade
    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
)
foreach (decade ${thf_decade})
  add_test (
      NAME HDF_TEST-testhdf_thf${decade}-clearall-objects
      COMMAND ${CMAKE_COMMAND} -E remove
          thf${decade}0.hdf
          thf${decade}1.hdf
          thf${decade}2.hdf
          thf${decade}3.hdf
          thf${decade}4.hdf
          thf${decade}5.hdf
          thf${decade}6.hdf
          thf${decade}7.hdf
          thf${decade}8.hdf
          thf${decade}9.hdf
    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/TEST
  )
  set_tests_properties (HDF_TEST-testhdf_thf${decade}-clearall-objects PROPERTIES
      LABELS ${PROJECT_NAME}
  )
  if (NOT "${last_test}" STREQUAL "")
    set_tests_properties (HDF_TEST-testhdf_thf${decade}-clearall-objects PROPERTIES DEPENDS ${last_test})
  endif ()
  set (last_test "HDF_TEST-testhdf_thf${decade}-clearall-objects")
endforeach (decade ${thf_decade})

add_test (NAME HDF_TEST-testhdf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:testhdf>)
set (passRegex "All tests were successful")
set_tests_properties (HDF_TEST-testhdf PROPERTIES
    PASS_REGULAR_EXPRESSION "${passRegex}"
    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/TEST
    LABELS ${PROJECT_NAME}
)
if (NOT "${last_test}" STREQUAL "")
  set_tests_properties (HDF_TEST-testhdf PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "HDF_TEST-testhdf")

#-- Adding test for buffer
if (NOT WIN32)
  add_test (NAME HDF_TEST-buffer COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:buffer>)
  set_tests_properties (HDF_TEST-buffer PROPERTIES
      WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/TEST
      LABELS ${PROJECT_NAME}
  )
  if (NOT "${last_test}" STREQUAL "")
    set_tests_properties (HDF_TEST-buffer PROPERTIES DEPENDS ${last_test})
  endif ()
  set (last_test "HDF_TEST-buffer")
endif ()