2014-04-01 08:54:03 +00:00
|
|
|
# examples/python/CMakeLists.txt
|
|
|
|
|
|
|
|
# Configure the file which all CMake tests will include
|
|
|
|
configure_file( include.ctest.sh.in include.ctest.sh @ONLY )
|
|
|
|
|
2024-01-08 18:50:33 +00:00
|
|
|
# execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include.sh ${CMAKE_CURRENT_BINARY_DIR} )
|
2014-04-01 08:54:03 +00:00
|
|
|
|
|
|
|
# Build the executables used by test scripts
|
|
|
|
################################################
|
2020-03-30 13:07:31 +00:00
|
|
|
list(APPEND test_bins
|
2015-03-17 15:01:07 +00:00
|
|
|
grib_keys_iterator
|
2015-03-17 15:41:04 +00:00
|
|
|
grib_print_data
|
2015-03-17 14:21:14 +00:00
|
|
|
grib_iterator
|
2016-04-27 16:32:11 +00:00
|
|
|
grib_count_messages
|
2014-04-01 08:54:03 +00:00
|
|
|
)
|
2015-07-02 12:02:54 +00:00
|
|
|
|
2014-04-01 08:54:03 +00:00
|
|
|
foreach( tool ${test_bins} )
|
|
|
|
ecbuild_add_executable( TARGET p_${tool}
|
|
|
|
NOINSTALL
|
|
|
|
SOURCES ${tool}.c
|
2020-10-15 16:08:25 +00:00
|
|
|
CONDITION HAVE_PYTHON2
|
2020-03-30 13:07:31 +00:00
|
|
|
LIBS eccodes )
|
2014-07-10 11:49:35 +00:00
|
|
|
list( APPEND ptools p_${tool} )
|
2014-04-01 08:54:03 +00:00
|
|
|
endforeach()
|
|
|
|
|
2015-07-02 12:02:54 +00:00
|
|
|
|
2014-04-01 08:54:03 +00:00
|
|
|
# Now add each test
|
2020-08-07 21:36:59 +00:00
|
|
|
################################################
|
|
|
|
if( HAVE_BUILD_TOOLS )
|
|
|
|
list(APPEND tests_basic
|
|
|
|
grib_set_pv
|
|
|
|
grib_read_sample
|
|
|
|
bufr_read_sample
|
|
|
|
bufr_ecc-869
|
|
|
|
)
|
|
|
|
list(APPEND tests_extra
|
|
|
|
grib_clone
|
|
|
|
grib_count_messages
|
|
|
|
grib_get_message_offset
|
|
|
|
grib_get_keys
|
|
|
|
grib_index
|
|
|
|
grib_iterator
|
|
|
|
grib_keys_iterator
|
|
|
|
grib_multi_write
|
|
|
|
grib_nearest
|
|
|
|
grib_print_data
|
|
|
|
grib_samples
|
|
|
|
grib_set_missing
|
|
|
|
binary_message
|
|
|
|
grib_set_bitmap
|
|
|
|
bufr_attributes
|
|
|
|
bufr_clone
|
|
|
|
bufr_copy_data
|
|
|
|
bufr_expanded
|
|
|
|
bufr_get_keys
|
|
|
|
bufr_keys_iterator
|
|
|
|
bufr_read_header
|
|
|
|
bufr_read_scatterometer
|
|
|
|
bufr_read_tropical_cyclone
|
|
|
|
bufr_read_synop
|
|
|
|
bufr_read_temp
|
2022-01-11 19:27:41 +00:00
|
|
|
bufr_read_tempf
|
2020-08-07 21:36:59 +00:00
|
|
|
bufr_set_keys
|
|
|
|
bufr_subset
|
|
|
|
get_product_kind
|
|
|
|
gts_get_keys
|
|
|
|
metar_get_keys
|
|
|
|
bufr_ecc-448
|
|
|
|
)
|
|
|
|
else()
|
2020-08-08 12:07:16 +00:00
|
|
|
# No command line tools
|
2020-08-07 21:36:59 +00:00
|
|
|
list(APPEND tests_basic
|
|
|
|
grib_read_sample
|
|
|
|
bufr_read_sample
|
|
|
|
)
|
|
|
|
list(APPEND tests_extra
|
|
|
|
grib_clone
|
|
|
|
grib_count_messages
|
|
|
|
grib_get_keys
|
|
|
|
grib_index
|
|
|
|
grib_iterator
|
|
|
|
grib_keys_iterator
|
|
|
|
grib_multi_write
|
|
|
|
grib_nearest
|
|
|
|
grib_print_data
|
|
|
|
grib_samples
|
|
|
|
bufr_attributes
|
|
|
|
bufr_clone
|
|
|
|
bufr_expanded
|
|
|
|
bufr_get_keys
|
|
|
|
bufr_keys_iterator
|
|
|
|
bufr_read_header
|
|
|
|
bufr_read_scatterometer
|
|
|
|
bufr_read_tropical_cyclone
|
|
|
|
bufr_read_synop
|
|
|
|
bufr_read_temp
|
2022-01-11 19:27:41 +00:00
|
|
|
bufr_read_tempf
|
2020-08-07 21:36:59 +00:00
|
|
|
bufr_set_keys
|
|
|
|
bufr_subset
|
|
|
|
get_product_kind
|
|
|
|
gts_get_keys
|
|
|
|
metar_get_keys
|
|
|
|
bufr_ecc-448
|
|
|
|
)
|
|
|
|
endif()
|
2016-12-14 09:53:20 +00:00
|
|
|
|
2021-04-11 16:07:02 +00:00
|
|
|
# Some tests require new features
|
2016-12-14 09:53:20 +00:00
|
|
|
# which are only there for python 2.7 onwards
|
2020-10-15 16:08:25 +00:00
|
|
|
if( HAVE_PYTHON2 AND PYTHON_VERSION_STRING VERSION_GREATER "2.7" )
|
2018-10-23 15:33:07 +00:00
|
|
|
list( APPEND tests_extra grib_set_keys ) # Uses OrderedDict
|
2016-12-14 09:53:20 +00:00
|
|
|
endif()
|
|
|
|
|
2018-10-23 15:33:07 +00:00
|
|
|
foreach( test ${tests_basic} )
|
2015-07-14 16:11:57 +00:00
|
|
|
ecbuild_add_test( TARGET eccodes_p_${test}_test
|
2015-08-25 10:22:19 +00:00
|
|
|
TYPE SCRIPT
|
|
|
|
DEPENDS ${ptools}
|
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
|
2020-10-15 16:08:25 +00:00
|
|
|
CONDITION HAVE_PYTHON2
|
2020-03-30 13:07:31 +00:00
|
|
|
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} )
|
2018-10-23 15:33:07 +00:00
|
|
|
endforeach()
|
|
|
|
foreach( test ${tests_extra} )
|
|
|
|
ecbuild_add_test( TARGET eccodes_p_${test}_test
|
|
|
|
TYPE SCRIPT
|
|
|
|
DEPENDS ${ptools}
|
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
|
2020-10-15 16:08:25 +00:00
|
|
|
CONDITION HAVE_PYTHON2 AND ENABLE_EXTRA_TESTS
|
2018-10-23 15:33:07 +00:00
|
|
|
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
|
2020-03-30 13:07:31 +00:00
|
|
|
TEST_DEPENDS eccodes_download_gribs eccodes_download_tigge_gribs eccodes_download_bufrs )
|
2014-04-01 08:54:03 +00:00
|
|
|
endforeach()
|
2015-11-10 20:45:59 +00:00
|
|
|
|
2015-11-11 10:30:40 +00:00
|
|
|
# Add test which requires input CSV file
|
|
|
|
ecbuild_add_test( TARGET eccodes_p_bufr_encode_flight_test
|
2015-11-10 20:45:59 +00:00
|
|
|
TYPE SCRIPT
|
|
|
|
DEPENDS ${ptools}
|
2015-11-11 10:30:40 +00:00
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_encode_flight.sh
|
2020-10-15 16:08:25 +00:00
|
|
|
CONDITION HAVE_PYTHON2 AND ENABLE_EXTRA_TESTS AND HAVE_BUILD_TOOLS
|
2015-11-10 20:45:59 +00:00
|
|
|
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
|
|
|
|
RESOURCES flight_data.csv
|
2020-03-30 13:07:31 +00:00
|
|
|
TEST_DEPENDS eccodes_download_bufrs )
|
2016-07-18 13:58:18 +00:00
|
|
|
|
|
|
|
# Conditional tests
|
|
|
|
ecbuild_add_test( TARGET eccodes_p_grib_ccsds_test
|
|
|
|
TYPE SCRIPT
|
|
|
|
DEPENDS ${ptools}
|
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ccsds.sh
|
2020-10-15 16:08:25 +00:00
|
|
|
CONDITION HAVE_PYTHON2 AND HAVE_AEC AND ENABLE_EXTRA_TESTS
|
2016-07-18 13:58:18 +00:00
|
|
|
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
|
2020-03-30 13:07:31 +00:00
|
|
|
TEST_DEPENDS eccodes_download_gribs )
|