Testing: codes_parser

This commit is contained in:
Shahram Najm 2023-07-15 20:34:22 +01:00
parent 209a990bf4
commit f4e724a95b
2 changed files with 13 additions and 1 deletions

View File

@ -8,10 +8,11 @@
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.ctest.sh
label="definitions_test"
REDIRECT=/dev/null
tempOut=temp.$label.txt
[ -z "$ECCODES_DEFINITION_PATH" ] || ECCODES_DEFINITION_PATH=`${tools_dir}/codes_info -d`
@ -19,3 +20,13 @@ for file in `find ${ECCODES_DEFINITION_PATH}/ -name '*.def' -print | grep -v gri
do
${tools_dir}/codes_parser $file > $REDIRECT
done
# Try an invalid input
set +e
echo 'transient xx=1' | ${tools_dir}/codes_parser - 2>$tempOut
status=$?
set -e
[ $status -ne 0 ]
grep -q "Parser: syntax error" $tempOut
rm -f $tempOut

View File

@ -21,6 +21,7 @@ int main(int argc, char* argv[])
for (i = 1; i < argc; i++) {
printf("%s ... ", argv[i]);
fflush(stdout);
// argv can be "-" to indicate stdin
if (!(a = grib_parse_file(c, argv[i]))) {
fail++;
printf("FAILED\n");