2016-04-04 10:42:48 +00:00
|
|
|
#!/bin/sh
|
2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2016-04-04 10:42:48 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2022-04-03 22:02:48 +00:00
|
|
|
. ./include.ctest.sh
|
2016-04-04 10:42:48 +00:00
|
|
|
|
|
|
|
#set -x
|
|
|
|
|
|
|
|
#Enter data dir
|
|
|
|
cd ${data_dir}/gts
|
|
|
|
|
|
|
|
#Define a common label for all the tmp files
|
|
|
|
label="gts_compare_test"
|
|
|
|
|
|
|
|
#Create log file
|
|
|
|
fLog=${label}".log"
|
|
|
|
rm -f $fLog
|
|
|
|
touch $fLog
|
|
|
|
|
|
|
|
#Define tmp GTS file
|
|
|
|
fGtsTmp=${label}".gts.tmp"
|
|
|
|
fRules=${label}".filt"
|
|
|
|
fBufrInput1=${label}".bufr.input1"
|
|
|
|
fBufrInput2=${label}".bufr.input2"
|
|
|
|
|
|
|
|
#----------------------------------------------------
|
|
|
|
# Test: comparing same files
|
|
|
|
#----------------------------------------------------
|
|
|
|
gts_file="EGRR20150317121020_00493212.DAT"
|
|
|
|
echo "Test: comparing the same files" >> $fLog
|
|
|
|
echo "file: $gts_file" >> $fLog
|
2023-08-23 21:18:44 +00:00
|
|
|
${tools_dir}/gts_compare $gts_file $gts_file
|
2016-04-04 10:42:48 +00:00
|
|
|
|
|
|
|
#----------------------------------------------------
|
|
|
|
# Test: comparing two different files
|
|
|
|
#----------------------------------------------------
|
|
|
|
cat > $fRules<<EOF
|
|
|
|
if (count == 1) { set GG="01"; }
|
|
|
|
write;
|
|
|
|
EOF
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/gts_filter -o $fGtsTmp $fRules $gts_file
|
2016-04-04 10:42:48 +00:00
|
|
|
set +e
|
2023-08-23 21:18:44 +00:00
|
|
|
${tools_dir}/gts_compare -v -d $gts_file $fGtsTmp
|
2016-04-04 10:42:48 +00:00
|
|
|
status=$?
|
|
|
|
set -e
|
|
|
|
if [ $status -eq 0 ]; then
|
|
|
|
echo "gts_compare should have failed if files are different" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-08-23 21:18:44 +00:00
|
|
|
# The -d option should have created these two files
|
|
|
|
[ -f error1_1.gts ]
|
|
|
|
[ -f error2_1.gts ]
|
|
|
|
rm -f error1_1.gts error2_1.gts
|
2016-04-04 10:42:48 +00:00
|
|
|
|
|
|
|
#----------------------------------------------------
|
2019-12-27 11:53:03 +00:00
|
|
|
# Test: comparing with and without the -b switch
|
2016-04-04 10:42:48 +00:00
|
|
|
#----------------------------------------------------
|
2023-08-23 21:18:44 +00:00
|
|
|
${tools_dir}/gts_compare -b GG $gts_file $fGtsTmp >> $fLog
|
2016-04-04 10:42:48 +00:00
|
|
|
|
|
|
|
#Clean up
|
|
|
|
rm -f $fLog $fGtsTmp $fRules
|