2018-12-07 06:36:53 +08:00
|
|
|
/*! \file
|
|
|
|
|
|
|
|
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
|
|
|
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
|
|
|
2015, 2016, 2017, 2018
|
|
|
|
University Corporation for Atmospheric Research/Unidata.
|
|
|
|
|
|
|
|
See \ref copyright file for more info.
|
|
|
|
|
|
|
|
*/
|
2014-01-21 07:11:45 +08:00
|
|
|
#include "config.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2018-10-31 10:48:12 +08:00
|
|
|
#include "netcdf.h"
|
|
|
|
#include "nctestserver.h"
|
2014-01-21 07:11:45 +08:00
|
|
|
|
2018-10-31 10:48:12 +08:00
|
|
|
#define FURL "%s"
|
|
|
|
static char url[4096];
|
2014-01-21 07:11:45 +08:00
|
|
|
|
2014-10-05 05:59:16 +08:00
|
|
|
#ifdef DEBUG
|
2014-01-21 07:11:45 +08:00
|
|
|
static void
|
|
|
|
CHECK(int e, const char* msg)
|
|
|
|
{
|
|
|
|
if(e == NC_NOERR) return;
|
|
|
|
if(msg == NULL) msg = "Error";
|
|
|
|
printf("%s: %s\n", msg, nc_strerror(e));
|
|
|
|
exit(1);
|
|
|
|
}
|
2014-10-05 05:59:16 +08:00
|
|
|
#endif
|
2014-01-21 07:11:45 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
XFAIL(int e, const char* msg)
|
|
|
|
{
|
|
|
|
if(e == NC_NOERR) return;
|
|
|
|
if(msg == NULL) msg = "XFAIL";
|
|
|
|
printf("%s: %s\n", msg, nc_strerror(e));
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
int ncid,retval;
|
2018-10-31 10:48:12 +08:00
|
|
|
char* serverlist = NULL;
|
|
|
|
char* svcurl = NULL;
|
|
|
|
const char* servlet = "dts";
|
|
|
|
|
|
|
|
#ifdef REMOTETESTSERVERS
|
|
|
|
serverlist = strdup(REMOTETESTSERVERS);
|
|
|
|
#endif
|
2014-01-21 07:11:45 +08:00
|
|
|
|
2018-10-31 10:48:12 +08:00
|
|
|
if(serverlist == NULL || strlen(serverlist) == 0) {
|
2020-01-01 06:42:58 +08:00
|
|
|
fprintf(stderr,"WARNING: Cannot determine a server list");
|
|
|
|
exit(0);
|
2014-10-05 05:59:16 +08:00
|
|
|
}
|
2020-01-01 06:42:58 +08:00
|
|
|
svcurl = nc_findtestserver(servlet,serverlist);
|
2018-10-31 10:48:12 +08:00
|
|
|
if(svcurl == NULL) {
|
2020-01-01 06:42:58 +08:00
|
|
|
fprintf(stderr,"WARNING: Server not found: %s\n",servlet);
|
2021-12-24 13:18:56 +08:00
|
|
|
exit(0);
|
2018-10-31 10:48:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(url,sizeof(url),FURL,svcurl);
|
2014-10-05 05:59:16 +08:00
|
|
|
|
2018-10-31 10:48:12 +08:00
|
|
|
printf("Testing: Misc. Tests url=|%s|\n",url);
|
|
|
|
retval = nc_open(url, 0, &ncid);
|
2014-01-21 07:11:45 +08:00
|
|
|
XFAIL(retval,"*** XFail : No trailing slash in url");
|
|
|
|
retval = nc_close(ncid);
|
2018-10-31 10:48:12 +08:00
|
|
|
/* cleanup */
|
|
|
|
free(serverlist);
|
|
|
|
free(svcurl);
|
2014-01-21 07:11:45 +08:00
|
|
|
return 0;
|
|
|
|
}
|