netcdf-c/nc_test4/run_grp_rename.sh
Dennis Heimbigner 3db4f013bf Primary change: add dap4 support
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
2017-03-08 17:01:10 -07:00

120 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
# This shell just tests the group renaming.
set -e
echo ""
# Create the input cdl file
rm -f tst_grp_rename.cdl
cat >tst_grp_rename.cdl <<EOF
netcdf tst_grp_rename {
types:
int(*) vlen_t;
dimensions:
d2 = 2;
variables:
vlen_t v1(d2);
group: inner {
types:
compound c_t { int f1; float f2; };
dimensions:
d3 = 3;
variables:
c_t vc(d3);
group: inner_inner {
dimensions:
d3 = 4;
}
}
}
EOF
# Create the reference cdl file
rm -f ref_grp_rename.cdl
cat >ref_grp_rename.cdl <<EOF
netcdf tst_grp_rename {
types:
int(*) vlen_t ;
dimensions:
d2 = 2 ;
variables:
vlen_t v1(d2) ;
data:
v1 = {}, {} ;
group: renamed {
types:
compound c_t {
int f1 ;
float f2 ;
}; // c_t
dimensions:
d3 = 3 ;
variables:
c_t vc(d3) ;
data:
vc = {0, 0}, {0, 0}, {0, 0} ;
group: inner_renamed {
dimensions:
d3 = 4 ;
} // group inner_renamed
} // group renamed
}
EOF
echo "*** Running group_rename test"
FAIL=0
# Create ref_tst_group_rename.nc
rm -f tst_grp_rename.nc
${NCGEN} -k nc4 ./tst_grp_rename.cdl
# Try to rename 2nd level group
if ! ${execdir}/renamegroup tst_grp_rename.nc "inner/inner_inner" "inner_renamed" ; then
echo "***FAIL: attempt to rename /inner/inner_inner failed"
FAIL=1
fi
# Try to 1st level group
if ! ${execdir}/renamegroup tst_grp_rename.nc "inner" "renamed" ; then
echo "***FAIL: attempt to rename /inner failed"
FAIL=1
fi
# Dump the final .nc and compare with the reference
rm -f tst_grp_rename.dmp
${NCDUMP} tst_grp_rename.nc > ./tst_grp_rename.dmp
if ! diff -b ref_grp_rename.cdl tst_grp_rename.dmp ; then
echo "***FAIL: output and reference output differ"
FAIL=1
fi
# Finally, try to rename root group; should fail
if ${execdir}/renamegroup tst_grp_rename.nc "/" "rootgroup" ; then
echo "***FAIL: attempt to rename root group should not have succeeded"
FAIL=1
else
echo "***XFAIL : attempt to rename root group failed as expected"
fi
#rm -f tst_grp_rename.cdl tst_grp_rename.nc ref_grp_rename.nc
exit $FAIL