netcdf-c/nc_test/run_inmemory.sh
Dennis Heimbigner 4b936ee26a Fix use of 'int' to represent 'hid_t' that caused HDF5 1.10 to fail.
re: github issue https://github.com/Unidata/netcdf-fortran/issues/82

This was originally discovered in the Fortran tests, but is
a problem in the C library.

The problem only occurred when using HDF5-1.10.x.  The reason it
failed is that starting with 1.10, the hid_t type was changed
from 32 bits to 64 bits.
The function libsrc4/nc4memcb.c#NC4_image_init was using type int (doh!)
to return the hdf fileid instead of hid_t type.  This, of course,
caused the id to be truncated and in turn later use of the id
caused hdf5 to fail.

Fix is trivial: replace int with hid_t. This also requires a related
change in nc4mem.c.

Also added the test case derived from the original Fortran code.

You would think I would learn...
2018-05-30 14:47:37 -06:00

56 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
set -e
# Get the target OS and CPU
CPU=`uname -p`
OS=`uname`
#Constants
FILE3=tst_inmemory3
CREATE3=tst_inmemory3_create
FILE4=tst_inmemory4
CREATE4=tst_inmemory4_create
# For tst_open_mem
OMEMFILE=f03tst_open_mem.nc
echo ""
echo "*** Testing in-memory operations"
HASNC4=`${top_builddir}/nc-config --has-nc4`
# Execute the core of the inmemory tests
if ! ${execdir}/tst_inmemory; then
echo "FAIL: tst.inmemory"
fi
if ! ${execdir}/tst_open_mem ${srcdir}/${OMEMFILE}; then
echo "FAIL: tst_open_mem"
fi
echo "**** Test ncdump of the resulting inmemory data"
${NCDUMP} -n "${FILE3}" ${FILE3}.nc > ${FILE3}.cdl
${NCDUMP} -n "${FILE3}" ${CREATE3}.nc > ${CREATE3}.cdl
if ! diff -wb ${FILE3}.cdl ${CREATE3}.cdl ; then
echo "FAIL: ${FILE3}.cdl vs ${CREATE3}.cdl
fi
if test "x$HASNC4" = "xyes" ; then
${NCDUMP} ${FILE4}.nc > ${FILE4}.cdl
${NCDUMP} ${CREATE4}.nc > ${CREATE4}.cdl
if diff -wb ${FILE4}.cdl ${CREATE4}.cdl ; then
echo "FAIL: ${FILE4}.cdl vs ${CREATE4}.cdl
fi
# cleanup
rm -f ${FILE3}.nc ${FILE4}.nc ${CREATE3}.nc ${CREATE4}.nc
rm -f ${FILE3}.cdl ${FILE4}.cdl ${CREATE3}.cdl ${CREATE4}.cdl
echo "PASS: all inmemory tests"
exit 0