Skip to content

Commit

Permalink
Merge pull request #1321 from Unidata/dap4endianfix2.dmh
Browse files Browse the repository at this point in the history
Fix additional big-endian machine error in dap4.
  • Loading branch information
WardF authored Feb 15, 2019
2 parents 53ba2ff + ddd324c commit 05daded
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 10 deletions.
10 changes: 6 additions & 4 deletions dap4_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)

FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)

IF(ENABLE_DAP_REMOTE_TESTS)
# Change name (add '4') to avoid cmake
# complaint about duplicate targets.
BUILD_BIN_TEST(findtestserver4)
ENDIF()

IF(ENABLE_TESTS)

# Base tests
Expand All @@ -35,10 +41,6 @@ IF(ENABLE_TESTS)

IF(ENABLE_DAP_REMOTE_TESTS)

# Change name (add '4') to avoid cmake
# complaint about duplicate targets.
BUILD_BIN_TEST(findtestserver4)

IF(BUILD_UTILITIES)
#add_sh_test(dap4_test test_remote)
ENDIF(BUILD_UTILITIES)
Expand Down
5 changes: 4 additions & 1 deletion dap4_test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ test_data.log: test_meta.log
if ENABLE_DAP_REMOTE_TESTS
# Note: This program name was changed to findtestserver4
# to avoid cmake complaint about duplicate targets.
check_PROGRAMS += findtestserver4
noinst_PROGRAMS = findtestserver4
findtestserver4_SOURCES = findtestserver4.c
endif

if ENABLE_DAP_REMOTE_TESTS
if BUILD_UTILITIES
# relies on ncdump
TESTS += test_remote.sh
Expand Down
6 changes: 5 additions & 1 deletion include/nctestserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ See \ref copyright file for more info.
#define MAXSERVERURL 4096
#define TIMEOUT 10 /*seconds*/
#define BUFSIZE 8192 /*bytes*/
#define MAXREMOTETESTSERVERS 4096

#ifndef HAVE_CURLINFO_RESPONSE_CODE
#define CURLINFO_RESPONSE_CODE CURLINFO_HTTP_CODE
Expand All @@ -37,8 +38,11 @@ parseServers(const char* remotetestservers)
char* p;
char* svc;
char** l;
size_t rtslen = strlen(remotetestservers);

list = (char**)malloc(sizeof(char*) * (int)(strlen(remotetestservers)/2));
/* Keep LGTM quiet */
if(rtslen > MAXREMOTETESTSERVERS) goto done;
list = (char**)malloc(sizeof(char*) * (int)(rtslen/2));
if(list == NULL) return NULL;
rts = strdup(remotetestservers);
if(rts == NULL) goto done;
Expand Down
6 changes: 5 additions & 1 deletion libdap2/test_vara.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ main()
size_t count[RANK];
char URL[4096];
const char* svc = NULL;
const char* testservers = "";

#ifdef REMOTETESTSERVERS
testservers = REMOTETESTSERVERS;
#endif
/* Find Test Server */
svc = nc_findtestserver("dts",0);
svc = nc_findtestserver("dts",0,testservers);
if(svc == NULL) {
fprintf(stderr,"Cannot locate test server\n");
exit(1);
Expand Down
4 changes: 4 additions & 0 deletions libdap4/d4meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,11 @@ convertString(union ATOMICS* converter, NCD4node* type, const char* s)
if(sscanf(s,"%lf",&converter->f64[0]) != 1) return THROW(NC_ERANGE);
break;
case NC_CHAR:
#ifdef WORDS_BIGENDIAN
converter->i8[7] = s[0];
#else
converter->i8[0] = s[0];
#endif
break;
case NC_STRING:
converter->s[0]= strdup(s);
Expand Down
7 changes: 5 additions & 2 deletions ncdap_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)

FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)


IF(ENABLE_DAP_REMOTE_TESTS)
BUILD_BIN_TEST(findtestserver)
ENDIF()

IF(ENABLE_TESTS)
# Base tests
# The tests are set up as a combination of shell scripts and executables that
Expand All @@ -31,8 +36,6 @@ IF(ENABLE_TESTS)

IF(ENABLE_DAP_REMOTE_TESTS)

BUILD_BIN_TEST(findtestserver)

IF(BUILD_UTILITIES)
add_sh_test(ncdap tst_ber)
add_sh_test(ncdap tst_remote3)
Expand Down
4 changes: 3 additions & 1 deletion ncdap_test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ endif
# because the server may be down or inaccessible

if ENABLE_DAP_REMOTE_TESTS
check_PROGRAMS += findtestserver
noinst_PROGRAMS = findtestserver
findtestserver_SOURCES = findtestserver.c
endif

if ENABLE_DAP_REMOTE_TESTS
if BUILD_UTILITIES
TESTS += tst_ber.sh tst_remote3.sh tst_formatx.sh testurl.sh tst_fillmismatch.sh tst_zero_len_var.sh
endif
Expand Down

0 comments on commit 05daded

Please sign in to comment.