Skip to content

Commit d7aee33

Browse files
committed
[llvm][Windows] Don't run socket tests on old versions of Windows
AF_UNIX sockets were added to Windows 10 build 17063 in 2017, older versions of Windows will fail this test. Also add a lit config so lit tests using sockets can do: // REQUIRES: unix-sockets (It would be cool if unit tests could use lit available_features) Also fix llvm-config test that didn't fail when new libs are added.
1 parent de8ee03 commit d7aee33

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

llvm/test/lit.cfg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,9 @@ def have_ld64_plugin_support():
572572
if "hw.optional.fma: 1" in result:
573573
config.available_features.add("fma3")
574574

575+
if not hasattr(sys, "getwindowsversion") or sys.getwindowsversion().build >= 17063:
576+
config.available_features.add("unix-sockets")
577+
575578
# .debug_frame is not emitted for targeting Windows x64, aarch64/arm64, AIX, or Apple Silicon Mac.
576579
if not re.match(
577580
r"^(x86_64|aarch64|arm64|powerpc|powerpc64).*-(windows-gnu|windows-msvc|aix)",

llvm/test/tools/llvm-config/system-libs.windows.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ RUN: llvm-config --link-static --system-libs Support 2>&1 | FileCheck %s
22
REQUIRES: static-libs
33
REQUIRES: host={{.*-windows-msvc}}
44
CHECK-NOT: -l
5-
CHECK: psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib
5+
CHECK: psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib Ws2_32.lib{{$}}
66
CHECK-NOT: error
77
CHECK-NOT: warning

llvm/unittests/Support/raw_socket_stream_test.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,27 @@
1010
#include <iostream>
1111
#include <stdlib.h>
1212

13+
#ifdef _WIN32
14+
#include "llvm/Support/Windows/WindowsSupport.h"
15+
#endif
16+
1317
using namespace llvm;
1418

1519
namespace {
1620

21+
bool hasUnixSocketSupport() {
22+
#ifdef _WIN32
23+
VersionTuple Ver = GetWindowsOSVersion();
24+
if (Ver < VersionTuple(10, 0, 0, 17063))
25+
return false;
26+
#endif
27+
return true;
28+
}
29+
1730
TEST(raw_socket_streamTest, CLIENT_TO_SERVER_AND_SERVER_TO_CLIENT) {
31+
if (!hasUnixSocketSupport())
32+
GTEST_SKIP();
33+
1834
SmallString<100> SocketPath;
1935
llvm::sys::fs::createUniquePath("test_raw_socket_stream.sock", SocketPath,
2036
true);

0 commit comments

Comments
 (0)