Add some visual studio bug fixes

This commit is contained in:
Dennis Heimbigner 2018-10-11 12:09:42 -06:00
parent 4636584d5b
commit 553de966d6
6 changed files with 34 additions and 22 deletions

View File

@ -1405,12 +1405,8 @@ CHECK_FUNCTION_EXISTS(_filelengthi64 HAVE_FILE_LENGTH_I64)
CHECK_FUNCTION_EXISTS(mmmap HAVE_MMAP)
CHECK_FUNCTION_EXISTS(mremap HAVE_MREMAP)
IF(NOT HAVE_MMMAP)
MESSAGE(WARNING "mmap not found: disabling MMAP support.")
SET(ENABLE_MMAP OFF)
ENDIF()
IF(NOT HAVE_MREMAP)
MESSAGE(WARNING "mremap not found: disabling MMAP support.")
IF(NOT HAVE_MMMAP OR NOT HAVE_MREMAP)
MESSAGE(WARNING "mmap or mremap not found: disabling MMAP support.")
SET(ENABLE_MMAP OFF)
ENDIF()

4
cf
View File

@ -1,9 +1,9 @@
#!/bin/bash
#NB=1
#DB=1
DB=1
#X=-x
FAST=1
#FAST=1
#PROF=1
HDF5=1

View File

@ -387,11 +387,6 @@ extern int NC_argc;
extern char* NC_argv[];
extern int NC_initialized;
extern int nc_initialize();
extern int nc_finalize();
/**
Certain functions are in the dispatch table,
but not in the netcdf.h API. These need to

View File

@ -56,7 +56,7 @@ ENDIF()
SET(TESTFILES ${TESTFILES} tst_diskless tst_diskless3 tst_diskless4 tst_diskless5 tst_inmemory tst_open_mem)
IF(USE_NETCDF4)
SET(TESTFILES ${TESTFILES} tst_diskless2)
SET(TESTFILES ${TESTFILES} tst_diskless6)
SET(TESTS ${TESTS} tst_diskless6)
ENDIF()
# Build executables required for the shell scripts.

View File

@ -51,6 +51,11 @@ TESTPROGRAMS += testnc3perf
testnc3perf_SOURCES = testnc3perf.c
endif
if USE_NETCDF4
TESTPROGRAMS += tst_diskless6
tst_diskless6_SOURCES = tst_diskless6.c
endif
# Set up the tests.
check_PROGRAMS = $(TESTPROGRAMS)
@ -59,7 +64,6 @@ check_PROGRAMS += tst_diskless tst_diskless3 tst_diskless4 \
tst_diskless5 tst_inmemory tst_open_mem
if USE_NETCDF4
check_PROGRAMS += tst_diskless2
TESTPROGRAMS += tst_diskless6
endif
TESTS = $(TESTPROGRAMS)

View File

@ -15,6 +15,7 @@
#include "unistd.h"
#endif
#ifdef _WIN32
#include <Windows.h>
#include <io.h>
#endif
@ -26,14 +27,27 @@
#define NC_NETCDF3 0
#endif
#define RDONLY (S_IRUSR|S_IRGRP|S_IROTH)
#define RDWRITE (RDONLY | S_IWUSR)
#define FILE3D "file3d.nc"
#define FILE3DP "file3dp.nc"
#define FILE4D "file4d.nc"
#define FILE4DP "file4dp.nc"
/* Mnemonics */
#define RDONLY 1
#define RDWRITE 0
#ifdef _WIN32
#define RDONLYMODE (_S_IREAD)
#define RDWRMODE (_S_IREAD|_S_IWRITE)
#define CHMOD _chmod
#define SLEEP(x) Sleep((x)*1000)
#else
#define RDONLYMODE (S_IRUSR|S_IRGRP|S_IROTH)
#define RDWRMODE (RDONLY | S_IWUSR)
#define CHMOD chmod
#define SLEEP(x) sleep(x)
#endif
typedef enum OC { OPEN, CLOSE} OC;
static int lineno = 0;
@ -72,10 +86,13 @@ getmodified(const char* path)
}
static void
changeaccess(mode_t mode)
changeaccess(int rdonly)
{
(void)chmod(FILE3DP,mode);
(void)chmod(FILE4DP,mode);
const char* p3 = FILE3DP; /* Keep Visual Studio happy */
const char* p4 = FILE4DP;
int mode = (rdonly?RDONLYMODE:RDWRMODE);
(void)CHMOD(p3,mode);
(void)CHMOD(p4,mode);
}
static void
@ -146,7 +163,7 @@ testopen(const char* file, int mode, int rdwrite)
printf("test: file=%s mode=%s\n",file,smode(mode)); fflush(stdout);
time1 = getmodified(file);
sleep(1); /* Ensure that if modified, it will be reported */
SLEEP(1); /* Ensure that if modified, it will be reported */
if((ret = nc_open(file,mode,&ncid))) fail(ret);
if(rdwrite) {
/* Modify */