Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions nc_test4/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ include $(top_srcdir)/lib_flags.am

# Un comment to use a more verbose test driver
#SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added duplicate line?

#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#TESTS_ENVIRONMENT = export SETX=1;

TEST_EXTENSIONS = .sh

Expand Down
2 changes: 0 additions & 2 deletions nc_test4/ref_bzip2.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ main() {/* create bzip2.nc */
/* enter define mode */
stat = nc_create("bzip2.nc", NC_CLOBBER|NC_NETCDF4, &ncid);
check_err(stat,__LINE__,__FILE__);
stat = nc_put_att_text(ncid, NC_GLOBAL, "_Format", 1, "netCDF-4");
check_err(stat,__LINE__,__FILE__);
bzip2_grp = ncid;

/* define dimensions */
Expand Down
5 changes: 4 additions & 1 deletion ncdump/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ ENDIF(MSVC)
ENDIF(USE_NETCDF4)

add_sh_test(ncdump test_radix)

add_sh_test(ncdump tst_ctests)

ENDIF()

ENDIF()
Expand Down Expand Up @@ -296,7 +299,7 @@ SET(MAN_FILES nccopy.1 ncdump.1)
# Note, the L512.bin file is file containing exactly 512 bytes each of value 0.
# It is used for creating hdf5 files with varying offsets for testing.

FILE(GLOB COPY_FILES ${CMAKE_BINARY_DIR}/ncgen/*.nc ${CMAKE_BINARY_DIR}/nc_test4/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.ncml ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.1 ${CMAKE_CURRENT_SOURCE_DIR}/L512.bin)
FILE(GLOB COPY_FILES ${CMAKE_BINARY_DIR}/ncgen/*.nc ${CMAKE_BINARY_DIR}/nc_test4/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.ncml ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.1 ${CMAKE_CURRENT_SOURCE_DIR}/L512.bin ${CMAKE_CURRENT_SOURCE_DIR}/ref_ctest*.c)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)

ADD_SUBDIRECTORY(cdl)
Expand Down
11 changes: 10 additions & 1 deletion ncdump/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ if USE_HDF5
TESTS += tst_inmemory_nc4.sh tst_nccopy_w4.sh
endif

if USE_HDF5
# Re-activate the ncgen -lc tests
TESTS += tst_ctests.sh
endif

endif BUILD_TESTSETS

# These files all have to be included with the distribution.
Expand Down Expand Up @@ -150,6 +155,9 @@ ref_nccopy_w.cdl tst_nccopy_w3.sh tst_nccopy_w4.sh ref_no_ncproperty.nc
# It is used for creating hdf5 files with varying offsets for testing.
EXTRA_DIST += L512.bin

EXTRA_DIST += tst_ctests.sh ref_ctest_small_3.c ref_ctest_small_4.c \
ref_ctest_special_atts_4.c

# CDL files and Expected results
SUBDIRS = cdl expected

Expand All @@ -175,4 +183,5 @@ tst_c0.cdl tst_c0_4.cdl tst_c0_4c.cdl tst_c0_64.cdl \
tst_compound_datasize_test.cdl tst_compound_datasize_test2.cdl \
tst_ncf199.cdl tst_tst_gattenum.cdl tst_tst_usuffix.cdl ctest.c \
ctest64.c nccopy3_subset_out.nc camrun.c tst_ncf213.cdl tst_ncf213.nc \
tst_radix.nc tmp_radix.cdl
tst_radix.nc tmp_radix.cdl ctest_small_3.c ctest_small_4.c \
ctest_special_atts_4.c
235 changes: 0 additions & 235 deletions ncdump/ctests.sh

This file was deleted.

81 changes: 81 additions & 0 deletions ncdump/ref_ctest_small_3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>


void
check_err(const int stat, const int line, const char *file) {
if (stat != NC_NOERR) {
(void)fprintf(stderr,"line %d of %s: %s\n", line, file, nc_strerror(stat));
fflush(stderr);
exit(1);
}
}

int
main() {/* create ref_tst_small.nc */

int stat; /* return status */
int ncid; /* netCDF id */

/* dimension ids */
int Time_dim;
int DateStrLen_dim;

/* dimension lengths */
size_t Time_len = NC_UNLIMITED;
size_t DateStrLen_len = 19;

/* variable ids */
int Times_id;

/* rank (number of dimensions) for each variable */
# define RANK_Times 2

/* variable shapes */
int Times_dims[RANK_Times];

/* enter define mode */
stat = nc_create("ref_tst_small.nc", NC_CLOBBER, &ncid);
check_err(stat,__LINE__,__FILE__);

/* define dimensions */
stat = nc_def_dim(ncid, "Time", Time_len, &Time_dim);
check_err(stat,__LINE__,__FILE__);
stat = nc_def_dim(ncid, "DateStrLen", DateStrLen_len, &DateStrLen_dim);
check_err(stat,__LINE__,__FILE__);

/* define variables */

Times_dims[0] = Time_dim;
Times_dims[1] = DateStrLen_dim;
stat = nc_def_var(ncid, "Times", NC_CHAR, RANK_Times, Times_dims, &Times_id);
check_err(stat,__LINE__,__FILE__);

/* assign global attributes */

{
stat = nc_put_att_text(ncid, NC_GLOBAL, "TITLE", 31, " OUTPUT FROM WRF V2.0.3.1 MODEL");
check_err(stat,__LINE__,__FILE__);
}


/* leave define mode */
stat = nc_enddef (ncid);
check_err(stat,__LINE__,__FILE__);

/* assign variable data */

{
char* Times_data = "2005-04-11_12:00:002005-04-11_13:00:00" ;
size_t Times_startset[2] = {0, 0} ;
size_t Times_countset[2] = {2, 19};
stat = nc_put_vara(ncid, Times_id, Times_startset, Times_countset, Times_data);
check_err(stat,__LINE__,__FILE__);
}


stat = nc_close(ncid);
check_err(stat,__LINE__,__FILE__);
return 0;
}
Loading