Testing: Consistent naming

This commit is contained in:
shahramn 2024-02-20 13:57:38 +00:00
parent 24bf6f1846
commit c6bc2dc027
8 changed files with 42 additions and 68 deletions

View File

@ -11,15 +11,15 @@
. ./include.ctest.sh . ./include.ctest.sh
set -u set -u
label="bufr_ecc-1028_test" label="bufr_ecc-1028_test"
tempFilter=temp.$label.filt tempFilt=temp.$label.filt
tempError=temp.$label.err tempError=temp.$label.err
sample_bufr4=$ECCODES_SAMPLES_PATH/BUFR4.tmpl sample_bufr4=$ECCODES_SAMPLES_PATH/BUFR4.tmpl
# Incorrect replication. Encoding should fail # Incorrect replication. Encoding should fail
echo "set unexpandedDescriptors={ 101000, 31002 }; write;" > $tempFilter echo "set unexpandedDescriptors={ 101000, 31002 }; write;" > $tempFilt
set +e set +e
${tools_dir}/bufr_filter $tempFilter $sample_bufr4 2>$tempError ${tools_dir}/bufr_filter $tempFilt $sample_bufr4 2>$tempError
status=$? status=$?
set -e set -e
[ $status -ne 0 ] [ $status -ne 0 ]
@ -27,4 +27,4 @@ set -e
grep -q "Delayed replication: 101000: expected 1 but only found 0 elements" $tempError grep -q "Delayed replication: 101000: expected 1 but only found 0 elements" $tempError
rm -f $tempFilter $tempError rm -f $tempFilt $tempError

View File

@ -13,31 +13,6 @@
#include <assert.h> #include <assert.h>
#define MAX_KEYS 100 #define MAX_KEYS 100
#if 0
int main(int argc, char* argv[])
{
char *filename;
int err = 0;
int num_messages = 0, i =0;
off_t* offsets = NULL;
codes_context* c = codes_context_get_default();
const int strict_mode = 1;
/* Usage: prog file */
assert(argc == 2);
filename = argv[1];
err = codes_extract_offsets_malloc(c, filename, PRODUCT_GRIB, &offsets, &num_messages, strict_mode);
assert(!err);
for (i = 0; i < num_messages; ++i) {
printf("Message #%d: %lu\n", i, offsets[i]);
}
free(offsets);
return 0;
}
#endif
#if 1
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
char *filename, *keys; char *filename, *keys;
@ -85,4 +60,3 @@ int main(int argc, char* argv[])
return 0; return 0;
} }
#endif

View File

