Testing: cleanup

This commit is contained in:
Shahram Najm 2023-04-29 12:44:25 +01:00
parent 3ce066b60a
commit 285cec091d
5 changed files with 19 additions and 38 deletions

View File

@ -9,31 +9,23 @@
. ./include.ctest.sh . ./include.ctest.sh
#Define a common label for all the tmp files # Define a common label for all the tmp files
label="bufr_get_string_array_test_f" label="bufr_get_string_array_test_f"
#Prepare tmp file # Prepare tmp file
fTmp=${label}.tmp.txt fTmp=${label}.tmp.txt
rm -f $fTmp rm -f $fTmp
#----------------------------------------------------- #----------------------------------------------------
# Test get string array from a BUFR # Test get string array from a BUFR
#---------------------------------------------------- #----------------------------------------------------
fRef=${data_dir}/bufr/get_string_array.ref fRef=${data_dir}/bufr/get_string_array.ref
REDIRECT=/dev/null # Write the values into a file and compare with reference
#Write the values into a file and compare with reference
${examples_dir}/eccodes_f_bufr_get_string_array > $fTmp ${examples_dir}/eccodes_f_bufr_get_string_array > $fTmp
#We compare output to the reference by ignoring the whitespaces # Compare output to the reference by ignoring the whitespaces
diff -w $fRef $fTmp diff -w $fRef $fTmp
#cat $fRes # Clean up
#Clean up
rm -f ${fTmp} rm -f ${fTmp}

View File

@ -26,7 +26,7 @@ REDIRECT=/dev/null
# Write the values into a file and compare with reference # Write the values into a file and compare with reference
${examples_dir}/eccodes_f_bufr_read_header $f 2> $REDIRECT > $fTmp ${examples_dir}/eccodes_f_bufr_read_header $f 2> $REDIRECT > $fTmp
# Compare output to the reference by ignoring the whitespaces # Compare output to the reference by ignoring the whitespaces
diff -w $fRef $fTmp >$REDIRECT 2> $REDIRECT diff -w $fRef $fTmp >$REDIRECT 2> $REDIRECT
#Clean up #Clean up

View File

@ -10,7 +10,6 @@
. ./include.ctest.sh . ./include.ctest.sh
# Define a common label for all the tmp files # Define a common label for all the tmp files
label="bufr_read_scatterometer_f" label="bufr_read_scatterometer_f"
@ -19,15 +18,12 @@ fTmp=${label}.tmp.txt
rm -f $fTmp rm -f $fTmp
# We check "asca_139.bufr". The path is hardcoded in the example # We check "asca_139.bufr". The path is hardcoded in the example
REDIRECT=/dev/null
# Write the key values into a file # Write the key values into a file
${examples_dir}/eccodes_f_bufr_read_scatterometer 2> $REDIRECT > $fTmp ${examples_dir}/eccodes_f_bufr_read_scatterometer > $fTmp
# Check the results # Check the results
REFERENCE_FILE=bufr_read_scatterometer_f.ref REFERENCE_FILE=bufr_read_scatterometer_f.ref
diff $REFERENCE_FILE $fTmp diff $REFERENCE_FILE $fTmp
#Clean up # Clean up
rm -f $fTmp rm -f $fTmp

View File

@ -10,22 +10,15 @@
. ./include.ctest.sh . ./include.ctest.sh
# Define a common label for all the tmp files
#Define a common label for all the tmp files
label="bufr_read_temp_f" label="bufr_read_temp_f"
#Define tmp file
fTmp=${label}.tmp.txt fTmp=${label}.tmp.txt
rm -f $fTmp rm -f $fTmp
# The path to the BUFR file is hardcoded in the example # The path to the BUFR file is hardcoded in the example
REDIRECT=/dev/null
# Run the example
${examples_dir}/eccodes_f_bufr_read_temp > $fTmp ${examples_dir}/eccodes_f_bufr_read_temp > $fTmp
grep -q 'timePeriod pressure geopotentialHeight' $fTmp
#TODO: check the results # Clean up
#Clean up
rm -f $fTmp rm -f $fTmp

View File

@ -10,15 +10,15 @@
. ./include.ctest.sh . ./include.ctest.sh
#Define a common label for all the tmp files # Define a common label for all the tmp files
label="bufr_subset_test_f" label="bufr_subset_test_f"
#Prepare tmp file # Prepare tmp file
fTmp=${label}.tmp.txt fTmp=${label}.tmp.txt
fTmp2=${label}.tmp2.txt fTmp2=${label}.tmp2.txt
rm -f $fTmp rm -f $fTmp
#Prepare ref file # Prepare ref file
fRef=${label}.ref fRef=${label}.ref
cat > $fRef <<EOF cat > $fRef <<EOF
message: 0 message: 0
@ -73,18 +73,18 @@ cat > $fRef <<EOF
stationNumber: 485 stationNumber: 485
EOF EOF
#We check "synop_multi_subset.bufr". The path is # We check "synop_multi_subset.bufr". The path is
#hardcoded in the example # hardcoded in the example
REDIRECT=/dev/stdout REDIRECT=/dev/stdout
#Write the values into a file and compare with reference # Write the values into a file and compare with reference
${examples_dir}/eccodes_f_bufr_subset 2> $REDIRECT > $fTmp ${examples_dir}/eccodes_f_bufr_subset 2> $REDIRECT > $fTmp
# Remove blank lines # Remove blank lines
sed '/^\s*$/d' < $fTmp > $fTmp2 sed '/^\s*$/d' < $fTmp > $fTmp2
#We compare output to the reference by ignoring the whitespaces # We compare output to the reference by ignoring the whitespaces
diff -w $fRef $fTmp2 >$REDIRECT 2> $REDIRECT diff -w $fRef $fTmp2 >$REDIRECT 2> $REDIRECT
#Clean up #Clean up