1#
2# Copyright by The HDF Group.
3# All rights reserved.
4#
5# This file is part of HDF5.  The full HDF5 copyright notice, including
6# terms governing use, modification, and redistribution, is contained in
7# the COPYING file, which can be found at the root of the source code
8# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
9# If you do not have access to either file, you may request a copy from
10# help@hdfgroup.org.
11#
12
13##############################################################################
14##############################################################################
15###           T E S T I N G                                                ###
16##############################################################################
17##############################################################################
18
19set (HDF5_TEST_FILES
20    image24pixel.txt
21    image8.txt
22)
23
24foreach (h5_file ${HDF5_TEST_FILES})
25  HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "hl_ex_ex_ds1_files")
26endforeach ()
27add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ex_ds1 tests" DEPENDS ${hl_ex_ex_ds1_files_list})
28
29# Remove any output file left over from previous test run
30add_test (
31    NAME HL_ex-clear-objects
32    COMMAND    ${CMAKE_COMMAND}
33        -E remove
34            ex_lite1.h5
35            ex_lite2.h5
36            ex_lite3.h5
37            packet_table_FLexample.h5
38            ex_image1.h5
39            ex_image2.h5
40            ex_table_01.h5
41            ex_table_02.h5
42            ex_table_03.h5
43            ex_table_04.h5
44            ex_table_05.h5
45            ex_table_06.h5
46            ex_table_07.h5
47            ex_table_08.h5
48            ex_table_09.h5
49            ex_table_10.h5
50            ex_table_11.h5
51            ex_table_12.h5
52            ex_ds1.h5
53)
54set_tests_properties (HL_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_ex)
55
56foreach (example ${examples})
57  if (HDF5_ENABLE_USING_MEMCHECKER)
58    add_test (NAME HL_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_ex_${example}>)
59  else ()
60    add_test (NAME HL_ex_${example} COMMAND "${CMAKE_COMMAND}"
61        -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
62        -D "TEST_PROGRAM=$<TARGET_FILE:hl_ex_${example}>"
63        -D "TEST_ARGS:STRING="
64        -D "TEST_EXPECT=0"
65        -D "TEST_SKIP_COMPARE=TRUE"
66        -D "TEST_OUTPUT=hl_ex_${example}.txt"
67        #-D "TEST_REFERENCE=hl_ex_${example}.out"
68        -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
69        -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
70    )
71  endif ()
72  if (last_test)
73    set_tests_properties (HL_ex_${example} PROPERTIES
74        DEPENDS ${last_test}
75        FIXTURES_REQUIRED clear_HL_ex
76    )
77  endif ()
78  set (last_test "HL_ex_${example}")
79endforeach ()
80