Testing: Tools

This commit is contained in:
Shahram Najm 2024-01-13 20:58:44 +00:00
parent a0e6daca02
commit e712c6940a
6 changed files with 30 additions and 21 deletions

View File

@ -177,10 +177,11 @@ ${tools_dir}/bufr_set -s section2Present=1 $f $fBufrTmp
${tools_dir}/bufr_compare $f $fBufrTmp
# Compare with -2 option
set +e
${tools_dir}/bufr_compare -2 $f $fBufrTmp > $fLog 2>&1
${tools_dir}/bufr_compare -2 -v $f $fBufrTmp > $fLog 2>&1
status=$?
set -e
[ $status -eq 1 ]
grep Swapping $fLog
#----------------------------------------------------
# ECC-656: using relative comparison (-R) with 'all'

View File

@ -106,8 +106,12 @@ grep -q "dataDate = 19090206" $temp
# Skip handle
${tools_dir}/grib_dump -w count=4 $file > $temp 2>&1
ECCODES_DEBUG=1 ${tools_dir}/grib_dump $data_dir/sample.grib2
ECCODES_DEBUG=1 ${tools_dir}/grib_dump $data_dir/sample.grib2 > $temp 2>&1
# Error conditions
#-----------------------------------------------------------
${tools_dir}/grib_dump -p nonexist $file > $temp 2>&1
grep -q "Key/value not found" $temp
# Unreadable message
#-----------------------------------------------------------

View File

@ -23,6 +23,13 @@ ${tools_dir}/gts_dump -w count=1 $gts_file
${tools_dir}/gts_dump -w count=2 $gts_file
${tools_dir}/gts_dump -Dat $gts_file
${tools_dir}/gts_dump -OH $gts_file
${tools_dir}/gts_dump -d $gts_file
set +e
${tools_dir}/gts_dump -OD $gts_file
status=$?
set -e
[ $status -ne 0 ]
# Clean up
rm -f $fLog $fTmp

View File

@ -778,19 +778,17 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
if (options->mode != MODE_BUFR) {
/* TODO: Ignore missing values for keys in BUFR. Not yet implemented */
isMissing1 = ((grib_is_missing(handle1, name, &err1) == 1) && (err1 == 0)) ? 1 : 0;
isMissing2 = ((grib_is_missing(handle2, name, &err2) == 1) && (err2 == 0)) ? 1 : 0;
//isMissing1 = ((grib_is_missing(handle1, name, &err1) == 1) && (err1 == 0)) ? 1 : 0;
//isMissing2 = ((grib_is_missing(handle2, name, &err2) == 1) && (err2 == 0)) ? 1 : 0;
}
if ((isMissing1 == 1) && (isMissing2 == 1)) {
if (verbose)
printf(" is set to missing in both fields\n");
// if (verbose) printf(" is set to missing in both fields\n");
return GRIB_SUCCESS;
}
if (isMissing1 == 1) {
if (verbose)
printf(" is set to missing in %s field\n", first_str);
// if (verbose) printf(" is set to missing in %s field\n", first_str);
printInfo(handle1);
printf("%s is set to missing in %s field is not missing in %s field\n", name, first_str, second_str);
err1 = GRIB_VALUE_MISMATCH;
@ -799,8 +797,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
}
if (isMissing2 == 1) {
if (verbose)
printf(" is set to missing in %s field\n", first_str);
// if (verbose) printf(" is set to missing in %s field\n", first_str);
printInfo(handle1);
printf("%s is set to missing in %s field is not missing in %s field\n", name, second_str, first_str);
err1 = GRIB_VALUE_MISMATCH;
@ -1089,8 +1086,6 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
break;
case GRIB_TYPE_BYTES:
if (verbose)
printf(" as bytes\n");
if (options->mode == MODE_BUFR)
return 0;
break;

View File

@ -450,7 +450,8 @@ static int navigate(grib_field_tree* fields, grib_runtime_options* options)
message_type = CODES_BUFR;
break;
default:
Assert(0);
fprintf(stderr, "%s %s: Invalid mode", tool_name, __func__);
exit(1);
}
if (fields->field) {

View File

@ -72,14 +72,15 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
{
int err = 0;
if (!options->skip) {
if (options->set_values_count != 0)
err = grib_set_values(h, options->set_values, options->set_values_count);
Assert(options->set_values_count==0); // Cannot set keys in this tool
if (err != GRIB_SUCCESS && options->fail)
exit(err);
}
// int err = 0;
// if (!options->skip) {
// if (options->set_values_count != 0)
// err = grib_set_values(h, options->set_values, options->set_values_count);
// if (err != GRIB_SUCCESS && options->fail)
// exit(err);
// }
grib_tools_write_message(options, h);
return 0;