Testing: Increase coverage: JPEG decoding

This commit is contained in:
Shahram Najm 2023-12-26 17:54:09 +00:00
parent e078c6af64
commit 5cbc79fd36
3 changed files with 16 additions and 8 deletions

View File

@ -273,19 +273,17 @@ cleanup:
return code;
}
#else
#else // HAVE_LIBJASPER
int grib_jasper_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* val, const size_t* n_vals)
{
grib_context_log(c, GRIB_LOG_ERROR,
"grib_accessor_data_jpeg2000_packing: JasPer JPEG support not enabled.");
grib_context_log(c, GRIB_LOG_ERROR, "grib_jasper_decode: JasPer JPEG support not enabled.");
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper)
{
grib_context_log(c, GRIB_LOG_ERROR,
"grib_accessor_data_jpeg2000_packing: JasPer JPEG support not enabled.");
grib_context_log(c, GRIB_LOG_ERROR, "grib_jasper_encode: JasPer JPEG support not enabled.");
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}

View File

@ -546,13 +546,13 @@ cleanup:
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* val, const size_t* n_vals)
{
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_encoding.c: OpenJPEG JPEG support not enabled.");
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_decode: OpenJPEG JPEG support not enabled.");
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_openjpeg_encode(grib_context* c, j2k_encode_helper* helper)
{
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_encoding.c: OpenJPEG JPEG support not enabled.");
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_encode: OpenJPEG JPEG support not enabled.");
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}

View File

@ -156,5 +156,15 @@ ECCODES_GRIB_DUMP_JPG_FILE=$tempDump ${tools_dir}/grib_copy -r $data_dir/jpeg.g
[ -f $tempDump ]
rm -f $tempDump
# Check Jasper decoding when it is disabled
if [ $HAVE_LIBJASPER -eq 0 ]; then
set +e
ECCODES_GRIB_JPEG=jasper ${tools_dir}/grib_get -n statistics $data_dir/jpeg.grib2 > $tempDump 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "JasPer JPEG support not enabled" $tempDump
fi
# Clean up
rm -f $tempFilt $tempGrib
rm -f $tempFilt $tempGrib $tempDump