@ -11,7 +11,7 @@
# Define a common label for all the tmp files # Define a common label for all the tmp files
label="grib_healpix_test" label="grib_healpix_test"
tempFilter="temp.${label}.filt" tempFilt="temp.${label}.filt"
tempGrib="temp.${label}.grib" tempGrib="temp.${label}.grib"
tempLog="temp.${label}.log" tempLog="temp.${label}.log"
@ -20,7 +20,7 @@ input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
latest=`${tools_dir}/grib_get -p tablesVersionLatest $input` latest=`${tools_dir}/grib_get -p tablesVersionLatest $input`
# Create a filter # Create a filter
cat > $tempFilter <<EOF cat > $tempFilt <<EOF
set tablesVersion = $latest; set tablesVersion = $latest;
set gridType = "healpix"; set gridType = "healpix";
set longitudeOfFirstGridPointInDegrees = 45; set longitudeOfFirstGridPointInDegrees = 45;
@ -28,9 +28,9 @@ cat > $tempFilter <<EOF
write; write;
EOF EOF
cat $tempFilter cat $tempFilt
# Use filter on input to create a new HEALPix GRIB # Use filter on input to create a new HEALPix GRIB
${tools_dir}/grib_filter -o $tempGrib $tempFilter $input ${tools_dir}/grib_filter -o $tempGrib $tempFilt $input
if [ ! -f "$tempGrib" ]; then if [ ! -f "$tempGrib" ]; then
echo 'Failed to create output GRIB from filter' >&2 echo 'Failed to create output GRIB from filter' >&2
exit 1 exit 1
@ -47,7 +47,7 @@ ${tools_dir}/grib_ls -jn geography $tempGrib
# Geoiterator # Geoiterator
# ------------- # -------------
rm -f $tempGrib rm -f $tempGrib
cat > $tempFilter <<EOF cat > $tempFilt <<EOF
set tablesVersion = $latest; set tablesVersion = $latest;
set gridType = "healpix"; set gridType = "healpix";
set longitudeOfFirstGridPointInDegrees = 45; set longitudeOfFirstGridPointInDegrees = 45;
@ -55,13 +55,13 @@ cat > $tempFilter <<EOF
set values = {1,2,3,4,5,6,7,8,9,10,11,12}; # count=12*N*N set values = {1,2,3,4,5,6,7,8,9,10,11,12}; # count=12*N*N
write; write;
EOF EOF
${tools_dir}/grib_filter -o $tempGrib $tempFilter $input ${tools_dir}/grib_filter -o $tempGrib $tempFilt $input
${tools_dir}/grib_get_data $tempGrib ${tools_dir}/grib_get_data $tempGrib
val=$(${tools_dir}/grib_get -l 0,0,1 $tempGrib | tr -d ' ') val=$(${tools_dir}/grib_get -l 0,0,1 $tempGrib | tr -d ' ')
[ "$val" = 5 ] [ "$val" = 5 ]
# Check other iterator-related keys # Check other iterator-related keys
cat > $tempFilter <<EOF cat > $tempFilt <<EOF
print "latLonValues=[latLonValues]"; print "latLonValues=[latLonValues]";
print "latitudes=[latitudes]"; print "latitudes=[latitudes]";
print "longitudes=[longitudes]"; print "longitudes=[longitudes]";
@ -69,7 +69,7 @@ cat > $tempFilter <<EOF
print "distinctLongitudes=[distinctLongitudes]"; print "distinctLongitudes=[distinctLongitudes]";
EOF EOF
${tools_dir}/grib_filter $tempFilter $tempGrib ${tools_dir}/grib_filter $tempFilt $tempGrib
# Invalid cases # Invalid cases
# -------------- # --------------
@ -89,4 +89,4 @@ grep -q "Only ring ordering is supported" $tempLog
# Clean up # Clean up
rm -f $tempFilter $tempGrib $tempLog rm -f $tempFilt $tempGrib $tempLog

View File

@ -11,14 +11,14 @@
# Define a common label for all the tmp files # Define a common label for all the tmp files
label="grib_lambert_conformal_test" label="grib_lambert_conformal_test"
tempFilter="temp.${label}.filt" tempFilt="temp.${label}.filt"
tempGrib="temp.${label}.grib" tempGrib="temp.${label}.grib"
tempOut="temp.${label}.out" tempOut="temp.${label}.out"
input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
# Create a filter # Create a filter
cat > $tempFilter <<EOF cat > $tempFilt <<EOF
set gridType="lambert"; set gridType="lambert";
set numberOfDataPoints=294000; set numberOfDataPoints=294000;
set shapeOfTheEarth=6; set shapeOfTheEarth=6;
@ -37,7 +37,7 @@ cat > $tempFilter <<EOF
EOF EOF
# Use filter on input to create a new Lambert conformal GRIB # Use filter on input to create a new Lambert conformal GRIB
${tools_dir}/grib_filter -o $tempGrib $tempFilter $input ${tools_dir}/grib_filter -o $tempGrib $tempFilt $input
if [ ! -f "$tempGrib" ]; then if [ ! -f "$tempGrib" ]; then
echo 'Failed to create output GRIB from filter' >&2 echo 'Failed to create output GRIB from filter' >&2
exit 1 exit 1
@ -49,7 +49,7 @@ ${tools_dir}/grib_ls -l 50,0 $tempGrib
# Oblate earth # Oblate earth
# -------------- # --------------
cat > $tempFilter <<EOF cat > $tempFilt <<EOF
set gridType="lambert"; set gridType="lambert";
set numberOfDataPoints=294000; set numberOfDataPoints=294000;
set Nx=588; set Nx=588;
@ -68,7 +68,7 @@ cat > $tempFilter <<EOF
EOF EOF
# Use this filter and the input GRIB to create a new GRIB # Use this filter and the input GRIB to create a new GRIB
${tools_dir}/grib_filter -o $tempGrib $tempFilter $input ${tools_dir}/grib_filter -o $tempGrib $tempFilt $input
if [ ! -f "$tempGrib" ]; then if [ ! -f "$tempGrib" ]; then
echo 'Failed to create output GRIB from filter' >&2 echo 'Failed to create output GRIB from filter' >&2
exit 1 exit 1
@ -83,4 +83,4 @@ ${tools_dir}/grib_ls -l 40.44,353.56 $tempGrib
# Clean up # Clean up
rm -f $tempFilter $tempGrib $tempOut rm -f $tempFilt $tempGrib $tempOut

