mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
3db4f013bf
Specific changes: 1. Add dap4 code: libdap4 and dap4_test. Note that until the d4ts server problem is solved, dap4 is turned off. 2. Modify various files to support dap4 flags: configure.ac, Makefile.am, CMakeLists.txt, etc. 3. Add nc_test/test_common.sh. This centralizes the handling of the locations of various things in the build tree: e.g. where is ncgen.exe located. See nc_test/test_common.sh for details. 4. Modify .sh files to use test_common.sh 5. Obsolete separate oc2 by moving it to be part of netcdf-c. This means replacing code with netcdf-c equivalents. 5. Add --with-testserver to configure.ac to allow override of the servers to be used for --enable-dap-remote-tests. 6. There were multiple versions of nctypealignment code. Try to centralize in libdispatch/doffset.c and include/ncoffsets.h 7. Add a unit test for the ncuri code because of its complexity. 8. Move the findserver code out of libdispatch and into a separate, self contained program in ncdap_test and dap4_test. 9. Move the dispatch header files (nc{3,4}dispatch.h) to .../include because they are now shared by modules. 10. Revamp the handling of TOPSRCDIR and TOPBUILDDIR for shell scripts. 11. Make use of MREMAP if available 12. Misc. minor changes e.g. - #include <config.h> -> #include "config.h" - Add some no-install headers to /include - extern -> EXTERNL and vice versa as needed - misc header cleanup - clean up checking for misc. unix vs microsoft functions 13. Change copyright decls in some files to point to LICENSE file. 14. Add notes to RELEASENOTES.md
184 lines
5.4 KiB
Bash
Executable File
184 lines
5.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
|
. ../test_common.sh
|
|
|
|
# It is unreasonable to test actual lengths of files
|
|
# (even netcdf-3 files).
|
|
#However, the files created in this script are used in later ones
|
|
|
|
${NCGEN} -b ${srcdir}/small.cdl
|
|
${NCGEN} -b ${srcdir}/small2.cdl
|
|
|
|
# This shell script tests lengths of small netcdf files and tests
|
|
# that rewriting a numeric value doesn't change file length
|
|
# $Id: tst_lengths.sh,v 1.10 2008/08/07 00:07:52 ed Exp $
|
|
|
|
# cat > rewrite-scalar.c << EOF
|
|
# #include <stdio.h>
|
|
# #include <netcdf.h>
|
|
# #define ERR do {fflush(stdout); fprintf(stderr, "Error, %s, line: %d\n", __FILE__, __LINE__); return(1);} while (0)
|
|
|
|
# int
|
|
# main(int ac, char *av[]) {
|
|
# int ncid, varid, data[] = {42};
|
|
# if (nc_open(av[1], NC_WRITE, &ncid)) ERR;
|
|
# if (nc_inq_varid(ncid, av[2], &varid)) ERR;
|
|
# if (nc_put_var_int(ncid, varid, data)) ERR;
|
|
# if (nc_close(ncid)) ERR;
|
|
# return 0;
|
|
# }
|
|
# EOF
|
|
# cat > test-len.sh << 'EOF'
|
|
# # test that length of file $1 is $2
|
|
# len=`ls -l $1|awk '{print $5}'`
|
|
# if [ $len = $2 ]; then
|
|
# exit 0
|
|
# else
|
|
# echo "### Failure: file $1 has length $len instead of expected $2"
|
|
# exit 1
|
|
# fi
|
|
# EOF
|
|
# chmod +x ./test-len.sh
|
|
# cc -g -o rewrite-scalar -I../libsrc rewrite-scalar.c -L../libsrc -lnetcdf
|
|
# echo "netcdf small {variables: byte t; data: t = 1;}" > small.cdl
|
|
set -e
|
|
|
|
echo ""
|
|
echo "*** testing length of classic file"
|
|
${NCGEN} -b ${srcdir}/small.cdl
|
|
if test `wc -c < small.nc` != 68; then
|
|
exit 1
|
|
fi
|
|
|
|
#echo "*** testing length of classic file written with NOFILL"
|
|
#${NCGEN} -b -x ${srcdir}/small.cdl
|
|
#if test `wc -c < small.nc` != 68; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of rewritten classic file"
|
|
${NCGEN} -b ${srcdir}/small.cdl && ${execdir}/rewrite-scalar small.nc t
|
|
#if test `wc -c < small.nc` != 68; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of rewritten classic file written with NOFILL"
|
|
${NCGEN} -b -x ${srcdir}/small.cdl && ${execdir}/rewrite-scalar small.nc t
|
|
#if test `wc -c < small.nc` != 68; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of 64-bit offset file"
|
|
${NCGEN} -b -k64-bit-offset ${srcdir}/small.cdl
|
|
#if test `wc -c < small.nc` != 72; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of 64-bit offset file written with NOFILL"
|
|
${NCGEN} -b -k64-bit-offset -x ${srcdir}/small.cdl
|
|
#if test `wc -c < small.nc` != 72; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of rewritten 64-bit offset file"
|
|
${NCGEN} -b -k64-bit-offset ${srcdir}/small.cdl && ${execdir}/rewrite-scalar small.nc t
|
|
#if test `wc -c < small.nc` != 72; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of rewritten 64-bit offset file written with NOFILL"
|
|
${NCGEN} -b -k64-bit-offset -x ${srcdir}/small.cdl && ${execdir}/rewrite-scalar small.nc t
|
|
#if test `wc -c < small.nc` != 72; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of 64-bit data file"
|
|
${NCGEN} -b -k64-bit-data ${srcdir}/small.cdl
|
|
if test `wc -c < small.nc` != 104; then
|
|
exit 1
|
|
fi
|
|
|
|
echo "*** testing length of 64-bit data file"
|
|
${NCGEN} -b -5 ${srcdir}/small.cdl
|
|
if test `wc -c < small.nc` != 104; then
|
|
exit 1
|
|
fi
|
|
echo "*** testing length of 64-bit data file written with NOFILL"
|
|
${NCGEN} -b -5 -x ${srcdir}/small.cdl
|
|
#if test `wc -c < small.nc` != 104; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of rewritten 64-bit data file"
|
|
${NCGEN} -b -5 ${srcdir}/small.cdl && ${execdir}/rewrite-scalar small.nc t
|
|
# Watch out, it appears that the CDF-5 files are being rounded up to next page size
|
|
# So, we need to truncate them wrt nul's in order to check size.
|
|
# Bad hack, but what else can I do?
|
|
if test `${execdir}/nctrunc <small.nc |wc -c` != 104; then
|
|
exit 1
|
|
fi
|
|
|
|
echo "*** testing length of rewritten 64-bit data file written with NOFILL"
|
|
${NCGEN} -b -5 -x ${srcdir}/small.cdl && ${execdir}/rewrite-scalar small.nc t
|
|
#if test `wc -c < small.nc` != 104; then
|
|
# exit 1
|
|
#fi
|
|
|
|
|
|
# test with only one record variable of type byte or short, which need
|
|
# not be 4-byte aligned
|
|
echo "*** testing length of one-record-variable classic file"
|
|
${NCGEN} -b ${srcdir}/small2.cdl
|
|
#if test `wc -c < small2.nc` != 101; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of one-record-variable 64-bit data file"
|
|
${NCGEN} -b -5 ${srcdir}/small2.cdl
|
|
if test `wc -c < small2.nc` != 161; then
|
|
exit 1
|
|
fi
|
|
|
|
echo "*** testing length of one-record-variable 64-bit data file"
|
|
${NCGEN} -b -5 ${srcdir}/small2.cdl
|
|
if test `wc -c < small2.nc` != 161; then
|
|
exit 1
|
|
fi
|
|
|
|
echo "*** testing length of one-record-variable 64-bit data file written with NOFILL"
|
|
${NCGEN} -b -5 -x ${srcdir}/small2.cdl
|
|
if test `wc -c < small2.nc` != 161; then
|
|
exit 1
|
|
fi
|
|
|
|
echo "*** testing length of one-record-variable classic file written with NOFILL"
|
|
${NCGEN} -b -x ${srcdir}/small2.cdl
|
|
if test `wc -c < small2.nc` != 101; then
|
|
exit 1
|
|
fi
|
|
|
|
echo "*** testing length of one-record-variable classic file written with NOFILL"
|
|
${NCGEN} -b -x ${srcdir}/small2.cdl
|
|
if test `wc -c < small2.nc` != 101; then
|
|
exit 1
|
|
fi
|
|
|
|
echo "*** testing length of one-record-variable classic file written with NOFILL"
|
|
${NCGEN} -b -x ${srcdir}/small2.cdl
|
|
#if test `wc -c < small2.nc` != 101; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of one-record-variable 64-bit offset file"
|
|
${NCGEN} -b -k64-bit-offset ${srcdir}/small2.cdl
|
|
#if test `wc -c < small2.nc` != 105; then
|
|
# exit 1
|
|
#fi
|
|
|
|
echo "*** testing length of one-record-variable 64-bit offset file written with NOFILL"
|
|
${NCGEN} -b -k64-bit-offset -x ${srcdir}/small2.cdl
|
|
#if test `wc -c < small2.nc` != 105; then
|
|
# exit 1
|
|
#fi
|