2014-03-31 12:57:06 +00:00
|
|
|
# examples/C/CMakeLists.txt
|
|
|
|
|
|
|
|
# Configure the file which all CMake tests will include
|
|
|
|
configure_file( include.ctest.sh.in include.ctest.sh @ONLY )
|
|
|
|
|
|
|
|
|
|
|
|
# Build the executables used by test scripts
|
2021-03-13 21:10:16 +00:00
|
|
|
#############################################
|
2014-03-31 12:57:06 +00:00
|
|
|
list( APPEND test_bins
|
2015-03-17 15:55:36 +00:00
|
|
|
grib_nearest
|
2015-03-17 16:17:33 +00:00
|
|
|
grib_set_bitmap
|
2015-03-17 14:21:14 +00:00
|
|
|
grib_iterator
|
2015-03-17 13:19:09 +00:00
|
|
|
grib_get_keys
|
2015-03-17 15:41:04 +00:00
|
|
|
grib_print_data
|
2015-03-17 15:23:16 +00:00
|
|
|
grib_set_keys
|
2015-03-18 13:48:30 +00:00
|
|
|
grib_index
|
2020-10-20 16:32:02 +00:00
|
|
|
grib_set_missing
|
2015-03-17 15:01:07 +00:00
|
|
|
grib_keys_iterator
|
2015-03-17 16:26:03 +00:00
|
|
|
grib_set_data
|
2019-04-17 16:22:14 +00:00
|
|
|
grib_nearest_multiple
|
2015-03-18 11:44:55 +00:00
|
|
|
grib_multi
|
2015-03-18 11:57:18 +00:00
|
|
|
grib_multi_write
|
2015-03-18 13:06:18 +00:00
|
|
|
grib_precision
|
2015-03-17 17:39:55 +00:00
|
|
|
grib_set_pv
|
2015-03-18 14:35:13 +00:00
|
|
|
grib_list
|
|
|
|
grib_get_data
|
2019-07-22 10:15:42 +00:00
|
|
|
grib_sections_copy
|
2024-01-28 14:50:24 +00:00
|
|
|
grib_copy_keys
|
2015-03-17 14:01:14 +00:00
|
|
|
grib_clone
|
2016-04-06 17:13:31 +00:00
|
|
|
grib_copy_message
|
2015-03-17 14:46:35 +00:00
|
|
|
grib_ensemble_index
|
2016-10-18 10:43:42 +00:00
|
|
|
bufr_copy_data
|
2015-02-25 12:19:18 +00:00
|
|
|
bufr_attributes
|
2015-02-04 15:58:52 +00:00
|
|
|
bufr_clone
|
2015-02-05 16:29:49 +00:00
|
|
|
bufr_expanded
|
2015-02-06 11:44:01 +00:00
|
|
|
bufr_get_keys
|
2017-10-02 13:28:12 +00:00
|
|
|
bufr_get_string_array
|
2015-02-06 16:38:23 +00:00
|
|
|
bufr_keys_iterator
|
2015-02-27 12:50:03 +00:00
|
|
|
bufr_missing
|
2015-03-17 10:39:22 +00:00
|
|
|
bufr_read_header
|
2015-03-20 10:41:01 +00:00
|
|
|
bufr_read_scatterometer
|
2015-03-17 10:39:22 +00:00
|
|
|
bufr_read_synop
|
2015-03-05 11:05:18 +00:00
|
|
|
bufr_read_temp
|
2022-01-11 12:10:34 +00:00
|
|
|
bufr_read_tempf
|
2015-02-06 14:23:28 +00:00
|
|
|
bufr_set_keys
|
2021-11-30 13:10:04 +00:00
|
|
|
bufr_subset
|
|
|
|
mars_param
|
2022-01-17 14:10:59 +00:00
|
|
|
grib_values_check
|
2021-11-30 13:10:04 +00:00
|
|
|
multi2
|
|
|
|
large_grib1
|
|
|
|
get_product_kind)
|
2021-03-13 21:10:16 +00:00
|
|
|
|
2014-03-31 12:57:06 +00:00
|
|
|
foreach( tool ${test_bins} )
|
2015-03-18 14:35:13 +00:00
|
|
|
ecbuild_add_executable( TARGET c_${tool}
|
2014-03-31 12:57:06 +00:00
|
|
|
NOINSTALL
|
|
|
|
SOURCES ${tool}.c
|
2020-03-30 13:07:31 +00:00
|
|
|
LIBS eccodes )
|
2014-03-31 12:57:06 +00:00
|
|
|
endforeach()
|
|
|
|
|
2015-01-24 19:00:15 +00:00
|
|
|
# Now add each test (shell scripts)
|
2021-03-13 21:10:16 +00:00
|
|
|
####################################
|
2020-08-07 21:36:59 +00:00
|
|
|
if( HAVE_BUILD_TOOLS )
|
2020-08-08 12:07:16 +00:00
|
|
|
# Command line tools are available
|
2020-08-07 21:36:59 +00:00
|
|
|
list(APPEND tests_sanity
|
|
|
|
grib_set_data
|
|
|
|
large_grib1
|
|
|
|
grib_sections_copy
|
2024-01-28 14:50:24 +00:00
|
|
|
grib_copy_keys
|
2020-08-07 21:36:59 +00:00
|
|
|
get_product_kind_samples)
|
|
|
|
list(APPEND tests_extra
|
|
|
|
grib_iterator
|
|
|
|
grib_get_keys
|
|
|
|
grib_print_data
|
|
|
|
grib_set_keys
|
|
|
|
grib_keys_iterator
|
|
|
|
grib_multi_write
|
|
|
|
grib_precision
|
|
|
|
grib_clone
|
|
|
|
grib_copy_message
|
|
|
|
grib_ensemble_index
|
2024-01-18 17:14:22 +00:00
|
|
|
grib_index
|
2020-08-07 21:36:59 +00:00
|
|
|
grib_set_pv
|
|
|
|
grib_set_bitmap
|
|
|
|
grib_list
|
|
|
|
grib_get_data
|
2024-01-14 00:13:59 +00:00
|
|
|
grib_mars_param
|
2022-02-23 18:36:45 +00:00
|
|
|
grib_nearest
|
2020-08-07 21:36:59 +00:00
|
|
|
grib_nearest_multiple
|
|
|
|
grib_multi
|
2020-10-20 16:32:02 +00:00
|
|
|
grib_set_missing
|
2022-01-17 14:10:59 +00:00
|
|
|
grib_values_check
|
2020-08-07 21:36:59 +00:00
|
|
|
bufr_attributes
|
|
|
|
bufr_copy_data
|
|
|
|
bufr_clone
|
|
|
|
bufr_expanded
|
|
|
|
bufr_get_keys
|
|
|
|
bufr_get_string_array
|
|
|
|
bufr_keys_iterator
|
|
|
|
bufr_missing
|
|
|
|
bufr_read_header
|
|
|
|
bufr_read_scatterometer
|
|
|
|
bufr_read_synop
|
|
|
|
bufr_read_temp
|
2022-01-11 12:10:34 +00:00
|
|
|
bufr_read_tempf
|
2020-08-07 21:36:59 +00:00
|
|
|
bufr_set_keys
|
|
|
|
bufr_subset
|
|
|
|
get_product_kind)
|
|
|
|
else()
|
2020-08-08 12:07:16 +00:00
|
|
|
# No command line tools
|
2020-08-07 21:36:59 +00:00
|
|
|
list(APPEND tests_sanity
|
|
|
|
grib_set_data
|
|
|
|
get_product_kind_samples)
|
|
|
|
list(APPEND tests_extra
|
|
|
|
grib_iterator
|
|
|
|
grib_get_keys
|
|
|
|
grib_print_data
|
|
|
|
grib_set_keys
|
|
|
|
grib_keys_iterator
|
|
|
|
grib_precision
|
|
|
|
grib_ensemble_index
|
|
|
|
grib_set_pv
|
|
|
|
grib_list
|
|
|
|
grib_get_data
|
|
|
|
grib_nearest_multiple
|
|
|
|
grib_multi
|
2020-10-20 16:32:02 +00:00
|
|
|
grib_set_missing
|
2020-08-07 21:36:59 +00:00
|
|
|
bufr_attributes
|
|
|
|
bufr_expanded
|
|
|
|
bufr_get_keys
|
|
|
|
bufr_get_string_array
|
|
|
|
bufr_keys_iterator
|
|
|
|
bufr_missing
|
|
|
|
bufr_read_header
|
|
|
|
bufr_read_scatterometer
|
|
|
|
bufr_read_synop
|
|
|
|
bufr_read_temp
|
2022-01-11 12:10:34 +00:00
|
|
|
bufr_read_tempf
|
2020-08-07 21:36:59 +00:00
|
|
|
bufr_set_keys
|
|
|
|
bufr_subset
|
|
|
|
get_product_kind)
|
|
|
|
endif()
|
2018-10-23 15:33:07 +00:00
|
|
|
|
2020-07-03 14:40:05 +00:00
|
|
|
foreach( test ${tests_sanity} )
|
2020-08-07 21:36:59 +00:00
|
|
|
ecbuild_add_test( TARGET eccodes_c_${test}
|
|
|
|
TYPE SCRIPT
|
|
|
|
LABELS "sanity"
|
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh )
|
2018-10-23 15:33:07 +00:00
|
|
|
endforeach()
|
|
|
|
foreach( test ${tests_extra} )
|
2020-08-07 21:36:59 +00:00
|
|
|
ecbuild_add_test( TARGET eccodes_c_${test}
|
|
|
|
TYPE SCRIPT
|
|
|
|
CONDITION ENABLE_EXTRA_TESTS
|
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
|
2023-02-26 15:07:26 +00:00
|
|
|
TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs eccodes_download_bufr_refs )
|
2014-03-31 16:15:20 +00:00
|
|
|
endforeach()
|
2014-03-31 12:57:06 +00:00
|
|
|
|
2016-05-24 13:27:46 +00:00
|
|
|
# Tests which are conditional
|
2021-03-13 21:10:16 +00:00
|
|
|
#############################
|
2016-05-24 13:27:46 +00:00
|
|
|
if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS )
|
2016-11-18 20:20:59 +00:00
|
|
|
# For POSIX threads
|
2020-03-30 13:07:31 +00:00
|
|
|
list(APPEND pthread_tests grib_pthreads bufr_pthreads)
|
2016-11-18 20:20:59 +00:00
|
|
|
foreach( test ${pthread_tests} )
|
|
|
|
ecbuild_add_executable( TARGET c_${test}
|
|
|
|
NOINSTALL
|
|
|
|
SOURCES ${test}.c
|
2020-08-19 16:06:56 +00:00
|
|
|
LIBS eccodes ${CMAKE_THREAD_LIBS_INIT} )
|
2016-11-18 20:20:59 +00:00
|
|
|
ecbuild_add_test( TARGET eccodes_c_${test}
|
|
|
|
TYPE SCRIPT
|
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
|
2020-03-30 13:07:31 +00:00
|
|
|
TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs )
|
2016-11-18 20:20:59 +00:00
|
|
|
endforeach()
|
2016-05-24 13:27:46 +00:00
|
|
|
endif()
|
|
|
|
|
2014-03-31 12:57:06 +00:00
|
|
|
# Tests with no script
|
2021-03-13 21:10:16 +00:00
|
|
|
######################
|
2016-05-24 13:27:46 +00:00
|
|
|
ecbuild_add_test(
|
|
|
|
TARGET eccodes_c_new_sample
|
|
|
|
SOURCES new_sample.c
|
|
|
|
LIBS eccodes
|
|
|
|
ARGS "out.grib"
|
|
|
|
ENVIRONMENT "ECCODES_SAMPLES_PATH=${PROJECT_SOURCE_DIR}/samples" "ECCODES_DEFINITION_PATH=${PROJECT_SOURCE_DIR}/definitions"
|
2014-03-31 16:15:20 +00:00
|
|
|
)
|