View File

@ -12,7 +12,7 @@
# Define a common label for all the tmp files # Define a common label for all the tmp files
label="grib_mercator_test" label="grib_mercator_test"
tempOut="temp.${label}.out" tempOut="temp.${label}.out"
tempFilter="temp.${label}.filt" tempFilt="temp.${label}.filt"
input=${data_dir}/mercator.grib2 input=${data_dir}/mercator.grib2
grib_check_key_equals $input "gridType" "mercator" grib_check_key_equals $input "gridType" "mercator"
@ -22,17 +22,17 @@ numlines=`wc -l $tempOut | awk '{print $1}'`
# Check other iterator-related keys # Check other iterator-related keys
cat > $tempFilter <<EOF cat > $tempFilt <<EOF
print "[latLonValues]"; print "[latLonValues]";
print "[distinctLatitudes]"; print "[distinctLatitudes]";
print "[distinctLongitudes]"; print "[distinctLongitudes]";
EOF EOF
${tools_dir}/grib_filter $tempFilter $input ${tools_dir}/grib_filter $tempFilt $input
# Nearest function # Nearest function
${tools_dir}/grib_ls -l 19,-97,1 $input > $tempOut ${tools_dir}/grib_ls -l 19,-97,1 $input > $tempOut
grep -q "Point chosen #1 index=618" $tempOut grep -q "Point chosen #1 index=618" $tempOut
# Clean up # Clean up
rm -f $tempFilter $tempOut rm -f $tempFilt $tempOut

View File

@ -11,7 +11,7 @@
# Define a common label for all the tmp files # Define a common label for all the tmp files
label="grib_polar_stereographic_test" label="grib_polar_stereographic_test"
tempFilter="temp.${label}.filt" tempFilt="temp.${label}.filt"
tempGrib="temp.${label}.grib" tempGrib="temp.${label}.grib"
tempOut="temp.${label}.out" tempOut="temp.${label}.out"
@ -19,7 +19,7 @@ input=$ECCODES_SAMPLES_PATH/polar_stereographic_pl_grib2.tmpl
# Invoke Geoiterator # Invoke Geoiterator
${tools_dir}/grib_get_data $input > $tempOut ${tools_dir}/grib_get_data $input > $tempOut
# Nearest
${tools_dir}/grib_ls -l 60,0 $input ${tools_dir}/grib_ls -l 60,0 $input
# Scanning mode # Scanning mode
@ -27,4 +27,4 @@ ${tools_dir}/grib_get_data -s iScansNegatively=1 $input > $tempOut
# Clean up # Clean up
rm -f $tempFilter $tempGrib $tempOut rm -f $tempFilt $tempGrib $tempOut

