summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Cole <robert.cole@intel.com>2015-06-18 14:52:07 -0400
committerErich Keane <erich.keane@intel.com>2015-06-19 15:26:55 +0000
commit503a35f05766433f23357708101e1788e33efeec (patch)
tree0d31e8a03fbdcf36def7b15f809a8a8f191d0081
parentc601302d923140bf6a0e1a71f87938920d159bd3 (diff)
Added a flag to disable functional tests (tests that communicate with
external servers) as the default build option for the XMPP client build. Added a scons option to enable building functional tests. Change-Id: Icd6bee615ec16373903b0b9b74b3c79b4c24b11a Signed-off-by: Robert Cole <robert.cole@intel.com> Reviewed-on: https://gerrit.iotivity.org/gerrit/1363 Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org> Reviewed-by: Erich Keane <erich.keane@intel.com>
-rw-r--r--build_common/SConscript.py7
-rw-r--r--ra_xmpp/test/SConscript.py6
-rw-r--r--ra_xmpp/test/xmpp_tests.cpp15
-rw-r--r--test/SConscript.py11
-rw-r--r--test/bosh_tests.cpp4
-rw-r--r--test/curl_tests.cpp8
-rw-r--r--test/ping_tests.cpp4
-rw-r--r--test/register_tests.cpp4
-rw-r--r--test/servicedisc_tests.cpp8
-rw-r--r--test/tcp_tests.cpp13
-rw-r--r--test/xmpp_compliance_tests.cpp12
-rw-r--r--test/xmpp_connect_establish.cpp2
-rw-r--r--test/xmpp_dummy_server.cpp2
-rw-r--r--test/xmpp_tests.cpp28
14 files changed, 108 insertions, 16 deletions
diff --git a/build_common/SConscript.py b/build_common/SConscript.py
index 37bd5ca..9518e13 100644
--- a/build_common/SConscript.py
+++ b/build_common/SConscript.py
@@ -56,6 +56,7 @@ help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', platform_host(), host
help_vars.Add(BoolVariable('STROPHE', 'Use libstrophe in place of C++ stream processor', 'no'))
help_vars.Add(BoolVariable('DOWNLOAD_OPENSSL', 'Force download and build of the openSSL library', 'no'))
+help_vars.Add(BoolVariable('FUNCTIONAL_TESTS', 'Build the functional test within the unit test modules', 'no'))
@@ -247,9 +248,9 @@ env = conf.Finish()
#get packages from brew, etc.
if target_os in ['darwin']:
- env.AppendUnique(
- LIBPATH = [
+ env.AppendUnique(
+ LIBPATH = [
'/usr/local/lib'
])
-
+
diff --git a/ra_xmpp/test/SConscript.py b/ra_xmpp/test/SConscript.py
index 0afd626..d211357 100644
--- a/ra_xmpp/test/SConscript.py
+++ b/ra_xmpp/test/SConscript.py
@@ -68,6 +68,12 @@ if target_os not in ['windows', 'winrt']:
'-Wno-unknown-pragmas', # Ignore any windows-specific pragmas (don't warn)
])
+ if env['FUNCTIONAL_TESTS']==1:
+ ra_xmpp_test_env.AppendUnique(
+ CXXFLAGS = [
+ '-DENABLE_FUNCTIONAL_TESTING',
+ ])
+
if target_os not in ['darwin','ios']:
ra_xmpp_test_env.AppendUnique(
LINKFLAGS = [
diff --git a/ra_xmpp/test/xmpp_tests.cpp b/ra_xmpp/test/xmpp_tests.cpp
index ac744f3..e00ac97 100644
--- a/ra_xmpp/test/xmpp_tests.cpp
+++ b/ra_xmpp/test/xmpp_tests.cpp
@@ -226,7 +226,11 @@ struct ConnectCallbackTest
};
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(ra_xmpp, xmpp_remote_connect)
+#else
+TEST(ra_xmpp, DISABLED_xmpp_remote_connect)
+#endif
{
xmpp_context_t context;
xmpp_context_init(&context);
@@ -352,7 +356,11 @@ void constructTestUserAuth(const string &userPart1, const string &userPart2,
base64Encode(hmac, sizeof(hmac) / sizeof(hmac[0]));
}
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(ra_xmpp, xmpp_remote_register_connect)
+#else
+TEST(ra_xmpp, DISABLED_xmpp_remote_register_connect)
+#endif
{
xmpp_context_t context;
xmpp_context_init(&context);
@@ -412,7 +420,7 @@ struct SimpleConnection
SimpleConnection(const string &instanceName, xmpp_handle_t handle, const xmpp_identity_t &identity,
list<xmpp_identity_t> targets):
m_instance(instanceName), m_identity(identity),
- m_shutdown(false), m_onSentCalls(0)
+ m_shutdown(false), m_connection(), m_messageContext(), m_onSentCalls(0)
{
for (const auto &t : targets)
{
@@ -581,8 +589,11 @@ struct SimpleConnection
};
-
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(ra_xmpp, message_send_receive_test)
+#else
+TEST(ra_xmpp, DISABLED_message_send_receive_test)
+#endif
{
// Initiate parallel connections with different users.
xmpp_context_t context;
diff --git a/test/SConscript.py b/test/SConscript.py
index 1d22201..128fb11 100644
--- a/test/SConscript.py
+++ b/test/SConscript.py
@@ -45,7 +45,7 @@ target_os = ccfxmpp_tests_env.get('TARGET_OS')
if target_os not in ['windows', 'winrt']:
# Force the use of the static library so that we don't need to export everything tested
- # from the shared library.
+ # from the shared library.
ccfxmpplib = File(env['BUILD_DIR']+'libccfxmpp.a')
# We use append rather than appendunique to force certain dynamic libraries to appear
@@ -72,7 +72,7 @@ if target_os not in ['windows', 'winrt']:
'-DASIO_STANDALONE',
'-DASIO_NO_TYPEID',
'-DGTEST_HAS_EXCEPTIONS=1',
- '-Wall',
+ '-Wall',
'-Werror',
'-Wno-unknown-pragmas', # Ignore any windows-specific pragmas (don't warn)
])
@@ -80,8 +80,13 @@ if target_os not in ['windows', 'winrt']:
ccfxmpp_tests_env.AppendUnique(
CXXFLAGS = [
'-DENABLE_LIBSTROPHE',
- ],
+ ],
LIBS = ['libstrophe'])
+ if env['FUNCTIONAL_TESTS']==1:
+ ccfxmpp_tests_env.AppendUnique(
+ CXXFLAGS = [
+ '-DENABLE_FUNCTIONAL_TESTING',
+ ])
if target_os not in ['darwin']:
ccfxmpp_tests_env.AppendUnique(
LINKFLAGS = [
diff --git a/test/bosh_tests.cpp b/test/bosh_tests.cpp
index 63e1001..ed531b9 100644
--- a/test/bosh_tests.cpp
+++ b/test/bosh_tests.cpp
@@ -74,7 +74,11 @@ TEST(BOSH, TestPromise)
resultPromise->get_future().wait_for(chrono::milliseconds(100));
}
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(BOSH, TestClientConnection)
+#else
+TEST(BOSH, DISABLED_TestClientConnection)
+#endif
{
#ifdef ENABLE_LIBSTROPHE
if (!xmpp_connect_config::hasConfig("NO_PROXY"))
diff --git a/test/curl_tests.cpp b/test/curl_tests.cpp
index 1e85fd0..1ea3fef 100644
--- a/test/curl_tests.cpp
+++ b/test/curl_tests.cpp
@@ -181,7 +181,11 @@ TEST(HttpConnection, Http_HostName)
// TODO:
}
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(HttpConnection, Http_Simple_Connect)
+#else
+TEST(HttpConnection, DISABLED_Http_Simple_Connect)
+#endif
{
HttpCurlConnection connection;
ASSERT_TRUE(connection.isValid());
@@ -207,7 +211,11 @@ TEST(HttpConnection, Http_Simple_Connect)
}
}
+#ifdef ENABLE_FUNCTIONAL_TESTING
+TEST(HttpConnection, DISABLED_Https_Connect)
+#else
TEST(HttpConnection, DISABLED_Https_Connect)
+#endif
{
HttpCurlConnection connection;
ASSERT_TRUE(connection.isValid());
diff --git a/test/ping_tests.cpp b/test/ping_tests.cpp
index 1dfe628..3b240c7 100644
--- a/test/ping_tests.cpp
+++ b/test/ping_tests.cpp
@@ -51,7 +51,11 @@ using namespace Iotivity::Xmpp;
#ifndef DISABLE_SUPPORT_XEP0199
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(Ping, XEP_0199_One_Shot_Ping)
+#else
+TEST(Ping, DISABLED_XEP_0199_One_Shot_Ping)
+#endif
{
shared_ptr<IXmppClient> client;
shared_ptr<IXmppStream> stream;
diff --git a/test/register_tests.cpp b/test/register_tests.cpp
index e30d89c..d0b89f0 100644
--- a/test/register_tests.cpp
+++ b/test/register_tests.cpp
@@ -51,7 +51,11 @@ using namespace Iotivity::Xmpp;
#ifndef DISABLE_SUPPORT_NATIVE_XMPP_CLIENT
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(InBandRegistration, XEP0077_Register_Remove)
+#else
+TEST(InBandRegistration, DISABLED_XEP0077_Register_Remove)
+#endif
{
if (!xmpp_connect_config::hasConfig())
{
diff --git a/test/servicedisc_tests.cpp b/test/servicedisc_tests.cpp
index 921714b..4e90060 100644
--- a/test/servicedisc_tests.cpp
+++ b/test/servicedisc_tests.cpp
@@ -51,7 +51,11 @@ using namespace Iotivity::XML;
#ifndef DISABLE_SUPPORT_XEP0030
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(ServiceDiscovery, XEP_0030_Discovery_Info)
+#else
+TEST(ServiceDiscovery, DISABLED_XEP_0030_Discovery_Info)
+#endif
{
shared_ptr<IXmppClient> client;
shared_ptr<IXmppStream> stream;
@@ -101,7 +105,11 @@ TEST(ServiceDiscovery, XEP_0030_Discovery_Info)
}
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(ServiceDiscovery, XEP_0030_Items_Info)
+#else
+TEST(ServiceDiscovery, DISABLED_XEP_0030_Items_Info)
+#endif
{
shared_ptr<IXmppClient> client;
shared_ptr<IXmppStream> stream;
diff --git a/test/tcp_tests.cpp b/test/tcp_tests.cpp
index 70cace0..6c05329 100644
--- a/test/tcp_tests.cpp
+++ b/test/tcp_tests.cpp
@@ -44,7 +44,12 @@ using namespace std;
using namespace Iotivity;
using namespace Iotivity::Xmpp;
+
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(TcpConnection, XmppConnect)
+#else
+TEST(TcpConnection, DISABLED_XmppConnect)
+#endif
{
ProxyConfig proxy("proxy-us.intel.com", "1080", ProxyConfig::ProxyType::ProxySOCKS5);
TcpConnection testConnection(JABBERDAEMON_TEST_HOST, JABBERDAEMON_TEST_PORT, proxy);
@@ -59,7 +64,11 @@ TEST(TcpConnection, XmppConnect)
}
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(TcpConnection, SynchronousReadWrite)
+#else
+TEST(TcpConnection, DISABLED_SynchronousReadWrite)
+#endif
{
ProxyConfig proxy("proxy-us.intel.com", "1080", ProxyConfig::ProxyType::ProxySOCKS5);
TcpConnection testConnection(JABBERDAEMON_TEST_HOST, JABBERDAEMON_TEST_PORT, proxy);
@@ -70,7 +79,11 @@ TEST(TcpConnection, SynchronousReadWrite)
}
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(TcpConnection, AsynchronousReadWrite)
+#else
+TEST(TcpConnection, DISABLED_AsynchronousReadWrite)
+#endif
{
ProxyConfig proxy("proxy-us.intel.com", "1080", ProxyConfig::ProxyType::ProxySOCKS5);
TcpConnection testConnection(JABBERDAEMON_TEST_HOST, JABBERDAEMON_TEST_PORT, proxy);
diff --git a/test/xmpp_compliance_tests.cpp b/test/xmpp_compliance_tests.cpp
index 4002b11..4733d36 100644
--- a/test/xmpp_compliance_tests.cpp
+++ b/test/xmpp_compliance_tests.cpp
@@ -91,7 +91,11 @@ static const string SERVER_AUTH_SUCCESS = "<success xmlns=\"urn:ietf:params:xml:
// bind-gen [Client N/A]
// bind-mtn [Client MUST]
+#ifdef REGEX_SUPPORTED
TEST(Xmpp_Compliance, bind_mtn)
+#else
+TEST(Xmpp_Compliance, DISABLED_bind_mtn)
+#endif
{
// Verify that bind is generated in a normal negotation
SegmentArray normalSegments =
@@ -142,7 +146,11 @@ TEST(Xmpp_Compliance, bind_mtn)
}
// bind-restart [Client MUST]
+#ifdef REGEX_SUPPORTED
TEST(Xmpp_Compliance, bind_restart)
+#else
+TEST(Xmpp_Compliance, DISABLED_bind_restart)
+#endif
{
// Attempt a manual restart after the resource-bind completes.
SegmentArray normalSegments =
@@ -187,7 +195,11 @@ TEST(Xmpp_Compliance, bind_restart)
}
// bind-support [Client MUST]
+#ifdef REGEX_SUPPORTED
TEST(Xmpp_Compliance, bind_support)
+#else
+TEST(Xmpp_Compliance, DISABLED_bind_support)
+#endif
{
// Verify that bind support is present.
SegmentArray normalSegments =
diff --git a/test/xmpp_connect_establish.cpp b/test/xmpp_connect_establish.cpp
index 55d4be7..c4c7159 100644
--- a/test/xmpp_connect_establish.cpp
+++ b/test/xmpp_connect_establish.cpp
@@ -169,7 +169,7 @@ void xmpp_test_default_connect_client(shared_ptr<IXmppStream> &stream,
xmppStream = streamFuture.get();
if (xmppStream)
{
-#if __cplusplus>=201103L
+#if __cplusplus>=201103L || defined(_WIN32)
future_status status = xmppStream->whenNegotiated().wait_for(chrono::seconds(10));
if (status == future_status::ready)
#else
diff --git a/test/xmpp_dummy_server.cpp b/test/xmpp_dummy_server.cpp
index febc8e0..44b4e0b 100644
--- a/test/xmpp_dummy_server.cpp
+++ b/test/xmpp_dummy_server.cpp
@@ -355,7 +355,7 @@ void SegmentRunner::run(const SegmentArray &segments)
{
if (willCompleteNegotiation)
{
-#if __cplusplus>=201103L
+#if __cplusplus>=201103L || defined(_WIN32)
auto status = m_stream->whenNegotiated().wait_for(chrono::seconds(5));
EXPECT_EQ(status, future_status::ready);
diff --git a/test/xmpp_tests.cpp b/test/xmpp_tests.cpp
index 58ec503..0a2b393 100644
--- a/test/xmpp_tests.cpp
+++ b/test/xmpp_tests.cpp
@@ -114,7 +114,11 @@ TEST(XmppClient, XMPPConfig)
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(XmppClient, XMPP_StreamEstablish)
+#else
+TEST(XmppClient, DISABLED_XMPP_StreamEstablish)
+#endif
{
#ifdef ENABLE_LIBSTROPHE
if (!xmpp_connect_config::hasConfig("NO_PROXY"))
@@ -170,7 +174,7 @@ TEST(XmppClient, XMPP_StreamEstablish)
ASSERT_TRUE(xmppStream->whenNegotiated().valid());
auto status = xmppStream->whenNegotiated().wait_for(chrono::seconds(10));
-#if __cplusplus>=201103L
+#if __cplusplus>=201103L || defined(_WIN32)
EXPECT_EQ(status, future_status::ready);
if (status == future_status::ready)
#else
@@ -217,7 +221,11 @@ TEST(XmppClient, XMPP_StreamEstablish)
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(XmppClient, XMPP_StreamEstablish_Event_Callbacks)
+#else
+TEST(XmppClient, DISABLED_XMPP_StreamEstablish_Event_Callbacks)
+#endif
{
#ifdef ENABLE_LIBSTROPHE
@@ -333,7 +341,7 @@ TEST(XmppClient, XMPP_StreamEstablish_Event_Callbacks)
auto status1 = streamCallbackFuture.wait_for(chrono::seconds(5));
-#if __cplusplus>=201103L
+#if __cplusplus>=201103L || defined(_WIN32)
EXPECT_EQ(status1, future_status::ready);
if (status1 == future_status::ready)
#else
@@ -346,7 +354,7 @@ TEST(XmppClient, XMPP_StreamEstablish_Event_Callbacks)
streamCallbackFuture.get();
auto status2 = openCallbackFuture.wait_for(chrono::seconds(10));
-#if __cplusplus>=201103L
+#if __cplusplus>=201103L || defined(_WIN32)
EXPECT_EQ(status2, future_status::ready);
if (status2 == future_status::ready)
#else
@@ -365,7 +373,7 @@ TEST(XmppClient, XMPP_StreamEstablish_Event_Callbacks)
}
auto status3 = closedCallbackFuture.wait_for(chrono::seconds(5));
-#if __cplusplus>=201103L
+#if __cplusplus>=201103L || defined(_WIN32)
EXPECT_EQ(status3, future_status::ready);
if (status3 == future_status::ready)
#else
@@ -739,7 +747,7 @@ TEST(XmppClient, XMPP_StreamParseTests)
if (willCompleteNegotiation)
{
auto status = xmppStream->whenNegotiated().wait_for(chrono::seconds(5));
-#if __cplusplus>=201103L
+#if __cplusplus>=201103L || defined(_WIN32)
EXPECT_EQ(status, future_status::ready);
#else
EXPECT_TRUE(status);
@@ -818,7 +826,7 @@ TEST(XmppClient, DISABLED_Dummy_Chat_Test)
ASSERT_TRUE(xmppStream->whenNegotiated().valid());
auto status = xmppStream->whenNegotiated().wait_for(chrono::seconds(20));
-#if __cplusplus>=201103L
+#if __cplusplus>=201103L || defined(_WIN32)
EXPECT_EQ(status, future_status::ready);
if (status == future_status::ready)
#else
@@ -982,7 +990,11 @@ TEST(XmppClient, DISABLED_Dummy_Chat_Test)
}
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(XmppClient, XMPP_Request_ID_Generation)
+#else
+TEST(XmppClient, XMPP_Request_ID_Generation)
+#endif
{
if (!xmpp_connect_config::hasConfig())
{
@@ -1272,7 +1284,11 @@ TEST(XmppClient, XMPP_Sasl_Prep)
}
+#ifdef ENABLE_FUNCTIONAL_TESTING
TEST(XmppClient, XMPP_StreamEstablishOverBOSH)
+#else
+TEST(XmppClient, DISABLED_XMPP_StreamEstablishOverBOSH)
+#endif
{
auto remoteConnect = make_shared<HttpCurlConnection>(xmpp_connect_config::BOSHUrl());