mirror of https://github.com/KLayout/klayout.git
Skipping HTTP tests rather than disabling them
With this commit, tests are logged as skipped and not just omitted, if HTTP support is not enabled (neighter Qt nor curl)
This commit is contained in:
parent
5351922440
commit
46b0f079cf
|
|
@ -29,11 +29,16 @@
|
||||||
#include "dbGerberImporter.h"
|
#include "dbGerberImporter.h"
|
||||||
|
|
||||||
#include "tlUnitTest.h"
|
#include "tlUnitTest.h"
|
||||||
|
#include "tlXMLParser.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static void run_test (tl::TestBase *_this, const char *dir)
|
static void run_test (tl::TestBase *_this, const char *dir)
|
||||||
{
|
{
|
||||||
|
if (! tl::XMLParser::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
db::LoadLayoutOptions options;
|
db::LoadLayoutOptions options;
|
||||||
|
|
||||||
db::Layout layout;
|
db::Layout layout;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "tlUnitTest.h"
|
#include "tlUnitTest.h"
|
||||||
#include "dbBox.h"
|
#include "dbBox.h"
|
||||||
#include "dbEdge.h"
|
#include "dbEdge.h"
|
||||||
|
#include "tlXMLParser.h"
|
||||||
|
|
||||||
TEST(1)
|
TEST(1)
|
||||||
{
|
{
|
||||||
|
|
@ -215,6 +216,10 @@ TEST(4)
|
||||||
|
|
||||||
TEST(5)
|
TEST(5)
|
||||||
{
|
{
|
||||||
|
if (! tl::XMLParser::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
std::string tmp_file = tl::TestBase::tmp_file ("tmp_5.lyrdb");
|
std::string tmp_file = tl::TestBase::tmp_file ("tmp_5.lyrdb");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -358,6 +363,10 @@ TEST(5)
|
||||||
|
|
||||||
TEST(5a)
|
TEST(5a)
|
||||||
{
|
{
|
||||||
|
if (! tl::XMLParser::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
std::string tmp_file = tl::TestBase::tmp_file ("tmp_5a.lyrdb");
|
std::string tmp_file = tl::TestBase::tmp_file ("tmp_5a.lyrdb");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,17 @@ public:
|
||||||
*/
|
*/
|
||||||
static void set_credential_provider (HttpCredentialProvider *cp);
|
static void set_credential_provider (HttpCredentialProvider *cp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns true, if HTTP support is compiled in
|
||||||
|
*/
|
||||||
|
static bool is_available ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Polling: call this function regularily to explicitly establish polling
|
||||||
|
* (in the Qt framework, this is done automatically within the event loop)
|
||||||
|
*/
|
||||||
|
void tick ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sends the request for data
|
* @brief Sends the request for data
|
||||||
* To ensure prompt delivery of data, this method can be used prior to
|
* To ensure prompt delivery of data, this method can be used prior to
|
||||||
|
|
|
||||||
|
|
@ -642,6 +642,18 @@ InputHttpStream::filename () const
|
||||||
return mp_data->filename ();
|
return mp_data->filename ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
InputHttpStream::is_available ()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InputHttpStream::tick ()
|
||||||
|
{
|
||||||
|
CurlNetworkManager::instance ()->tick ();
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// CurlConnection implementation
|
// CurlConnection implementation
|
||||||
|
|
||||||
|
|
@ -1063,9 +1075,13 @@ void CurlNetworkManager::release_connection (CurlConnection *connection)
|
||||||
void CurlNetworkManager::on_tick ()
|
void CurlNetworkManager::on_tick ()
|
||||||
{
|
{
|
||||||
if (tick ()) {
|
if (tick ()) {
|
||||||
|
// NOTE: don't reschedule if there is no DM scheduler. This will cause deep
|
||||||
|
// recursion.
|
||||||
|
if (tl::DeferredMethodScheduler::instance ()) {
|
||||||
dm_tick ();
|
dm_tick ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int CurlNetworkManager::tick ()
|
int CurlNetworkManager::tick ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -130,4 +130,16 @@ InputHttpStream::filename () const
|
||||||
return std::string ();
|
return std::string ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
InputHttpStream::is_available ()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InputHttpStream::tick ()
|
||||||
|
{
|
||||||
|
// .. nothing yet ..
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,18 @@ InputHttpStream::filename () const
|
||||||
return mp_data->filename ();
|
return mp_data->filename ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
InputHttpStream::is_available ()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InputHttpStream::tick ()
|
||||||
|
{
|
||||||
|
QCoreApplication::processEvents (QEventLoop::ExcludeUserInputEvents);
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// InputHttpStreamPrivateData implementation
|
// InputHttpStreamPrivateData implementation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -371,6 +371,12 @@ XMLParser::parse (XMLSource &source, XMLStructureHandler &struct_handler)
|
||||||
mp_data->check_error ();
|
mp_data->check_error ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
XMLParser::is_available ()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(HAVE_QT)
|
#elif defined(HAVE_QT)
|
||||||
|
|
@ -761,6 +767,12 @@ XMLParser::parse (XMLSource &source, XMLStructureHandler &struct_handler)
|
||||||
mp_data->parse (source.source (), false /*=not incremental*/);
|
mp_data->parse (source.source (), false /*=not incremental*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
XMLParser::is_available ()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
@ -867,6 +879,12 @@ XMLParser::parse (XMLSource &, XMLStructureHandler &)
|
||||||
tl_assert (false);
|
tl_assert (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
XMLParser::is_available ()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -424,6 +424,11 @@ public:
|
||||||
|
|
||||||
void parse (XMLSource &source, XMLStructureHandler &handler);
|
void parse (XMLSource &source, XMLStructureHandler &handler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns true, if XML support is compiled in
|
||||||
|
*/
|
||||||
|
static bool is_available ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
XMLParserPrivateData *mp_data;
|
XMLParserPrivateData *mp_data;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,15 @@
|
||||||
#include "tlUnitTest.h"
|
#include "tlUnitTest.h"
|
||||||
#include "tlTimer.h"
|
#include "tlTimer.h"
|
||||||
|
|
||||||
#if defined(HAVE_QT) || defined(HAVE_CURL)
|
|
||||||
|
|
||||||
#if defined(HAVE_QT)
|
|
||||||
# include <QCoreApplication>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static std::string test_url1 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/text");
|
static std::string test_url1 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/text");
|
||||||
static std::string test_url2 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/dir1");
|
static std::string test_url2 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/dir1");
|
||||||
|
|
||||||
TEST(1)
|
TEST(1)
|
||||||
{
|
{
|
||||||
|
if (! tl::InputHttpStream::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
tl::InputHttpStream stream (test_url1);
|
tl::InputHttpStream stream (test_url1);
|
||||||
|
|
||||||
char b[100];
|
char b[100];
|
||||||
|
|
@ -46,6 +44,10 @@ TEST(1)
|
||||||
|
|
||||||
TEST(2)
|
TEST(2)
|
||||||
{
|
{
|
||||||
|
if (! tl::InputHttpStream::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
tl::InputHttpStream stream (test_url2);
|
tl::InputHttpStream stream (test_url2);
|
||||||
stream.add_header ("User-Agent", "SVN");
|
stream.add_header ("User-Agent", "SVN");
|
||||||
stream.add_header ("Depth", "1");
|
stream.add_header ("Depth", "1");
|
||||||
|
|
@ -94,22 +96,25 @@ public:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_QT)
|
|
||||||
|
|
||||||
// async mode
|
// async mode
|
||||||
TEST(3)
|
TEST(3)
|
||||||
{
|
{
|
||||||
|
if (! tl::InputHttpStream::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
tl::InputHttpStream stream (test_url1);
|
tl::InputHttpStream stream (test_url1);
|
||||||
|
|
||||||
Receiver r;
|
Receiver r;
|
||||||
stream.ready ().add (&r, &Receiver::handle);
|
stream.ready ().add (&r, &Receiver::handle);
|
||||||
|
|
||||||
|
EXPECT_EQ (stream.data_available (), false);
|
||||||
stream.send ();
|
stream.send ();
|
||||||
EXPECT_EQ (stream.data_available (), false);
|
EXPECT_EQ (stream.data_available (), false);
|
||||||
|
|
||||||
tl::Clock start = tl::Clock::current ();
|
tl::Clock start = tl::Clock::current ();
|
||||||
while (! r.flag && (tl::Clock::current () - start).seconds () < 10) {
|
while (! r.flag && (tl::Clock::current () - start).seconds () < 10) {
|
||||||
QCoreApplication::processEvents (QEventLoop::ExcludeUserInputEvents);
|
stream.tick ();
|
||||||
}
|
}
|
||||||
EXPECT_EQ (r.flag, true);
|
EXPECT_EQ (r.flag, true);
|
||||||
EXPECT_EQ (stream.data_available (), true);
|
EXPECT_EQ (stream.data_available (), true);
|
||||||
|
|
@ -120,6 +125,3 @@ TEST(3)
|
||||||
EXPECT_EQ (res, "hello, world.\n");
|
EXPECT_EQ (res, "hello, world.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,10 @@
|
||||||
|
|
||||||
|
|
||||||
#include "tlWebDAV.h"
|
#include "tlWebDAV.h"
|
||||||
|
#include "tlHttpStream.h"
|
||||||
#include "tlUnitTest.h"
|
#include "tlUnitTest.h"
|
||||||
#include "tlFileUtils.h"
|
#include "tlFileUtils.h"
|
||||||
|
|
||||||
#if defined(HAVE_QT) || defined(HAVE_CURL)
|
|
||||||
|
|
||||||
static std::string test_url1 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata");
|
static std::string test_url1 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata");
|
||||||
static std::string test_url2 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/text");
|
static std::string test_url2 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/text");
|
||||||
|
|
||||||
|
|
@ -49,6 +48,10 @@ static std::string collection2string (const tl::WebDAVObject &coll)
|
||||||
|
|
||||||
TEST(1)
|
TEST(1)
|
||||||
{
|
{
|
||||||
|
if (! tl::InputHttpStream::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
tl::WebDAVObject collection;
|
tl::WebDAVObject collection;
|
||||||
collection.read (test_url1, 1);
|
collection.read (test_url1, 1);
|
||||||
|
|
||||||
|
|
@ -65,6 +68,10 @@ TEST(1)
|
||||||
|
|
||||||
TEST(2)
|
TEST(2)
|
||||||
{
|
{
|
||||||
|
if (! tl::InputHttpStream::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
tl::WebDAVObject collection;
|
tl::WebDAVObject collection;
|
||||||
collection.read (test_url1, 0);
|
collection.read (test_url1, 0);
|
||||||
|
|
||||||
|
|
@ -75,6 +82,10 @@ TEST(2)
|
||||||
|
|
||||||
TEST(3)
|
TEST(3)
|
||||||
{
|
{
|
||||||
|
if (! tl::InputHttpStream::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
tl::WebDAVObject collection;
|
tl::WebDAVObject collection;
|
||||||
collection.read (test_url2, 1);
|
collection.read (test_url2, 1);
|
||||||
|
|
||||||
|
|
@ -85,6 +96,10 @@ TEST(3)
|
||||||
|
|
||||||
TEST(4)
|
TEST(4)
|
||||||
{
|
{
|
||||||
|
if (! tl::InputHttpStream::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
tl::WebDAVObject collection;
|
tl::WebDAVObject collection;
|
||||||
collection.read (test_url2, 0);
|
collection.read (test_url2, 0);
|
||||||
|
|
||||||
|
|
@ -95,6 +110,10 @@ TEST(4)
|
||||||
|
|
||||||
TEST(5)
|
TEST(5)
|
||||||
{
|
{
|
||||||
|
if (! tl::InputHttpStream::is_available ()) {
|
||||||
|
throw tl::CancelException ();
|
||||||
|
}
|
||||||
|
|
||||||
tl::WebDAVObject collection;
|
tl::WebDAVObject collection;
|
||||||
|
|
||||||
std::string tmp_dir (tmp_file ("tmp"));
|
std::string tmp_dir (tmp_file ("tmp"));
|
||||||
|
|
@ -123,5 +142,3 @@ TEST(5)
|
||||||
EXPECT_EQ (ba21, "A text II.I.\n");
|
EXPECT_EQ (ba21, "A text II.I.\n");
|
||||||
text21.close ();
|
text21.close ();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,9 @@ SOURCES = \
|
||||||
tlXMLParser.cc \
|
tlXMLParser.cc \
|
||||||
tlUri.cc \
|
tlUri.cc \
|
||||||
tlWebDAV.cc \
|
tlWebDAV.cc \
|
||||||
|
tlHttpStream.cc \
|
||||||
|
|
||||||
equals(HAVE_QT, "0") {
|
!equals(HAVE_QT, "0") {
|
||||||
# nothing
|
|
||||||
} else {
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
tlDeferredExecution.cc \
|
tlDeferredExecution.cc \
|
||||||
|
|
@ -43,24 +42,6 @@ equals(HAVE_QT, "0") {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
equals(HAVE_CURL, "1") {
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
tlHttpStream.cc \
|
|
||||||
|
|
||||||
} else {
|
|
||||||
equals(HAVE_QT, "0") {
|
|
||||||
# no HTTP stream available
|
|
||||||
} else {
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
tlHttpStream.cc \
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INCLUDEPATH += $$TL_INC
|
INCLUDEPATH += $$TL_INC
|
||||||
DEPENDPATH += $$TL_INC
|
DEPENDPATH += $$TL_INC
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue