mirror of https://github.com/ecmwf/eccodes.git
CMake tests for python
This commit is contained in:
parent
31f0e88a45
commit
7330411051
|
@ -32,7 +32,6 @@ list( APPEND test_bins
|
||||||
clone
|
clone
|
||||||
)
|
)
|
||||||
foreach( tool ${test_bins} )
|
foreach( tool ${test_bins} )
|
||||||
# here we use the fact that each tool has only one C file that matches its name
|
|
||||||
ecbuild_add_executable( TARGET ${tool}
|
ecbuild_add_executable( TARGET ${tool}
|
||||||
NOINSTALL
|
NOINSTALL
|
||||||
SOURCES ${tool}.c
|
SOURCES ${tool}.c
|
||||||
|
@ -42,79 +41,29 @@ endforeach()
|
||||||
|
|
||||||
# Now add each test
|
# Now add each test
|
||||||
#################################################
|
#################################################
|
||||||
ecbuild_add_test( TARGET c_iterator
|
list( APPEND tests
|
||||||
TYPE SCRIPT
|
iterator
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/iterator.sh
|
get
|
||||||
RESOURCES include.sh
|
print_data
|
||||||
)
|
set
|
||||||
ecbuild_add_test( TARGET c_get
|
keys_iterator
|
||||||
TYPE SCRIPT
|
multi
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/get.sh
|
multi_write
|
||||||
RESOURCES include.sh
|
precision
|
||||||
)
|
list
|
||||||
ecbuild_add_test( TARGET c_print_data
|
large_grib1
|
||||||
TYPE SCRIPT
|
get_data
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/print_data.sh
|
set_missing
|
||||||
RESOURCES include.sh
|
clone
|
||||||
)
|
sections_copy
|
||||||
ecbuild_add_test( TARGET c_set
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/set.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
|
||||||
ecbuild_add_test( TARGET c_keys_iterator
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/keys_iterator.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
|
||||||
ecbuild_add_test( TARGET c_multi
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/multi.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
|
||||||
ecbuild_add_test( TARGET c_multi_write
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/multi_write.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
|
||||||
ecbuild_add_test( TARGET c_precision
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/precision.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
|
||||||
ecbuild_add_test( TARGET c_list
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/list.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
|
||||||
|
|
||||||
ecbuild_add_test( TARGET c_large_grib1
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/large_grib1.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
|
||||||
ecbuild_add_test( TARGET c_get_data
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/get_data.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
|
||||||
|
|
||||||
ecbuild_add_test( TARGET c_set_missing
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/set_missing.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
|
||||||
ecbuild_add_test( TARGET c_clone
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/clone.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
|
||||||
|
|
||||||
ecbuild_add_test( TARGET c_sections_copy
|
|
||||||
TYPE SCRIPT
|
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/sections_copy.sh
|
|
||||||
RESOURCES include.sh
|
|
||||||
)
|
)
|
||||||
|
foreach (test ${tests})
|
||||||
|
ecbuild_add_test( TARGET c_${test}
|
||||||
|
TYPE SCRIPT
|
||||||
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
|
||||||
|
RESOURCES include.sh
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
|
@ -123,5 +72,6 @@ ecbuild_add_test( TARGET c_new_sample
|
||||||
SOURCES new_sample.c
|
SOURCES new_sample.c
|
||||||
LIBS grib_api
|
LIBS grib_api
|
||||||
ARGS "out.grib"
|
ARGS "out.grib"
|
||||||
ENVIRONMENT "GRIB_SAMPLES_PATH=${PROJECT_SOURCE_DIR}/samples" "GRIB_DEFINITION_PATH=${PROJECT_SOURCE_DIR}/definitions" )
|
ENVIRONMENT "GRIB_SAMPLES_PATH=${PROJECT_SOURCE_DIR}/samples" "GRIB_DEFINITION_PATH=${PROJECT_SOURCE_DIR}/definitions"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
add_subdirectory(C)
|
add_subdirectory(C)
|
||||||
add_subdirectory(F90)
|
add_subdirectory(F90)
|
||||||
|
add_subdirectory(python)
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,11 @@ TESTS = clone.sh count_messages.sh get.sh index.sh iterator.sh keys_iterator.sh
|
||||||
samples.sh set.sh set_missing.sh binary_message.sh set_bitmap.sh
|
samples.sh set.sh set_missing.sh binary_message.sh set_bitmap.sh
|
||||||
TESTS_ENVIRONMENT = TOPBUILDDIR=$(top_builddir) PYTHON=$(PYTHON)
|
TESTS_ENVIRONMENT = TOPBUILDDIR=$(top_builddir) PYTHON=$(PYTHON)
|
||||||
|
|
||||||
noinst_PROGRAMS = keys_iterator print_data iterator count_messages
|
noinst_PROGRAMS = p_keys_iterator p_print_data p_iterator p_count_messages
|
||||||
keys_iterator_SOURCES = keys_iterator.c
|
p_keys_iterator_SOURCES = keys_iterator.c
|
||||||
print_data_SOURCES = print_data.c
|
p_print_data_SOURCES = print_data.c
|
||||||
iterator_SOURCES = iterator.c
|
p_iterator_SOURCES = iterator.c
|
||||||
count_messages_SOURCES = count_messages.c
|
p_count_messages_SOURCES = count_messages.c
|
||||||
INCLUDES = -I$(top_builddir)/src
|
INCLUDES = -I$(top_builddir)/src
|
||||||
LDADD = $(top_builddir)/src/libgrib_api.la
|
LDADD = $(top_builddir)/src/libgrib_api.la
|
||||||
DEPENDENCIES = $(LDADD)
|
DEPENDENCIES = $(LDADD)
|
||||||
|
|
|
@ -6,7 +6,7 @@ TEMP1=temp1
|
||||||
TEMP2=temp2
|
TEMP2=temp2
|
||||||
|
|
||||||
$PYTHON count_messages.py 2> $TEMP1 > $TEMP1
|
$PYTHON count_messages.py 2> $TEMP1 > $TEMP1
|
||||||
./count_messages ../../data/tigge_pf_ecmwf.grib2 2> $TEMP2 > $TEMP2
|
./p_count_messages ../../data/tigge_pf_ecmwf.grib2 2> $TEMP2 > $TEMP2
|
||||||
|
|
||||||
diff $TEMP1 $TEMP2
|
diff $TEMP1 $TEMP2
|
||||||
rm $TEMP1 $TEMP2 || true
|
rm $TEMP1 $TEMP2 || true
|
||||||
|
|
|
@ -1,19 +1,25 @@
|
||||||
set -ea
|
CMAKE_INCLUDE_FILE=include.ctest.sh
|
||||||
|
if [ -f "$CMAKE_INCLUDE_FILE" ]; then
|
||||||
|
# This is the config file for Cmake tests
|
||||||
|
. ./$CMAKE_INCLUDE_FILE
|
||||||
|
|
||||||
echo
|
else
|
||||||
echo "TEST: $0"
|
set -ea
|
||||||
|
echo
|
||||||
|
echo "TEST: $0"
|
||||||
|
|
||||||
cpath=$TOPBUILDDIR
|
cpath=$TOPBUILDDIR
|
||||||
GRIB_DEFINITION_PATH=$cpath/definitions
|
GRIB_DEFINITION_PATH=$cpath/definitions
|
||||||
export GRIB_DEFINITION_PATH
|
export GRIB_DEFINITION_PATH
|
||||||
GRIB_SAMPLES_PATH=$cpath/samples
|
GRIB_SAMPLES_PATH=$cpath/samples
|
||||||
export GRIB_SAMPLES_PATH
|
export GRIB_SAMPLES_PATH
|
||||||
tools_dir=$cpath/tools/
|
tools_dir=$cpath/tools/
|
||||||
examples_dir=$cpath/examples/python
|
examples_dir=$cpath/examples/python
|
||||||
data_dir=$cpath/data
|
data_dir=$cpath/data
|
||||||
|
|
||||||
PYTHONPATH=$cpath/python:$cpath/python/.libs:$PYTHONPATH
|
PYTHONPATH=$cpath/python:$cpath/python/.libs:$PYTHONPATH
|
||||||
export PYTHONPATH
|
export PYTHONPATH
|
||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
|
@ -6,7 +6,7 @@ TEMP1=temp1
|
||||||
TEMP2=temp2
|
TEMP2=temp2
|
||||||
|
|
||||||
$PYTHON iterator.py 2> $TEMP1 > $TEMP1
|
$PYTHON iterator.py 2> $TEMP1 > $TEMP1
|
||||||
./iterator ../../data/reduced_latlon_surface.grib1 2> $TEMP2 > $TEMP2
|
./p_iterator ../../data/reduced_latlon_surface.grib1 2> $TEMP2 > $TEMP2
|
||||||
|
|
||||||
diff $TEMP1 $TEMP2
|
diff $TEMP1 $TEMP2
|
||||||
rm $TEMP1 $TEMP2 || true
|
rm $TEMP1 $TEMP2 || true
|
||||||
|
|
|
@ -6,7 +6,7 @@ TEMP1=temp1
|
||||||
TEMP2=temp2
|
TEMP2=temp2
|
||||||
|
|
||||||
$PYTHON keys_iterator.py 2> $TEMP1 > $TEMP1
|
$PYTHON keys_iterator.py 2> $TEMP1 > $TEMP1
|
||||||
./keys_iterator ../../data/reduced_latlon_surface.grib1 2> $TEMP2 > $TEMP2
|
./p_keys_iterator ../../data/reduced_latlon_surface.grib1 2> $TEMP2 > $TEMP2
|
||||||
|
|
||||||
diff $TEMP1 $TEMP2
|
diff $TEMP1 $TEMP2
|
||||||
rm $TEMP1 $TEMP2 || true
|
rm $TEMP1 $TEMP2 || true
|
||||||
|
|
|
@ -6,7 +6,7 @@ TEMP1=temp1
|
||||||
TEMP2=temp2
|
TEMP2=temp2
|
||||||
|
|
||||||
$PYTHON print_data.py 2> $TEMP1 > $TEMP1
|
$PYTHON print_data.py 2> $TEMP1 > $TEMP1
|
||||||
./print_data ../../data/regular_latlon_surface.grib1 2> $TEMP2 > $TEMP2
|
./p_print_data ../../data/regular_latlon_surface.grib1 2> $TEMP2 > $TEMP2
|
||||||
|
|
||||||
diff $TEMP1 $TEMP2
|
diff $TEMP1 $TEMP2
|
||||||
rm $TEMP1 $TEMP2 || true
|
rm $TEMP1 $TEMP2 || true
|
||||||
|
|
Loading…
Reference in New Issue