View File

@ -11,7 +11,7 @@
# Define a common label for all the tmp files # Define a common label for all the tmp files
label="grib_space_view_test" label="grib_space_view_test"
tempFilter="temp.${label}.filt" tempFilt="temp.${label}.filt"
tempGrib1="temp.${label}.grib1" tempGrib1="temp.${label}.grib1"
tempGrib2="temp.${label}.grib2" tempGrib2="temp.${label}.grib2"
tempOut="temp.${label}.out" tempOut="temp.${label}.out"
@ -20,7 +20,7 @@ tempOut="temp.${label}.out"
# GRIB2 # GRIB2
# ----------- # -----------
input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
cat > $tempFilter <<EOF cat > $tempFilt <<EOF
set gridType="space_view"; set gridType="space_view";
set Nx=1900; set Nx=1900;
set Ny=900; set Ny=900;
@ -35,7 +35,7 @@ cat > $tempFilter <<EOF
EOF EOF
# Use filter on input to create a new GRIB # Use filter on input to create a new GRIB
${tools_dir}/grib_filter -o $tempGrib2 $tempFilter $input ${tools_dir}/grib_filter -o $tempGrib2 $tempFilt $input
if [ ! -f "$tempGrib2" ]; then if [ ! -f "$tempGrib2" ]; then
echo 'Failed to create output GRIB from filter' >&2 echo 'Failed to create output GRIB from filter' >&2
exit 1 exit 1
@ -66,7 +66,7 @@ rm -f $tempGrib2 $tempOut
# GRIB1 # GRIB1
# ----------- # -----------
input=$ECCODES_SAMPLES_PATH/GRIB1.tmpl input=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
cat > $tempFilter <<EOF cat > $tempFilt <<EOF
set gridType="space_view"; set gridType="space_view";
set Nx=550; set Nx=550;
set Ny=550; set Ny=550;
@ -77,7 +77,7 @@ cat > $tempFilter <<EOF
set Nr=6610710; set Nr=6610710;
write; write;
EOF EOF
${tools_dir}/grib_filter -o $tempGrib1 $tempFilter $input ${tools_dir}/grib_filter -o $tempGrib1 $tempFilt $input
${tools_dir}/grib_get_data $tempGrib1 > $tempOut ${tools_dir}/grib_get_data $tempGrib1 > $tempOut
${tools_dir}/grib_set -s edition=2 $tempGrib1 $tempGrib2 ${tools_dir}/grib_set -s edition=2 $tempGrib1 $tempGrib2
@ -85,4 +85,4 @@ ${tools_dir}/grib_compare -e -b param $tempGrib1 $tempGrib2
# Clean up # Clean up
rm -f $tempFilter $tempGrib1 $tempGrib2 $tempOut rm -f $tempFilt $tempGrib1 $tempGrib2 $tempOut

View File

