Skip to content

Commit a189b98

Browse files
author
dmh
committed
1. Any test that references nctestserver/NC_findtestserver
should be under ENABLE_DAP_REMOTE_TESTS. Fixed to make sure that this is so. Also attempted to fix ncdap_test/CMakeLists.txt, but probably got it wrong. HT to Nico Schlomer. 2. Attempted to reduce the number of conversion errors when -Wconversion is set. Fixed oc2, but rest of netcdf remains to be done. HT to Nico Schlomer. 3. When doing #2, I discovered an error in ncgen.y that has remained hidden. This required some other test case fixes.
1 parent baade3e commit a189b98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+386
-282
lines changed

cf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ DAP=1
1616
#M32=1
1717
#M64=1
1818

19+
CFLAGS=""
20+
#CFLAGS="-Wall -Wno-unused-variable -Wno-unused-parameter -Wconversion ${CFLAGS}"
21+
#CFLAGS="-Wall -Wno-unused-variable -Wno-unused-parameter ${CFLAGS}"
22+
1923
FORCE="-i"
2024

2125
#INSTALL=1

libdispatch/ddispatch.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const char*
6565
NC_findtestserver(const char* path)
6666
{
6767
#ifdef USE_DAP
68+
#ifdef ENABLE_DAP_REMOTE_TESTS
6869
/* NCDAP_ping is defined in libdap2/ncdap3.c */
6970
const char** svc;
7071
if(path == NULL) path = "";
@@ -79,6 +80,7 @@ NC_findtestserver(const char* path)
7980
if(stat == NC_NOERR)
8081
return *svc;
8182
}
83+
#endif
8284
#endif
8385
return NULL;
8486
}

libdispatch/nctime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ cdTrim(char* s, int n)
5050

5151
if(s==NULL)
5252
return;
53-
for(c=s; *c && c<s+n-1 && !isspace(*c); c++);
53+
for(c=s; *c && c<s+n-1 && !isspace((int)*c); c++);
5454
*c='\0';
5555
return;
5656
}

ncdap_test/CMakeLists.txt

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
1212

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

15-
ADD_EXECUTABLE(nctestserver nctestserver.c)
16-
TARGET_LINK_LIBRARIES(nctestserver netcdf ${ALL_TLL_LIBS})
15+
IF(ENABLE_DAP_REMOTE_TESTS)
16+
ADD_EXECUTABLE(nctestserver nctestserver.c)
17+
TARGET_LINK_LIBRARIES(nctestserver netcdf ${ALL_TLL_LIBS})
18+
ENDIF()
1719

1820
IF(ENABLE_TESTS)
1921
# Base tests
@@ -24,29 +26,26 @@ IF(ENABLE_TESTS)
2426

2527
add_sh_test(ncdap tst_ncdap3)
2628

27-
IF(ENABLE_DAP_REMOTE_TESTS)
28-
add_sh_test(ncdap tst_remote3)
29-
add_sh_test(ncdap tst_formatx)
30-
ENDIF()
31-
32-
IF(ENABLE_DAP_LONG_TESTS)
33-
add_sh_test(ncdap tst_longremote3)
34-
ENDIF()
35-
3629
IF(NOT MSVC)
3730
add_bin_env_test(ncdap t_dap3a)
3831
add_bin_env_test(ncdap test_cvt)
3932
add_bin_env_test(ncdap test_vara)
4033
ENDIF()
41-
add_bin_test(ncdap test_nstride_cached)
42-
add_bin_test(ncdap test_partvar)
43-
add_bin_test(ncdap t_misc)
4434

45-
IF(ENABLE_DAP_AUTH_TESTS)
46-
add_bin_test(ncdap t_auth)
47-
ENDIF()
35+
IF(ENABLE_DAP_REMOTE_TESTS)
36+
add_sh_test(ncdap tst_remote3)
37+
add_sh_test(ncdap tst_formatx)
38+
add_bin_test(ncdap test_partvar)
39+
IF(ENABLE_DAP_LONG_TESTS)
40+
add_sh_test(ncdap tst_longremote3)
41+
ENDIF()
4842

43+
add_bin_test(ncdap test_nstride_cached)
44+
add_bin_test(ncdap t_misc)
4945

46+
IF(ENABLE_DAP_AUTH_TESTS)
47+
add_bin_test(ncdap t_auth)
48+
ENDIF()
5049

5150
# test_varm3 did not survive the transition
5251
# to remotetest.unidata.ucar.edu; the
@@ -55,6 +54,8 @@ IF(ENABLE_TESTS)
5554
# and put it in testdods directory on remotetest.
5655
# add_bin_test(ncdap test_varm3)
5756

57+
ENDIF()
58+
5859
ENDIF()
5960
ADD_SUBDIRECTORY(testdata3)
6061
ADD_SUBDIRECTORY(expected3)

ncdap_test/Makefile.am

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,40 @@ check_PROGRAMS =
1414
TESTS =
1515
TESTS_ENVIRONMENT=TOPSRCDIR=${abs_top_srcdir}
1616

17-
# Make nctestserver be the first test to be built
18-
check_PROGRAMS += nctestserver
19-
nctestserver_SOURCES = nctestserver.c
20-
2117
TESTS += tst_ncdap3.sh
2218

19+
t_dap3a_SOURCES = t_dap3a.c
20+
test_cvt3_SOURCES = test_cvt.c
21+
test_vara_SOURCES = test_vara.c
22+
23+
check_PROGRAMS += t_dap3a test_cvt3 test_vara
24+
25+
TESTS += t_dap3a test_cvt3 test_vara
26+
2327
# remote tests are optional
2428
# because the server may be down or inaccessible
2529

