mirror of https://github.com/ecmwf/eccodes.git
Testing: Comparing thru indexes
This commit is contained in:
parent
4d57fc79fd
commit
fbce17e52b
|
@ -13,6 +13,7 @@
|
|||
label="grib_indexing_test"
|
||||
temp=temp.$label.index.out
|
||||
infile=${data_dir}/index.grib
|
||||
sample1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
|
||||
|
||||
# Writes to "out.gribidx"
|
||||
$EXEC ${test_dir}/grib_indexing ${infile} > $temp
|
||||
|
@ -109,9 +110,32 @@ ${tools_dir}/grib_index_build -N -o $tempIndex2 $tempGribFile2
|
|||
${tools_dir}/grib_compare -v $tempIndex1 $tempIndex2
|
||||
rm -f $tempIndex1 $tempIndex2 $tempGribFile1 $tempGribFile2
|
||||
|
||||
# Indexes containing different keys
|
||||
${tools_dir}/grib_index_build -k date,time -N -o $tempIndex1 $sample1
|
||||
${tools_dir}/grib_index_build -k level -N -o $tempIndex2 $sample1
|
||||
set +e
|
||||
${tools_dir}/grib_compare -v $tempIndex1 $tempIndex2 2>$tempOut
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
cat $tempOut
|
||||
grep -q "Indexes contained in the input files have different keys" $tempOut
|
||||
rm -f $tempIndex1 $tempIndex2 $tempOut
|
||||
|
||||
|
||||
${tools_dir}/grib_index_build -k date,time -N -o $tempIndex1 $sample1
|
||||
${tools_dir}/grib_index_build -k date,time,level -N -o $tempIndex2 $sample1
|
||||
set +e
|
||||
${tools_dir}/grib_compare -v $tempIndex2 $tempIndex1 2>$tempOut
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
cat $tempOut
|
||||
grep -q "Indexes contained in the input files have different keys" $tempOut
|
||||
rm -f $tempIndex1 $tempIndex2 $tempOut
|
||||
|
||||
# ECC-1516
|
||||
# ---------
|
||||
sample1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
|
||||
${tools_dir}/grib_index_build -N -o $tempIndex1 $sample1 > /dev/null
|
||||
${tools_dir}/grib_dump $tempIndex1 >/dev/null
|
||||
|
||||
|
|
|
@ -511,17 +511,17 @@ static int grib_tool_index(grib_runtime_options* options)
|
|||
k2 = k2->next;
|
||||
}
|
||||
if (!found) {
|
||||
printf("Indexes contained in the input files have different keys\n");
|
||||
printf("keys in file %s:\n", f1);
|
||||
fprintf(stderr, "Indexes contained in the input files have different keys!\n");
|
||||
fprintf(stderr, "keys in file %s:\n", f1);
|
||||
k1 = options->index1->keys;
|
||||
while (k1) {
|
||||
printf("\t%s\n", k1->name);
|
||||
fprintf(stderr, "\t%s\n", k1->name);
|
||||
k1 = k1->next;
|
||||
}
|
||||
printf("keys in file %s:\n", f2);
|
||||
fprintf(stderr, "keys in file %s:\n", f2);
|
||||
k2 = options->index2->keys;
|
||||
while (k2) {
|
||||
printf("\t%s\n", k2->name);
|
||||
fprintf(stderr, "\t%s\n", k2->name);
|
||||
k2 = k2->next;
|
||||
}
|
||||
exit(1);
|
||||
|
@ -543,17 +543,17 @@ static int grib_tool_index(grib_runtime_options* options)
|
|||
k1 = k1->next;
|
||||
}
|
||||
if (!found) {
|
||||
printf("Indexes contained in the input files have different keys\n");
|
||||
printf("keys in file %s:\n", f2);
|
||||
fprintf(stderr,"Indexes contained in the input files have different keys!\n");
|
||||
fprintf(stderr, "keys in file %s:\n", f2);
|
||||
k2 = options->index2->keys;
|
||||
while (k2) {
|
||||
printf("\t%s\n", k2->name);
|
||||
fprintf(stderr, "\t%s\n", k2->name);
|
||||
k2 = k2->next;
|
||||
}
|
||||
printf("keys in file %s:\n", f1);
|
||||
fprintf(stderr, "keys in file %s:\n", f1);
|
||||
k1 = options->index1->keys;
|
||||
while (k1) {
|
||||
printf("\t%s\n", k1->name);
|
||||
fprintf(stderr, "\t%s\n", k1->name);
|
||||
k1 = k1->next;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue