netcdf-c/ncgen3/run_tests.sh
Dennis Heimbigner 8b0e1134b4 Ensure that netcdf_json.h does not interfere with ncjson.
re: Issue https://github.com/Unidata/netcdf-c/issues/2419

There are effectively two json subsystems in netcdf-c.
1. ncjson.[ch] in libnetcdf
2. netcdf_json.h for use by plugins so they can be built without need
   for libnetcdf.

The netcdf_json.h file is constructed from the concatenation of
ncjson.h plus ncjson.c. It turned out that in doing this, I was
leaving some symbols externally visible so that if, for some
reason, a plugin was built and needed libnetcdf, then symbol
conflicts arose.

The solution is to prefix the declarations in ncjson.[ch] with a
macro (OPTSTATIC) that can be resolved to either nothing or to
"static". Then in netcdf_json.h, it resolves to "static" and
prevents the symbol conflicts.

Note that netcdf_json.h is constructed once in
netcdf-c/include/Makefile.am with the rule named
"makepluginjson". This means that it is included in the
distribution. However, this also means that if ncjson.[ch] is
changed, then it is necessary to invoke makepluginjson
explicitly to rebuild netcdf_json.h
2022-07-05 22:03:52 -06:00

23 lines
503 B
Bash
Executable File

#!/bin/sh
# This shell script runs the ncgen3 tests.
# $Id: run_tests.sh,v 1.9 2009/09/24 18:19:11 dmh Exp $
echo "*** Testing ncgen3."
set -e
if test "x$srcdir" = x ;then srcdir=`pwd`; fi
. ../test_common.sh
echo "*** creating classic file c0.nc from c0.cdl..."
if ${NCGEN3} -b -o c0.nc ${ncgen3c0} ; then
echo "***PASS"
else
echo "***fail"
fi
echo "*** creating 64-bit offset file c0_64.nc from c0.cdl..."
#${NCGEN3} -k 64-bit-offset -b -o c0_64.nc ${ncgen3c0}
echo "*** Test successful!"
exit 0