@ -20,7 +20,7 @@ cd ${data_dir}
encoding=1 encoding=1
simple_no_bitmap=simple.grib simple_no_bitmap=simple.grib
simple_bitmap=simple_bitmap.grib simple_bitmap=simple_bitmap.grib
test_filter=temp.$label.filter tempFilt=temp.$label.filter
files_no_bitmap="gen_ext.grib \ files_no_bitmap="gen_ext.grib \
gen_ext_boust.grib \ gen_ext_boust.grib \
@ -41,11 +41,11 @@ simple_bitmap.grib"
no_packing="gen.grib|row.grib|gen_bitmap.grib|constant_width_bitmap.grib|constant_width_boust_bitmap.grib" no_packing="gen.grib|row.grib|gen_bitmap.grib|constant_width_bitmap.grib|constant_width_boust_bitmap.grib"
test_data() { test_data() {
${tools_dir}/grib_filter $test_filter $simple > $simple.data ${tools_dir}/grib_filter $tempFilt $simple > $simple.data
for f in $files for f in $files
do do
${tools_dir}/grib_filter $test_filter $f > $f.data ${tools_dir}/grib_filter $tempFilt $f > $f.data
diff $simple.data $f.data > /dev/null diff $simple.data $f.data > /dev/null
${tools_dir}/grib_compare -cvalues $f $simple ${tools_dir}/grib_compare -cvalues $f $simple
echo $f decoding test passed > $REDIRECT echo $f decoding test passed > $REDIRECT
@ -55,7 +55,7 @@ test_data() {
then then
rm -f $f.copied rm -f $f.copied
${tools_dir}/grib_copy -r $f $f.copied ${tools_dir}/grib_copy -r $f $f.copied
${tools_dir}/grib_filter $test_filter $f.copied > $f.copied.data ${tools_dir}/grib_filter $tempFilt $f.copied > $f.copied.data
diff $simple.data $f.copied.data > /dev/null diff $simple.data $f.copied.data > /dev/null
${tools_dir}/grib_compare -cvalues $f.copied $simple ${tools_dir}/grib_compare -cvalues $f.copied $simple
echo $f encoding test passed > $REDIRECT echo $f encoding test passed > $REDIRECT
@ -67,7 +67,7 @@ test_data() {
} }
cat > $test_filter<<EOF cat > $tempFilt<<EOF
print "[values!1]!"; print "[values!1]!";
EOF EOF
@ -132,21 +132,21 @@ done
# Two coded values: Should stay as grid_simple # Two coded values: Should stay as grid_simple
temp2=temp2.$label.grib temp2=temp2.$label.grib
temp3=temp3.$label.grib temp3=temp3.$label.grib
cat > $test_filter<<EOF cat > $tempFilt<<EOF
set values={ 2.1, 3.4 }; set values={ 2.1, 3.4 };
write; write;
EOF EOF
${tools_dir}/grib_filter -o $temp2 $test_filter $ECCODES_SAMPLES_PATH/GRIB2.tmpl ${tools_dir}/grib_filter -o $temp2 $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl
ECCODES_DEBUG=1 ${tools_dir}/grib_set -r -s packingType=grid_second_order $temp2 $temp3 2>$tempText ECCODES_DEBUG=1 ${tools_dir}/grib_set -r -s packingType=grid_second_order $temp2 $temp3 2>$tempText
grib_check_key_equals $temp3 packingType,accuracy 'grid_simple 24' grib_check_key_equals $temp3 packingType,accuracy 'grid_simple 24'
grep -q "Packing not changed" $tempText grep -q "Packing not changed" $tempText
# Three coded values: Now we can change to 2nd order # Three coded values: Now we can change to 2nd order
cat > $test_filter<<EOF cat > $tempFilt<<EOF
set values={ 2.1, 3.4, 8.9 }; set values={ 2.1, 3.4, 8.9 };
write; write;
EOF EOF
${tools_dir}/grib_filter -o $temp2 $test_filter $ECCODES_SAMPLES_PATH/GRIB2.tmpl ${tools_dir}/grib_filter -o $temp2 $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl
${tools_dir}/grib_set -r -s packingType=grid_second_order $temp2 $temp3 ${tools_dir}/grib_set -r -s packingType=grid_second_order $temp2 $temp3
grib_check_key_equals $temp3 packingType,accuracy 'grid_second_order 24' grib_check_key_equals $temp3 packingType,accuracy 'grid_second_order 24'
@ -211,4 +211,4 @@ grib_check_key_equals $temp1 packingType grid_second_order
# Clean up # Clean up
rm -f $temp_stat1 $temp_stat2 rm -f $temp_stat1 $temp_stat2
rm -f $temp1 $temp2 $temp3 $sec_ord_bmp rm -f $temp1 $temp2 $temp3 $sec_ord_bmp
rm -f $test_filter $tempText rm -f $tempFilt $tempText