2630
if ENABLE_DAP_REMOTE_TESTS
2731

28-
TESTS += tst_remote3.sh tst_formatx.sh
32+
# Make nctestserver be the first test to be built
33+
check_PROGRAMS += nctestserver
34+
nctestserver_SOURCES = nctestserver.c
35+
36+
TESTS += tst_remote3.sh tst_formatx.sh test_partvar
2937

3038
if ENABLE_DAP_LONG_TESTS
3139
TESTS += tst_longremote3.sh
3240
endif
3341

34-
test_cvt3_SOURCES = test_cvt.c
35-
test_vara_SOURCES = test_vara.c
3642
test_partvar_SOURCES = test_partvar.c
37-
t_dap3a_SOURCES = t_dap3a.c
3843
test_nstride_cached_SOURCE = test_nstride_cached.c
3944
t_auth_SOURCES = t_auth.c
4045
t_misc_SOURCES = t_misc.c
4146

42-
TESTS += t_dap3a test_cvt3 test_vara test_partvar
43-
TESTS += t_dap3a
4447
TESTS += test_nstride_cached
4548
TESTS += t_misc
4649

47-
check_PROGRAMS += t_dap3a test_cvt3 test_vara test_partvar
48-
check_PROGRAMS += t_dap3a
50+
check_PROGRAMS += test_partvar
4951
check_PROGRAMS += test_nstride_cached
5052
check_PROGRAMS += t_misc
5153

ncdump/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ ADD_EXECUTABLE(nccopy ${nccopy_FILES})
3636
TARGET_LINK_LIBRARIES(ncdump netcdf ${ALL_TLL_LIBS})
3737
TARGET_LINK_LIBRARIES(nccopy netcdf ${ALL_TLL_LIBS})
3838

39+
ADD_EXECUTABLE(bom bom.c)
40+
3941
IF(ENABLE_TESTS)
40-
ADD_EXECUTABLE(rewrite-scalar rewrite-scalar.c bom.c)
42+
ADD_EXECUTABLE(rewrite-scalar rewrite-scalar.c)
4143
TARGET_LINK_LIBRARIES(rewrite-scalar netcdf)
4244
# Base tests
4345
# The tests are set up as a combination of shell scripts and executables that

ncdump/bom.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <config.h>
77
#include <stdlib.h>
88
#include <stdio.h>
9+
#include <string.h>
910

1011
/* BOM Sequences */
1112
static char* U8 = "\xEF\xBB\xBF"; /* UTF-8 */
@@ -18,7 +19,7 @@ int
1819
main(int argc, char** argv)
1920
{
2021
char* bom = U8;
21-
int bomlen = 3;
22+
size_t bomlen = 3;
2223
if(argc > 1 && strlen(argv[1]) > 0) {
2324
char* which = argv[1];
2425
switch (which[0]) {
@@ -30,4 +31,3 @@ main(int argc, char** argv)
3031
fwrite(bom,1,bomlen,stdout);
3132
exit(0);
3233
}
33-

ncdump/ncdump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,7 +1944,7 @@ main(int argc, char *argv[])
19441944
break;
19451945
case 'b': /* brief comments in data section */
19461946
formatting_specs.brief_data_cmnts = true;
1947-
switch (tolower(optarg[0])) {
1947+
switch (tolower((int)optarg[0])) {
19481948
case 'c':
19491949
formatting_specs.data_lang = LANG_C;
19501950
break;
@@ -1957,7 +1957,7 @@ main(int argc, char *argv[])
19571957
break;
19581958
case 'f': /* full comments in data section */
19591959
formatting_specs.full_data_cmnts = true;
1960-
switch (tolower(optarg[0])) {
1960+
switch (tolower((int)optarg[0])) {
19611961
case 'c':
19621962
formatting_specs.data_lang = LANG_C;
19631963
break;

ncdump/tst_bom.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if ../ncgen/ncgen -k1 -o tst_bom16.nc tst_bom16.cdl ; then
4545
echo 'BOM Big Endian 16 succeeded, but should not'
4646
exit 1
4747
else
48-
echo '***XFAIL: BOM Big Endian 16'
48+
echo '***XFAIL : BOM Big Endian 16'
4949
fi
5050

5151
# Cleanup

ncdump/tst_netcdf4_4.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ else # Non-MINGW Platforms
8181
diff -b tst_compounds4.cdl $srcdir/ref_tst_compounds4.cdl
8282

8383
# Exercise Jira NCF-213 bug fix
84-
rm -f tst_ncf213.cdl tst_ncf213.nc
84+
# rm -f tst_ncf213.cdl tst_ncf213.nc
8585
../ncgen/ncgen -b -o tst_ncf213.nc $srcdir/ref_tst_ncf213.cdl
8686
./ncdump -s -h tst_ncf213.nc >tst_ncf213.cdl
8787
# Now compare
8888
ok=1;
8989
if diff -b $srcdir/ref_tst_ncf213.cdl tst_ncf213.cdl ; then ok=1; else ok=0; fi
9090
# cleanup
91-
rm -f tst_ncf213.cdl tst_ncf213.nc
91+
# rm -f tst_ncf213.cdl tst_ncf213.nc
9292
if test $ok = 0 ; then
9393
echo "*** FAIL: NCF-213 Bug Fix test"
9494
exit 1

0 commit comments

Comments
 (0)