summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2010-03-08 17:14:47 (GMT)
committerDavid Cole <david.cole@kitware.com>2010-03-08 18:25:58 (GMT)
commita61c5ab6e59a458ad34383e64d0679a7fe898c61 (patch)
tree48b29a4098c425fcd826bb63aee3c23bfca4adf9 /Utilities/cmcurl
parenta9ac761938441fc2e86314c8200f7f39a3c2c6c3 (diff)
downloadCMake-a61c5ab6e59a458ad34383e64d0679a7fe898c61.zip
CMake-a61c5ab6e59a458ad34383e64d0679a7fe898c61.tar.gz
CMake-a61c5ab6e59a458ad34383e64d0679a7fe898c61.tar.bz2
Add CMAKE_TESTS_CDASH_SERVER variable and CTestSubmitLargeOutput test.
If defined and non-empty, the value of CMAKE_TESTS_CDASH_SERVER should point to a CDash server willing to accept submissions for a project named PublicDashboard. On machines that also run a CDash dashboard, set this variable to "http://localhost/CDash-trunk-Testing" so that the CMake tests that submit dashboards do not have to send those submissions over the wire. The CTestSubmitLargeOutput test runs a dashboard that has a test that produces very large amount of output on stdout/stderr. Since we do not even want to attempt to send such large output over the wire, this test is off by default unless the CMAKE_TESTS_CDASH_SERVER server is localhost. This test is expected to cause a submission failure when sent to CDash. It passes if the submit results contain error output. It fails if the submit succeeds. CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests. If not defined or "", this variable defaults to the server at http://www.cdash.org/CDash. If set explicitly to "NOTFOUND", curl tests and ctest tests that use the network are skipped. If set to something starting with "http://localhost/", the CDash is expected to be an instance of CDash used for CDash testing, pointing to a cdash4simpletest database. In these cases, the CDash dashboards should be run first.
Diffstat (limited to 'Utilities/cmcurl')
-rw-r--r--Utilities/cmcurl/CMakeLists.txt6
-rw-r--r--Utilities/cmcurl/Testing/curltest.c29
2 files changed, 27 insertions, 8 deletions
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index d7ff9aa..510851a 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -762,5 +762,9 @@ ENDIF(CURL_TESTING)
ADD_EXECUTABLE(LIBCURL Testing/curltest.c)
TARGET_LINK_LIBRARIES(LIBCURL cmcurl ${CMAKE_DL_LIBS})
-ADD_TEST(curl LIBCURL)
+
+IF(CMAKE_CURL_TEST_URL)
+ ADD_TEST(curl LIBCURL ${CMAKE_CURL_TEST_URL})
+ENDIF(CMAKE_CURL_TEST_URL)
+
INSTALL(FILES COPYING DESTINATION ${CMake_DOC_DEST}/cmcurl)
diff --git a/Utilities/cmcurl/Testing/curltest.c b/Utilities/cmcurl/Testing/curltest.c
index 67c142f..210868e 100644
--- a/Utilities/cmcurl/Testing/curltest.c
+++ b/Utilities/cmcurl/Testing/curltest.c
@@ -36,7 +36,7 @@ int GetFtpFile(void)
return retVal;
}
-int GetWebFile(void)
+int GetWebFiles(char *url1, char *url2)
{
int retVal = 0;
CURL *curl;
@@ -98,22 +98,24 @@ int GetWebFile(void)
}
/* get the first document */
- curl_easy_setopt(curl, CURLOPT_URL, "http://www.cmake.org/page1.html");
+ curl_easy_setopt(curl, CURLOPT_URL, url1);
res = curl_easy_perform(curl);
if ( res != 0 )
{
- printf("Error fetching: http://www.cmake.org/page1.html\n");
+ printf("Error fetching: %s\n", url1);
retVal = 1;
}
/* get another document from the same server using the same
connection */
+ /* avoid warnings about url2 since below block is commented out: */
+ (void) url2;
/*
- curl_easy_setopt(curl, CURLOPT_URL, "http://www.cmake.org/page2.html");
+ curl_easy_setopt(curl, CURLOPT_URL, url2);
res = curl_easy_perform(curl);
if ( res != 0 )
{
- printf("Error fetching: http://www.cmake.org/page2.html\n");
+ printf("Error fetching: %s\n", url2);
retVal = 1;
}
*/
@@ -130,15 +132,28 @@ int GetWebFile(void)
return retVal;
}
-int main(/*int argc, char **argv*/)
+
+int main(int argc, char **argv)
{
int retVal = 0;
+
curl_global_init(CURL_GLOBAL_DEFAULT);
- retVal += GetWebFile();
+
+ if(argc>1)
+ {
+ retVal += GetWebFiles(argv[1], 0);
+ }
+ else
+ {
+ printf("error: first argument should be a url to download\n");
+ retVal = 1;
+ }
/* Do not check the output of FTP socks5 cannot handle FTP yet */
/* GetFtpFile(); */
/* do not test ftp right now because we don't enable that port */
+
curl_global_cleanup();
+
return retVal;
}