diff --git a/definitions/check_grib_defs.pl b/definitions/check_grib_defs.pl index dba8c0e27..d011680f3 100755 --- a/definitions/check_grib_defs.pl +++ b/definitions/check_grib_defs.pl @@ -204,6 +204,7 @@ sub process { } elsif ($this =~ /'(.*)' *= *{/) { $concept = $1; + die "File: $filename, line: $lineNum: Value is empty." if ($concept eq ''); die "File: $filename, line: $lineNum: Value contains invalid characters." if (non_printable($concept)); if ($filename eq 'cfVarName.def') { #if ($concept =~ /^[0-9]/) { diff --git a/tests/grib_check_param_concepts.cc b/tests/grib_check_param_concepts.cc index 077d61e14..d6720c4c3 100644 --- a/tests/grib_check_param_concepts.cc +++ b/tests/grib_check_param_concepts.cc @@ -59,6 +59,7 @@ static int scale_factor_missing(const char* value) static int grib_check_param_concepts(const char* key, const char* filename) { int isLocal = 0; + int count = 0; grib_concept_value* concept_value = grib_parse_concept_file(NULL, filename); if (!concept_value) return GRIB_IO_PROBLEM; @@ -67,6 +68,11 @@ static int grib_check_param_concepts(const char* key, const char* filename) isLocal = 1; } while (concept_value) { + count++; + if (strlen(concept_value->name) == 0) { + fprintf(stderr, "%s %s: Empty concept value (count=%d)\n", key, concept_value->name, count); + Assert(0); + } grib_concept_condition* concept_condition = concept_value->conditions; /* Convention: * -1 key not present diff --git a/tests/grib_check_param_concepts.sh b/tests/grib_check_param_concepts.sh index bf67e7ab8..004ca49b8 100755 --- a/tests/grib_check_param_concepts.sh +++ b/tests/grib_check_param_concepts.sh @@ -36,6 +36,12 @@ for a_dataset in $datasets; do $EXEC ${test_dir}/grib_check_param_concepts shortName $ECCODES_DEFINITION_PATH/grib2/localConcepts/$a_dataset/shortName.def done +# Check WMO name.def etc +$EXEC ${test_dir}/grib_check_param_concepts name $ECCODES_DEFINITION_PATH/grib2/name.def +$EXEC ${test_dir}/grib_check_param_concepts units $ECCODES_DEFINITION_PATH/grib2/units.def +$EXEC ${test_dir}/grib_check_param_concepts units $ECCODES_DEFINITION_PATH/grib2/cfVarName.def + + # Check the group: name.def paramId.def shortName.def units.def cfVarName.def # ---------------------------------------------------------------------------- # Check whether the Test::More Perl module is available @@ -56,11 +62,8 @@ defs_dirs=" $ECCODES_DEFINITION_PATH/grib1/localConcepts/ecmf $ECCODES_DEFINITION_PATH/grib2/localConcepts/ecmf - $ECCODES_DEFINITION_PATH/grib1/localConcepts/ammc - $ECCODES_DEFINITION_PATH/grib1/localConcepts/eidb $ECCODES_DEFINITION_PATH/grib1/localConcepts/ekmi $ECCODES_DEFINITION_PATH/grib1/localConcepts/enmi - $ECCODES_DEFINITION_PATH/grib1/localConcepts/eswi $ECCODES_DEFINITION_PATH/grib1/localConcepts/lfpw $ECCODES_DEFINITION_PATH/grib1/localConcepts/lowm $ECCODES_DEFINITION_PATH/grib1/localConcepts/rjtd