diff --git a/CMakeLists.txt b/CMakeLists.txt index f52cfa830..e0aacaa17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -295,6 +295,7 @@ endif() if( EC_OS_NAME MATCHES "windows" ) # Symbols need to be explicitly exported on Windows so we can link to dlls. set( CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE ) + set( ECCODES_ON_WINDOWS TRUE ) # Suppress compliler warnings - see ECC-850 # Suppress warnings about using 'insecure' functions. Fixing this would require changes all over diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 36878b44f..a4615c752 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -250,6 +250,14 @@ ecbuild_add_test( TARGET eccodes_t_grib_lamb_az_eq_area # These ones are conditional ########################################### +ecbuild_add_test( TARGET eccodes_t_tools_data_from_stdin + TYPE SCRIPT + CONDITION NOT ECCODES_ON_WINDOWS + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools_data_from_stdin.sh + TEST_DEPENDS eccodes_download_bufrs +) + + if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS ) ecbuild_add_executable( TARGET grib_encode_pthreads NOINSTALL diff --git a/tests/bufr_count.sh b/tests/bufr_count.sh index 963ee8b34..064eee5ea 100755 --- a/tests/bufr_count.sh +++ b/tests/bufr_count.sh @@ -39,8 +39,5 @@ set -e vcount=`${tools_dir}/bufr_count -f $temp` [ "$vcount" = "2" ] -# Reading from stdin -count2=`cat $input | ${tools_dir}/bufr_count -` -[ $count -eq $count2 ] rm -f $temp diff --git a/tests/bufr_ls.sh b/tests/bufr_ls.sh index 9cc20e4c6..a596f0a01 100755 --- a/tests/bufr_ls.sh +++ b/tests/bufr_ls.sh @@ -48,15 +48,6 @@ ${tools_dir}/bufr_ls -p totalLength,bufrHeaderCentre,bufrHeaderSubCentre,masterT awk NR==3 $fTmp | awk '{split($0,a," "); for (i=1; i<=8; i++) print a[i]}' > $res_ls diff $ref_ls $res_ls -#------------------------------------------- -# Test reading from stdin -#------------------------------------------- -f="aaen_55.bufr" -cat $f | ${tools_dir}/bufr_ls - -result1=`${tools_dir}/bufr_get -p numberOfSubsets $f` -result2=`cat $f | ${tools_dir}/bufr_get -p numberOfSubsets -` -[ "$result1" = "$result2" ] - rm -f $fLog $res_ls rm -f $fTmp diff --git a/tests/tools_data_from_stdin.sh b/tests/tools_data_from_stdin.sh new file mode 100755 index 000000000..85cfb4e21 --- /dev/null +++ b/tests/tools_data_from_stdin.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# Copyright 2005-2019 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + +. ./include.sh + +input=${data_dir}/bufr/syno_multi.bufr + +# Test bufr_count +# --------------- +count=`cat $input | ${tools_dir}/bufr_count -` +[ $count -eq 3 ] + +# Test bufr_ls +#-------------- +input=${data_dir}/bufr/aaen_55.bufr +cat $input | ${tools_dir}/bufr_ls - +result1=`${tools_dir}/bufr_get -p numberOfSubsets $input` +result2=`cat $input | ${tools_dir}/bufr_get -p numberOfSubsets -` +[ "$result1" = "$result2" ] +