got make -j check working in ncdump and examples directories

This commit is contained in:
Ed Hartnett 2017-11-17 10:16:17 -07:00
parent 4a4a4fb7a0
commit 812c2fd4d1
10 changed files with 131 additions and 43 deletions

View File

@ -11,7 +11,7 @@ ENDFOREACH()
## Specify files to be distributed by 'make dist'
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am run_examples.sh run_examples4.sh)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")

View File

@ -3,33 +3,37 @@
# This file builds the C examples.
# $Id: Makefile.am,v 1.26 2010/05/29 00:17:41 dmh Exp $
# Ed Hartnett
LDADD = -lm
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_LDFLAGS =
# These are the netCDF-3 examples.
TESTPROGRAMS = simple_xy_wr simple_xy_rd sfc_pres_temp_wr \
check_PROGRAMS = simple_xy_wr simple_xy_rd sfc_pres_temp_wr \
sfc_pres_temp_rd pres_temp_4D_wr pres_temp_4D_rd
TESTS = run_examples.sh
# To build netcdf-4, or not to build netcdf-4, that is the question...
if USE_NETCDF4
# These are the extra netCDF-4 examples.
TESTPROGRAMS += simple_nc4_wr simple_nc4_rd simple_xy_nc4_wr \
check_PROGRAMS += simple_nc4_wr simple_nc4_rd simple_xy_nc4_wr \
simple_xy_nc4_rd
endif #USE_NETCDF4
if USE_PNETCDF
# These are the extra netCDF-4 examples.
TESTPROGRAMS += parallel_vara
check_PROGRAMS += parallel_vara
TESTS += parallel_vara
endif #USE_PNETCDF
AM_CPPFLAGS += -I$(top_builddir)/liblib
AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la
check_PROGRAMS = $(TESTPROGRAMS)
TESTS = $(TESTPROGRAMS)
if USE_NETCDF4
TESTS += run_examples4.sh
endif #USE_NETCDF4
# This will run a bunch of the test programs with valgrind, the memory
# checking tool. (Valgrind must be present for this to work.)
@ -43,7 +47,7 @@ endif # USE_VALGRIND_TESTS
endif # USE_NETCDF4
# These files are created by the tests.
CLEANFILES = sfc_pres_temp.nc simple_xy.nc pres_temp_4D.nc \
simple_nc4.nc simple_xy_nc4.nc testfile.nc
CLEANFILES = *.nc
EXTRA_DIST = run_valgrind_tests.sh run_nc4_valgrind_tests.sh CMakeLists.txt
EXTRA_DIST = run_valgrind_tests.sh run_nc4_valgrind_tests.sh \
CMakeLists.txt run_examples.sh run_examples4.sh

24
examples/C/run_examples.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
# This shell script runs the examples.
# Ed Hartnett
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../../test_common.sh
echo "*** Running examples."
set -e
echo "*** running simple_xy examples..."
${execdir}/simple_xy_wr
${execdir}/simple_xy_rd
echo "*** running sfc_pres_temp examples..."
${execdir}/sfc_pres_temp_wr
${execdir}/sfc_pres_temp_rd
echo "*** running pres_temp_4D examples..."
${execdir}/pres_temp_4D_wr
${execdir}/pres_temp_4D_rd
echo "*** Examples successful!"
exit 0

20
examples/C/run_examples4.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# This shell script runs the examples for netCDF4.
# Ed Hartnett
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../../test_common.sh
echo "*** Running examples for netCDF-4."
set -e
echo "*** running simple_nc4 examples..."
${execdir}/simple_nc4_wr
${execdir}/simple_nc4_rd
echo "*** running simple_xy_nc4 examples..."
${execdir}/simple_xy_nc4_wr
${execdir}/simple_xy_nc4_rd
echo "*** Examples successful!"
exit 0

View File

@ -1,20 +1,22 @@
## This is a automake file, part of Unidata's netCDF package.
# Copyright 2006, see the COPYRIGHT file for more information.
# This file builds CDL examples.
# Ed Hartnett
# $Id: Makefile.am,v 1.3 2009/05/19 11:56:50 ed Exp $
# Note which tests depend on other tests. Necessary for make -j check.
TEST_EXTENSIONS = .sh
# All we do is run two shell scripts, which create the sample files
# and then compare them with the C versions of the examples.
#if !BUILD_DLL
TESTS = create_sample_files.sh do_comps.sh
#endif
# Record dependencies between test scripts.
do_comps.log: create_sample_files.log
# Ship the scripts needed to create the sample files and compare them.
EXTRA_DIST = do_comps.sh create_sample_files.sh simple_xy.cdl \
sfc_pres_temp.cdl pres_temp_4D.cdl CMakeLists.txt
# Clean up files created during the process.
CLEANFILES = simple_xy.nc sfc_pres_temp.nc pres_temp_4D.nc
CLEANFILES = *.nc

View File

@ -15,8 +15,8 @@ include $(top_srcdir)/lib_flags.am
# that netCDF-4 needs.
H5TESTS = tst_h_files tst_h_files2 tst_h_files4 tst_h_atts \
tst_h_atts3 tst_h_atts4 tst_h_vars tst_h_vars2 tst_h_vars3 tst_h_grps \
tst_h_compounds tst_h_compounds2 tst_h_wrt_cmp tst_h_rd_cmp tst_h_vl \
tst_h_opaques tst_h_strings tst_h_strings1 tst_h_strings2 tst_h_ints \
tst_h_compounds tst_h_compounds2 tst_h_wrt_cmp tst_h_vl tst_h_opaques \
tst_h_strings tst_h_strings1 tst_h_strings2 tst_h_ints \
tst_h_dimscales tst_h_dimscales1 tst_h_dimscales2 tst_h_dimscales3 \
tst_h_enums tst_h_dimscales4 #tst_h_filters

