Re-enabling socket tests that were previously flaky.
It's assumed that these tests were flaky because they used a non-virtual resource (sockets) and were being run in parallel. So this should be fixed now that these tests are now not being run in parallel, thanks to this CL: https://codereview.webrtc.org/1426643003 BUG=webrtc:4923 R=pthatcher@webrtc.org Review URL: https://codereview.webrtc.org/1982733002 . Cr-Commit-Position: refs/heads/master@{#12817}
This commit is contained in:
parent
7d01331eca
commit
2b3bf6b7d5
@ -345,7 +345,7 @@ void MessageQueue::PostAt(uint32_t tstamp,
|
||||
uint32_t id,
|
||||
MessageData* pdata) {
|
||||
// This should work even if it is used (unexpectedly).
|
||||
int delay = static_cast<uint32_t>(TimeMillis()) - tstamp;
|
||||
int64_t delay = static_cast<uint32_t>(TimeMillis()) - tstamp;
|
||||
return DoDelayPost(delay, tstamp, phandler, id, pdata);
|
||||
}
|
||||
|
||||
@ -356,13 +356,14 @@ void MessageQueue::PostAt(int64_t tstamp,
|
||||
return DoDelayPost(TimeUntil(tstamp), tstamp, phandler, id, pdata);
|
||||
}
|
||||
|
||||
void MessageQueue::DoDelayPost(int cmsDelay,
|
||||
void MessageQueue::DoDelayPost(int64_t cmsDelay,
|
||||
int64_t tstamp,
|
||||
MessageHandler* phandler,
|
||||
uint32_t id,
|
||||
MessageData* pdata) {
|
||||
if (fStop_)
|
||||
if (fStop_) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Keep thread safe
|
||||
// Add to the priority queue. Gets sorted soonest first.
|
||||
|
||||
@ -152,7 +152,10 @@ typedef std::list<Message> MessageList;
|
||||
|
||||
class DelayedMessage {
|
||||
public:
|
||||
DelayedMessage(int delay, int64_t trigger, uint32_t num, const Message& msg)
|
||||
DelayedMessage(int64_t delay,
|
||||
int64_t trigger,
|
||||
uint32_t num,
|
||||
const Message& msg)
|
||||
: cmsDelay_(delay), msTrigger_(trigger), num_(num), msg_(msg) {}
|
||||
|
||||
bool operator< (const DelayedMessage& dmsg) const {
|
||||
@ -160,7 +163,7 @@ class DelayedMessage {
|
||||
|| ((dmsg.msTrigger_ == msTrigger_) && (dmsg.num_ < num_));
|
||||
}
|
||||
|
||||
int cmsDelay_; // for debugging
|
||||
int64_t cmsDelay_; // for debugging
|
||||
int64_t msTrigger_;
|
||||
uint32_t num_;
|
||||
Message msg_;
|
||||
@ -254,7 +257,7 @@ class MessageQueue {
|
||||
void reheap() { make_heap(c.begin(), c.end(), comp); }
|
||||
};
|
||||
|
||||
void DoDelayPost(int cmsDelay,
|
||||
void DoDelayPost(int64_t cmsDelay,
|
||||
int64_t tstamp,
|
||||
MessageHandler* phandler,
|
||||
uint32_t id,
|
||||
|
||||
@ -17,6 +17,13 @@
|
||||
#include <ws2tcpip.h>
|
||||
#include "webrtc/base/win32.h"
|
||||
#endif
|
||||
#if defined(WEBRTC_POSIX) && !defined(__native_client__)
|
||||
#if defined(WEBRTC_ANDROID)
|
||||
#include "webrtc/base/ifaddrs-android.h"
|
||||
#else
|
||||
#include <ifaddrs.h>
|
||||
#endif
|
||||
#endif // defined(WEBRTC_POSIX) && !defined(__native_client__)
|
||||
|
||||
#include "webrtc/base/byteorder.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
@ -118,10 +125,7 @@ int inet_pton(int af, const char* src, void *dst) {
|
||||
}
|
||||
|
||||
bool HasIPv6Enabled() {
|
||||
#if !defined(WEBRTC_WIN)
|
||||
// We only need to check this for Windows XP (so far).
|
||||
return true;
|
||||
#else
|
||||
#if defined(WEBRTC_WIN)
|
||||
if (IsWindowsVistaOrLater()) {
|
||||
return true;
|
||||
}
|
||||
@ -157,6 +161,22 @@ bool HasIPv6Enabled() {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
#elif defined(WEBRTC_POSIX) && !defined(__native_client__)
|
||||
bool has_ipv6 = false;
|
||||
struct ifaddrs* ifa;
|
||||
if (getifaddrs(&ifa) < 0) {
|
||||
return false;
|
||||
}
|
||||
for (struct ifaddrs* cur = ifa; cur != nullptr; cur = cur->ifa_next) {
|
||||
if (cur->ifa_addr->sa_family == AF_INET6) {
|
||||
has_ipv6 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
freeifaddrs(ifa);
|
||||
return has_ipv6;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
} // namespace rtc
|
||||
|
||||
@ -21,6 +21,12 @@
|
||||
|
||||
namespace rtc {
|
||||
|
||||
#define MAYBE_SKIP_IPV6 \
|
||||
if (!HasIPv6Enabled()) { \
|
||||
LOG(LS_INFO) << "No IPv6... skipping"; \
|
||||
return; \
|
||||
}
|
||||
|
||||
class PhysicalSocketTest;
|
||||
|
||||
class FakeSocketDispatcher : public SocketDispatcher {
|
||||
@ -145,13 +151,7 @@ TEST_F(PhysicalSocketTest, TestConnectIPv4) {
|
||||
SocketTest::TestConnectIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestConnectIPv6 DISABLED_TestConnectIPv6
|
||||
#else
|
||||
#define MAYBE_TestConnectIPv6 TestConnectIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestConnectIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestConnectIPv6) {
|
||||
SocketTest::TestConnectIPv6();
|
||||
}
|
||||
|
||||
@ -243,13 +243,8 @@ TEST_F(PhysicalSocketTest, TestConnectAcceptErrorIPv4) {
|
||||
ConnectInternalAcceptError(kIPv4Loopback);
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestConnectAcceptErrorIPv6 DISABLED_TestConnectAcceptErrorIPv6
|
||||
#else
|
||||
#define MAYBE_TestConnectAcceptErrorIPv6 TestConnectAcceptErrorIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestConnectAcceptErrorIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestConnectAcceptErrorIPv6) {
|
||||
MAYBE_SKIP_IPV6;
|
||||
ConnectInternalAcceptError(kIPv6Loopback);
|
||||
}
|
||||
|
||||
@ -268,25 +263,12 @@ TEST_F(PhysicalSocketTest, TestWritableAfterPartialWriteIPv4) {
|
||||
WritableAfterPartialWrite(kIPv4Loopback);
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestWritableAfterPartialWriteIPv6 \
|
||||
DISABLED_TestWritableAfterPartialWriteIPv6
|
||||
#else
|
||||
#define MAYBE_TestWritableAfterPartialWriteIPv6 \
|
||||
TestWritableAfterPartialWriteIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestWritableAfterPartialWriteIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestWritableAfterPartialWriteIPv6) {
|
||||
MAYBE_SKIP_IPV6;
|
||||
WritableAfterPartialWrite(kIPv6Loopback);
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestConnectFailIPv6 DISABLED_TestConnectFailIPv6
|
||||
#else
|
||||
#define MAYBE_TestConnectFailIPv6 TestConnectFailIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestConnectFailIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestConnectFailIPv6) {
|
||||
SocketTest::TestConnectFailIPv6();
|
||||
}
|
||||
|
||||
@ -294,15 +276,7 @@ TEST_F(PhysicalSocketTest, TestConnectWithDnsLookupFailIPv4) {
|
||||
SocketTest::TestConnectWithDnsLookupFailIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestConnectWithDnsLookupFailIPv6 \
|
||||
DISABLED_TestConnectWithDnsLookupFailIPv6
|
||||
#else
|
||||
#define MAYBE_TestConnectWithDnsLookupFailIPv6 \
|
||||
TestConnectWithDnsLookupFailIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestConnectWithDnsLookupFailIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestConnectWithDnsLookupFailIPv6) {
|
||||
SocketTest::TestConnectWithDnsLookupFailIPv6();
|
||||
}
|
||||
|
||||
@ -311,14 +285,7 @@ TEST_F(PhysicalSocketTest, TestConnectWithClosedSocketIPv4) {
|
||||
SocketTest::TestConnectWithClosedSocketIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestConnectWithClosedSocketIPv6 \
|
||||
DISABLED_TestConnectWithClosedSocketIPv6
|
||||
#else
|
||||
#define MAYBE_TestConnectWithClosedSocketIPv6 TestConnectWithClosedSocketIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestConnectWithClosedSocketIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestConnectWithClosedSocketIPv6) {
|
||||
SocketTest::TestConnectWithClosedSocketIPv6();
|
||||
}
|
||||
|
||||
@ -326,14 +293,7 @@ TEST_F(PhysicalSocketTest, TestConnectWhileNotClosedIPv4) {
|
||||
SocketTest::TestConnectWhileNotClosedIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestConnectWhileNotClosedIPv6 \
|
||||
DISABLED_TestConnectWhileNotClosedIPv6
|
||||
#else
|
||||
#define MAYBE_TestConnectWhileNotClosedIPv6 TestConnectWhileNotClosedIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestConnectWhileNotClosedIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestConnectWhileNotClosedIPv6) {
|
||||
SocketTest::TestConnectWhileNotClosedIPv6();
|
||||
}
|
||||
|
||||
@ -341,14 +301,7 @@ TEST_F(PhysicalSocketTest, TestServerCloseDuringConnectIPv4) {
|
||||
SocketTest::TestServerCloseDuringConnectIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestServerCloseDuringConnectIPv6 \
|
||||
DISABLED_TestServerCloseDuringConnectIPv6
|
||||
#else
|
||||
#define MAYBE_TestServerCloseDuringConnectIPv6 TestServerCloseDuringConnectIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestServerCloseDuringConnectIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestServerCloseDuringConnectIPv6) {
|
||||
SocketTest::TestServerCloseDuringConnectIPv6();
|
||||
}
|
||||
|
||||
@ -356,14 +309,7 @@ TEST_F(PhysicalSocketTest, TestClientCloseDuringConnectIPv4) {
|
||||
SocketTest::TestClientCloseDuringConnectIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestClientCloseDuringConnectIPv6 \
|
||||
DISABLED_TestClientCloseDuringConnectIPv6
|
||||
#else
|
||||
#define MAYBE_TestClientCloseDuringConnectIPv6 TestClientCloseDuringConnectIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestClientCloseDuringConnectIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestClientCloseDuringConnectIPv6) {
|
||||
SocketTest::TestClientCloseDuringConnectIPv6();
|
||||
}
|
||||
|
||||
@ -371,13 +317,7 @@ TEST_F(PhysicalSocketTest, TestServerCloseIPv4) {
|
||||
SocketTest::TestServerCloseIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestServerCloseIPv6 DISABLED_TestServerCloseIPv6
|
||||
#else
|
||||
#define MAYBE_TestServerCloseIPv6 TestServerCloseIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestServerCloseIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestServerCloseIPv6) {
|
||||
SocketTest::TestServerCloseIPv6();
|
||||
}
|
||||
|
||||
@ -385,14 +325,7 @@ TEST_F(PhysicalSocketTest, TestCloseInClosedCallbackIPv4) {
|
||||
SocketTest::TestCloseInClosedCallbackIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestCloseInClosedCallbackIPv6 \
|
||||
DISABLED_TestCloseInClosedCallbackIPv6
|
||||
#else
|
||||
#define MAYBE_TestCloseInClosedCallbackIPv6 TestCloseInClosedCallbackIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestCloseInClosedCallbackIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestCloseInClosedCallbackIPv6) {
|
||||
SocketTest::TestCloseInClosedCallbackIPv6();
|
||||
}
|
||||
|
||||
@ -400,13 +333,7 @@ TEST_F(PhysicalSocketTest, TestSocketServerWaitIPv4) {
|
||||
SocketTest::TestSocketServerWaitIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestSocketServerWaitIPv6 DISABLED_TestSocketServerWaitIPv6
|
||||
#else
|
||||
#define MAYBE_TestSocketServerWaitIPv6 TestSocketServerWaitIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestSocketServerWaitIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestSocketServerWaitIPv6) {
|
||||
SocketTest::TestSocketServerWaitIPv6();
|
||||
}
|
||||
|
||||
@ -414,13 +341,7 @@ TEST_F(PhysicalSocketTest, TestTcpIPv4) {
|
||||
SocketTest::TestTcpIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestTcpIPv6 DISABLED_TestTcpIPv6
|
||||
#else
|
||||
#define MAYBE_TestTcpIPv6 TestTcpIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestTcpIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestTcpIPv6) {
|
||||
SocketTest::TestTcpIPv6();
|
||||
}
|
||||
|
||||
@ -428,13 +349,7 @@ TEST_F(PhysicalSocketTest, TestUdpIPv4) {
|
||||
SocketTest::TestUdpIPv4();
|
||||
}
|
||||
|
||||
// Crashes on Linux. See webrtc:4923.
|
||||
#if defined(WEBRTC_LINUX)
|
||||
#define MAYBE_TestUdpIPv6 DISABLED_TestUdpIPv6
|
||||
#else
|
||||
#define MAYBE_TestUdpIPv6 TestUdpIPv6
|
||||
#endif
|
||||
TEST_F(PhysicalSocketTest, MAYBE_TestUdpIPv6) {
|
||||
TEST_F(PhysicalSocketTest, TestUdpIPv6) {
|
||||
SocketTest::TestUdpIPv6();
|
||||
}
|
||||
|
||||
|
||||
@ -24,15 +24,14 @@
|
||||
|
||||
namespace rtc {
|
||||
|
||||
// Data size to be used in TcpInternal tests.
|
||||
static const size_t kTcpInternalDataSize = 1024 * 1024; // bytes
|
||||
|
||||
#define MAYBE_SKIP_IPV6 \
|
||||
if (!HasIPv6Enabled()) { \
|
||||
LOG(LS_INFO) << "No IPv6... skipping"; \
|
||||
return; \
|
||||
}
|
||||
|
||||
// Data size to be used in TcpInternal tests.
|
||||
static const size_t kTcpInternalDataSize = 1024 * 1024; // bytes
|
||||
|
||||
void SocketTest::TestConnectIPv4() {
|
||||
ConnectInternal(kIPv4Loopback);
|
||||
|
||||
@ -34,9 +34,10 @@ TestClient::~TestClient() {
|
||||
|
||||
bool TestClient::CheckConnState(AsyncPacketSocket::State state) {
|
||||
// Wait for our timeout value until the socket reaches the desired state.
|
||||
uint32_t end = TimeAfter(kTimeoutMs);
|
||||
while (socket_->GetState() != state && TimeUntil(end) > 0)
|
||||
int64_t end = TimeAfter(kTimeoutMs);
|
||||
while (socket_->GetState() != state && TimeUntil(end) > 0) {
|
||||
Thread::Current()->ProcessMessages(1);
|
||||
}
|
||||
return (socket_->GetState() == state);
|
||||
}
|
||||
|
||||
@ -63,7 +64,7 @@ TestClient::Packet* TestClient::NextPacket(int timeout_ms) {
|
||||
// Pumping another thread's queue could lead to messages being dispatched from
|
||||
// the wrong thread to non-thread-safe objects.
|
||||
|
||||
uint32_t end = TimeAfter(timeout_ms);
|
||||
int64_t end = TimeAfter(timeout_ms);
|
||||
while (TimeUntil(end) > 0) {
|
||||
{
|
||||
CritScope cs(&crit_);
|
||||
|
||||
@ -502,7 +502,7 @@ bool Thread::ProcessMessages(int cmsLoop) {
|
||||
Dispatch(&msg);
|
||||
|
||||
if (cmsLoop != kForever) {
|
||||
cmsNext = TimeUntil(msEnd);
|
||||
cmsNext = static_cast<int>(TimeUntil(msEnd));
|
||||
if (cmsNext < 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user