Wired tests for https://github.com/Unidata/netcdf-c/issues/221 into a shell script so that the generated files can be checked easily with ncdump. Added the test and associated files to both cmake and autotools build systems.

This commit is contained in:
Ward Fisher 2016-02-19 10:16:42 -07:00
parent db84f39adc
commit 1affd12fc8
3 changed files with 47 additions and 6 deletions

View File

@ -9,19 +9,26 @@ SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars
t_type cdm_sea_soundings tst_vl tst_atts1 tst_atts2
tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs
tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite
tst_put_vars_two_unlim_dim tst_empty_vlen_unlim)
tst_put_vars_two_unlim_dim)
# Note, renamegroup needs to be compiled before run_grp_rename
build_bin_test(renamegroup)
add_sh_test(nc_test4 run_grp_rename)
##
# The shell script, run_empty_vlen_test.sh,
# depends on the 'tst_empty_vlen_unlim' binary.
##
BUILD_BIN_TEST(tst_empty_vlen_unlim)
ADD_SH_TEST(nc_test4 run_empty_vlen_test)
IF(NOT MSVC)
SET(NC4_TESTS ${NC4_TESTS} tst_interops5 tst_camrun)
ENDIF()
# If the v2 API was built, add the test program.
IF(ENABLE_V2_API)
build_bin_test(tst_v2)
ENDIF()

View File

@ -24,7 +24,7 @@ tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs \
tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite \
tst_empty_vlen_unlim
check_PROGRAMS = $(NC4_TESTS) renamegroup
check_PROGRAMS = $(NC4_TESTS) renamegroup tst_empty_vlen_unlim
# Add these if large file tests are turned on.
if LARGE_FILE_TESTS
@ -33,7 +33,7 @@ endif
TESTS = $(NC4_TESTS)
TESTS += run_grp_rename.sh
TESTS += run_grp_rename.sh run_empty_vlen_test
# If the v2 API was built, add its test program.
if BUILD_V2
@ -124,7 +124,7 @@ ref_tst_interops4.nc run_get_knmi_files.sh CMakeLists.txt \
run_grp_rename.sh tst_formatx_hdf4.sh \
run_chunk_hdf4.sh contiguous.hdf4 chunked.hdf4 \
tst_h5_endians.c tst_h4_lendian.c tst_atts_string_rewrite.c \
tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c
tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c run_empty_vlen_test.sh
CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt \
@ -135,7 +135,7 @@ tst_elena_*.cdl tst_simple*.cdl tst_chunks.cdl pr_A1.* tauu_A1.* \
usi_01.* thetau_01.* tst_*.nc tst_*.h5 \
tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \
foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc
tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc tst_empty_vlen_lim.nc
if USE_HDF4_FILE_TESTS
DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \

34
nc_test4/run_empty_vlen_test.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
#
# Front-end for tst_empty_vlen_unlim.c. This test
# ensures that valid netcdf files are generated when
# a ragged VLEN array is defined but not populated.
#
# This script runs tst_empty_vlen_unlim and then
# runs `ncdump` against the two generated files.
#
# See https://github.com/Unidata/netcdf-c/issues/221 for
# full details.
#
set -e
if test "x$srcdir" = x ; then
srcdir=`pwd`
fi
echo ""
echo "* Testing Empty Ragged Arrays (VLEN)"
echo "Generating test netcdf files."
./tst_empty_vlen_unlim
echo "Validating Files with ncdump."
echo "======================================"
../ncdump/ncdump -s tst_empty_vlen_unlim.nc
echo "---------------------------------------"
../ncdump/ncdump -s tst_empty_vlen_lim.nc
echo "======================================"
echo "* Tests Passed."
exit 0