View File

@ -2,7 +2,7 @@
Copyright 2007 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
Test HDF5 compound types.
n Test HDF5 compound types.
*/
#include "h5_err_macros.h"

View File

@ -42,37 +42,69 @@ main()
printf("\n*** Checking HDF5 compound types (even more so).\n");
printf("*** Checking packing of HDF5 compound types...");
{
/* Open file and create group. */
if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
access_plist)) < 0) ERR;
/* Open file and create group. */
if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
access_plist)) < 0) ERR;
/* Create a simple compound type. */
if ((typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) ERR;
if (H5Tinsert(typeid, "c1", HOFFSET(struct s1, c1), H5T_NATIVE_UCHAR) < 0) ERR;
if (H5Tinsert(typeid, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) ERR;
if (H5Tcommit(fileid, COMPOUND_NAME, typeid) < 0) ERR;
/* Create a simple compound type. */
if ((typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) ERR;
if (H5Tinsert(typeid, "c1", HOFFSET(struct s1, c1), H5T_NATIVE_UCHAR) < 0) ERR;
if (H5Tinsert(typeid, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) ERR;
if (H5Tcommit(fileid, COMPOUND_NAME, typeid) < 0) ERR;
/* Create a space. */
dims[0] = DIM1_LEN;
if ((spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR;
/* Create a space. */
dims[0] = DIM1_LEN;
if ((spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR;
/* Create a dataset of this compound type. */
if ((datasetid = H5Dcreate(fileid, VAR_NAME, typeid, spaceid,
H5P_DEFAULT)) < 0) ERR;
/* Create a dataset of this compound type. */
if ((datasetid = H5Dcreate(fileid, VAR_NAME, typeid, spaceid,
H5P_DEFAULT)) < 0) ERR;
/* Write some data. */
if (H5Dwrite(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data) < 0) ERR;
/* Write some data. */
if (H5Dwrite(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data) < 0) ERR;
/* Release all resources. */
if (H5Pclose(access_plist) < 0) ERR;
if (H5Tclose(typeid) < 0) ERR;
if (H5Sclose(spaceid) < 0) ERR;
if (H5Fclose(fileid) < 0) ERR;
}
SUMMARIZE_ERR;
printf("*** Checking packing of HDF5 compound types...");
{
/* Open file. */
if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, access_plist)) < 0) ERR;
/* Release all resources. */
if (H5Pclose(access_plist) < 0) ERR;
if (H5Tclose(typeid) < 0) ERR;
if (H5Sclose(spaceid) < 0) ERR;
if (H5Fclose(fileid) < 0) ERR;
/* Open dataset. */
if ((datasetid = H5Dopen1(fileid, VAR_NAME)) < 0) ERR;
/* Check space. */
if ((spaceid = H5Dget_space(datasetid)) < 0) ERR;
if (H5Sget_simple_extent_ndims(spaceid) != 1) ERR;
if (H5Sget_simple_extent_npoints(spaceid) != DIM1_LEN) ERR;
/* Get type. */
if ((typeid = H5Dget_type(datasetid)) < 0) ERR;
/* if ((native_type = H5Tget_native_type(typeid, H5T_DIR_DEFAULT)) < 0) ERR;*/
/* Read the data. */
if (H5Dread(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data) < 0) ERR;
/* Check the data. */
for (i=0; i<DIM1_LEN; i++)
if (data[i].c1 != 126 || data[i].d != -9999999) ERR;
/* Release all resources. */
if (H5Fclose(fileid) < 0) ERR;
}
SUMMARIZE_ERR;
FINAL_RESULTS;
}

View File

@ -52,6 +52,8 @@ ref_ctest64 tst_ctest.sh tst_output.sh tst_lengths.sh \
tst_calendars.sh run_utf8_tests.sh tst_nccopy3.sh \
tst_nccopy3_subset.sh tst_charfill.sh tst_iter.sh tst_formatx3.sh \
tst_bom.sh tst_dimsizes.sh run_ncgen_tests.sh
# Record dependencies between test scripts.
tst_nccopy3.log: tst_calendars.log tst_utf8.log run_utf8_tests.log \
tst_output.log tst_64bit.log run_tests.log
run_ncgen_tests.log: tst_output.log tst_nccopy3.log
@ -98,6 +100,7 @@ tst_nccopy4.log: tst_netcdf4.log tst_fillbug.log tst_netcdf4_4.log \
tst_h_scalar.log tst_ctest.log
run_ncgen_nc4_tests.log: run_ncgen_tests.log tst_output.log \
tst_nccopy3.log
run_utf8_nc4_tests.log: run_utf8_tests.log
endif #!USE_NETCDF4

View File

@ -27,6 +27,9 @@ TESTPROGRAMS = nctest tst_rename
check_PROGRAMS = $(TESTPROGRAMS)
TESTS = $(TESTPROGRAMS) compare_test_files.sh
# Note which tests depend on other tests. Necessary for make -j check.
TEST_EXTENSIONS = .sh
# compare_test_files depends on nctest executing first.
compare_test_files.log: nctest.log