Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ad4c369 authored by Josh Gao's avatar Josh Gao
Browse files

adb: win32: silence wine test failure.

Wine implements sockets with their own internal socketpair, which
results in the poll disconnect test failing.

Bug: http://b/117568356
Test: wine adb_test.exe
Change-Id: Icd2a94f8297fefd5c02e6517568fe288b168032c
parent efd8ae2d
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -25,6 +25,21 @@
#include "sysdeps.h"
#include "sysdeps/chrono.h"

#if defined(_WIN32)
#include <windows.h>
static bool IsWine() {
    HMODULE ntdll = GetModuleHandleW(L"ntdll.dll");
    if (!ntdll) {
        return false;
    }
    return GetProcAddress(ntdll, "wine_get_version") != nullptr;
}
#else
static bool IsWine() {
    return false;
}
#endif

TEST(sysdeps_socketpair, smoke) {
    int fds[2];
    ASSERT_EQ(0, adb_socketpair(fds)) << strerror(errno);
@@ -182,9 +197,11 @@ TEST_F(sysdeps_poll, disconnect) {

    EXPECT_EQ(1, adb_poll(&pfd, 1, 100));

    if (!IsWine()) {
        // Linux returns POLLIN | POLLHUP, Windows returns just POLLHUP.
        EXPECT_EQ(POLLHUP, pfd.revents & POLLHUP);
    }
}

TEST_F(sysdeps_poll, fd_count) {
    // https://code.google.com/p/android/issues/detail?id=12141