From 181fc0eea371d9d155e8a003a48c989f383faad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg-Christian=20B=C3=B6hme?= Date: Sun, 4 Mar 2018 21:26:08 +0100 Subject: [PATCH] Fix unit tests for android build --- Foundation/testsuite/src/NamedEventTest.cpp | 8 ++++---- Foundation/testsuite/src/NamedMutexTest.cpp | 6 +++--- Foundation/testsuite/src/ProcessTest.cpp | 10 +++++----- MongoDB/testsuite/src/MongoDBTest.cpp | 6 +++--- Net/testsuite/src/ICMPClientTest.cpp | 4 ++-- Net/testsuite/src/MulticastSocketTest.cpp | 2 +- Net/testsuite/src/NTPClientTest.cpp | 2 +- Net/testsuite/src/NetworkInterfaceTest.cpp | 16 ++++++++-------- Net/testsuite/src/SocketTest.cpp | 2 +- Redis/testsuite/src/RedisTest.cpp | 2 +- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Foundation/testsuite/src/NamedEventTest.cpp b/Foundation/testsuite/src/NamedEventTest.cpp index 2bd49b037..f8dbf80a6 100644 --- a/Foundation/testsuite/src/NamedEventTest.cpp +++ b/Foundation/testsuite/src/NamedEventTest.cpp @@ -71,12 +71,12 @@ void NamedEventTest::testNamedEvent() } catch(Poco::NotImplementedException e) { -#ifndef POCO_ANDROID +#if POCO_OS != POCO_OS_ANDROID throw e; #endif } thr1.join(); -#ifndef POCO_ANDROID +#if POCO_OS != POCO_OS_ANDROID assert (te.timestamp() > now); #endif Thread thr2; @@ -88,12 +88,12 @@ void NamedEventTest::testNamedEvent() } catch(Poco::NotImplementedException e) { -#ifndef POCO_ANDROID +#if POCO_OS != POCO_OS_ANDROID throw e; #endif } thr2.join(); -#ifndef POCO_ANDROID +#if POCO_OS != POCO_OS_ANDROID assert (te.timestamp() > now); #endif } diff --git a/Foundation/testsuite/src/NamedMutexTest.cpp b/Foundation/testsuite/src/NamedMutexTest.cpp index 75a2afd34..892400866 100644 --- a/Foundation/testsuite/src/NamedMutexTest.cpp +++ b/Foundation/testsuite/src/NamedMutexTest.cpp @@ -100,7 +100,7 @@ void NamedMutexTest::testLock() } catch(Poco::NotImplementedException e) { -#ifndef POCO_ANDROID +#if POCO_OS != POCO_OS_ANDROID throw e; #endif } @@ -113,7 +113,7 @@ void NamedMutexTest::testTryLock() TestTryLock ttl1; thr1.start(ttl1); thr1.join(); -#ifndef POCO_ANDROID +#if POCO_OS != POCO_OS_ANDROID assert (ttl1.locked()); #endif try { @@ -127,7 +127,7 @@ void NamedMutexTest::testTryLock() } catch(Poco::NotImplementedException e) { -#ifndef POCO_ANDROID +#if POCO_OS != POCO_OS_ANDROID throw e; #endif } diff --git a/Foundation/testsuite/src/ProcessTest.cpp b/Foundation/testsuite/src/ProcessTest.cpp index cba644054..bcf8e8812 100644 --- a/Foundation/testsuite/src/ProcessTest.cpp +++ b/Foundation/testsuite/src/ProcessTest.cpp @@ -37,7 +37,7 @@ void ProcessTest::testLaunch() { std::string name("TestApp"); std::string cmd; -#if defined(_DEBUG) && !(defined(POCO_ANDROID)) +#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID) name += "d"; #endif @@ -67,7 +67,7 @@ void ProcessTest::testLaunchRedirectIn() #if !defined(_WIN32_WCE) std::string name("TestApp"); std::string cmd; -#if defined(_DEBUG) && !(defined(POCO_ANDROID)) +#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID) name += "d"; #endif @@ -96,7 +96,7 @@ void ProcessTest::testLaunchRedirectOut() #if !defined(_WIN32_WCE) std::string name("TestApp"); std::string cmd; -#if defined(_DEBUG) && !(defined(POCO_ANDROID)) +#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID) name += "d"; #endif @@ -127,7 +127,7 @@ void ProcessTest::testLaunchEnv() #if !defined(_WIN32_WCE) std::string name("TestApp"); std::string cmd; -#if defined(_DEBUG) && !(defined(POCO_ANDROID)) +#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID) name += "d"; #endif @@ -213,7 +213,7 @@ void ProcessTest::testIsRunning() #if !defined(_WIN32_WCE) std::string name("TestApp"); std::string cmd; -#if defined(_DEBUG) && !(defined(POCO_ANDROID)) +#if defined(_DEBUG) && (POCO_OS != POCO_OS_ANDROID) name += "d"; #endif diff --git a/MongoDB/testsuite/src/MongoDBTest.cpp b/MongoDB/testsuite/src/MongoDBTest.cpp index 9b5dc2b3e..ddb48041c 100644 --- a/MongoDB/testsuite/src/MongoDBTest.cpp +++ b/MongoDB/testsuite/src/MongoDBTest.cpp @@ -291,7 +291,7 @@ void MongoDBTest::testBuildInfo() void MongoDBTest::testConnectionPool() { -#ifdef POCO_ANDROID +#if POCO_OS == POCO_OS_ANDROID std::string host = "10.0.2.2"; #else std::string host = "127.0.0.1"; @@ -406,7 +406,7 @@ void MongoDBTest::testConnectURI() Poco::MongoDB::Connection conn; Poco::MongoDB::Connection::SocketFactory sf; -#ifdef POCO_ANDROID +#if POCO_OS == POCO_OS_ANDROID std::string host = "10.0.2.2"; #else std::string host = "127.0.0.1"; @@ -454,7 +454,7 @@ void MongoDBTest::testConnectURI() CppUnit::Test* MongoDBTest::suite() { -#ifdef POCO_ANDROID +#if POCO_OS == POCO_OS_ANDROID std::string host = "10.0.2.2"; #else std::string host = "127.0.0.1"; diff --git a/Net/testsuite/src/ICMPClientTest.cpp b/Net/testsuite/src/ICMPClientTest.cpp index e2c78689c..af9422f51 100644 --- a/Net/testsuite/src/ICMPClientTest.cpp +++ b/Net/testsuite/src/ICMPClientTest.cpp @@ -52,7 +52,7 @@ void ICMPClientTest::testPing() registerDelegates(icmpClient); assert(icmpClient.ping("127.0.0.1") > 0); -#ifdef POCO_ANDROID +#if POCO_OS == POCO_OS_ANDROID assert(icmpClient.ping("10.0.2.15", 4) > 0); assert(icmpClient.ping("10.0.2.2", 4) > 0); #else @@ -77,7 +77,7 @@ void ICMPClientTest::testBigPing() registerDelegates(icmpClient); assert(icmpClient.ping("127.0.0.1", 1) > 0); -#ifdef POCO_ANDROID +#if POCO_OS == POCO_OS_ANDROID assert(icmpClient.ping("10.0.2.15", 4) > 0); assert(icmpClient.ping("10.0.2.2", 4) > 0); #else diff --git a/Net/testsuite/src/MulticastSocketTest.cpp b/Net/testsuite/src/MulticastSocketTest.cpp index 87892a6bf..3232086f5 100644 --- a/Net/testsuite/src/MulticastSocketTest.cpp +++ b/Net/testsuite/src/MulticastSocketTest.cpp @@ -60,7 +60,7 @@ void MulticastSocketTest::testMulticast() } catch(Poco::NotImplementedException e) { -#ifndef POCO_ANDROID +#if POCO_OS != POCO_OS_ANDROID throw e; #endif } diff --git a/Net/testsuite/src/NTPClientTest.cpp b/Net/testsuite/src/NTPClientTest.cpp index fe5687e5f..976ee86c8 100644 --- a/Net/testsuite/src/NTPClientTest.cpp +++ b/Net/testsuite/src/NTPClientTest.cpp @@ -48,7 +48,7 @@ NTPClientTest::~NTPClientTest() void NTPClientTest::testTimeSync() { -#ifndef POCO_ANDROID +#if POCO_OS != POCO_OS_ANDROID if (ICMPClient::pingIPv4("pool.ntp.org") <= 0) { std::cerr << "pool.ntp.org not accessibe, test skipped" << std::endl; diff --git a/Net/testsuite/src/NetworkInterfaceTest.cpp b/Net/testsuite/src/NetworkInterfaceTest.cpp index 7d147f842..18943f682 100644 --- a/Net/testsuite/src/NetworkInterfaceTest.cpp +++ b/Net/testsuite/src/NetworkInterfaceTest.cpp @@ -77,7 +77,7 @@ void NetworkInterfaceTest::testMap() } catch(Poco::NotImplementedException e) { - #ifndef POCO_ANDROID + #if POCO_OS != POCO_OS_ANDROID throw e; #endif } @@ -121,7 +121,7 @@ void NetworkInterfaceTest::testList() } catch(Poco::NotImplementedException e) { - #ifndef POCO_ANDROID + #if POCO_OS != POCO_OS_ANDROID throw e; #endif } @@ -141,7 +141,7 @@ void NetworkInterfaceTest::testForName() } catch(Poco::NotImplementedException e) { - #ifndef POCO_ANDROID + #if POCO_OS != POCO_OS_ANDROID throw e; #endif } @@ -186,7 +186,7 @@ void NetworkInterfaceTest::testForAddress() } catch(Poco::NotImplementedException e) { - #ifndef POCO_ANDROID + #if POCO_OS != POCO_OS_ANDROID throw e; #endif } @@ -206,7 +206,7 @@ void NetworkInterfaceTest::testForIndex() } catch(Poco::NotImplementedException e) { - #ifndef POCO_ANDROID + #if POCO_OS != POCO_OS_ANDROID throw e; #endif } @@ -233,7 +233,7 @@ void NetworkInterfaceTest::testMapIpOnly() } catch(Poco::NotImplementedException e) { - #ifndef POCO_ANDROID + #if POCO_OS != POCO_OS_ANDROID throw e; #endif } @@ -253,7 +253,7 @@ void NetworkInterfaceTest::testMapUpOnly() } catch(Poco::NotImplementedException e) { - #ifndef POCO_ANDROID + #if POCO_OS != POCO_OS_ANDROID throw e; #endif } @@ -300,7 +300,7 @@ void NetworkInterfaceTest::testListMapConformance() } catch(Poco::NotImplementedException e) { - #ifndef POCO_ANDROID + #if POCO_OS != POCO_OS_ANDROID throw e; #endif } diff --git a/Net/testsuite/src/SocketTest.cpp b/Net/testsuite/src/SocketTest.cpp index 20f19c619..406a87c13 100644 --- a/Net/testsuite/src/SocketTest.cpp +++ b/Net/testsuite/src/SocketTest.cpp @@ -503,7 +503,7 @@ void SocketTest::testSelect3() void SocketTest::testEchoUnixLocal() { #if defined(POCO_OS_FAMILY_UNIX) -#if defined(POCO_ANDROID) +#if POCO_OS == POCO_OS_ANDROID Poco::File socketFile("/data/local/tmp/SocketTest.sock"); #else Poco::File socketFile("/tmp/SocketTest.sock"); diff --git a/Redis/testsuite/src/RedisTest.cpp b/Redis/testsuite/src/RedisTest.cpp index 063940f72..ff3dd591d 100644 --- a/Redis/testsuite/src/RedisTest.cpp +++ b/Redis/testsuite/src/RedisTest.cpp @@ -32,7 +32,7 @@ RedisTest::RedisTest(const std::string& name): _host("localhost"), _port(6379) { -#ifdef POCO_ANDROID +#if POCO_OS == POCO_OS_ANDROID _host = "10.0.2.2"; #endif if (!_connected)