diff --git a/AK/Time.h b/AK/Time.h index 967b9c13912..b7c2ed32553 100644 --- a/AK/Time.h +++ b/AK/Time.h @@ -13,9 +13,10 @@ #include #include #ifdef AK_OS_WINDOWS +// https://learn.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-timeval struct timeval { - long tv_sec; - long tv_usec; + long tv_sec { 0 }; + long tv_usec { 0 }; }; #else # include diff --git a/Libraries/CMakeLists.txt b/Libraries/CMakeLists.txt index 921cef93f70..afe56a5c5c3 100644 --- a/Libraries/CMakeLists.txt +++ b/Libraries/CMakeLists.txt @@ -1,3 +1,14 @@ +add_subdirectory(LibRegex) +add_subdirectory(LibTest) +add_subdirectory(LibTextCodec) +add_subdirectory(LibUnicode) +add_subdirectory(LibURL) + +# FIXME: Increase support for building targets on Windows +if (WIN32 AND ENABLE_WINDOWS_CI) + return() +endif() + add_subdirectory(LibCompress) add_subdirectory(LibCrypto) add_subdirectory(LibDiff) @@ -7,16 +18,11 @@ add_subdirectory(LibHTTP) add_subdirectory(LibIPC) add_subdirectory(LibJS) add_subdirectory(LibLine) -add_subdirectory(LibRegex) add_subdirectory(LibRequests) add_subdirectory(LibRIFF) add_subdirectory(LibSyntax) -add_subdirectory(LibTest) -add_subdirectory(LibTextCodec) add_subdirectory(LibThreading) add_subdirectory(LibTLS) -add_subdirectory(LibUnicode) -add_subdirectory(LibURL) add_subdirectory(LibWasm) add_subdirectory(LibWebSocket) add_subdirectory(LibXML) diff --git a/Libraries/LibTest/CMakeLists.txt b/Libraries/LibTest/CMakeLists.txt index 12793f5bffa..c58bea2cd7b 100644 --- a/Libraries/LibTest/CMakeLists.txt +++ b/Libraries/LibTest/CMakeLists.txt @@ -2,8 +2,6 @@ add_library(LibTestMain OBJECT TestMain.cpp AssertionHandler.cpp) target_link_libraries(LibTestMain PUBLIC GenericClangPlugin) -add_library(JavaScriptTestRunnerMain OBJECT JavaScriptTestRunnerMain.cpp) - set(SOURCES TestSuite.cpp ) @@ -12,3 +10,10 @@ add_library(LibTest ${SOURCES}) lagom_generate_export_header(LibTest test) target_link_libraries(LibTest PRIVATE AK LibCore LibFileSystem) set_target_properties(LibTest PROPERTIES OUTPUT_NAME lagom-test) + +# FIXME: Increase support for building targets on Windows +if (WIN32 AND ENABLE_WINDOWS_CI) + return() +endif() + +add_library(JavaScriptTestRunnerMain OBJECT JavaScriptTestRunnerMain.cpp) diff --git a/Tests/AK/CMakeLists.txt b/Tests/AK/CMakeLists.txt index e94d82b5209..a36e4a20469 100644 --- a/Tests/AK/CMakeLists.txt +++ b/Tests/AK/CMakeLists.txt @@ -20,6 +20,7 @@ set(AK_TEST_SOURCES TestDisjointChunks.cpp TestDistinctNumeric.cpp TestDoublyLinkedList.cpp + TestDuration.cpp TestEndian.cpp TestEnumBits.cpp TestEnumerate.cpp @@ -44,7 +45,6 @@ set(AK_TEST_SOURCES TestIntrusiveRedBlackTree.cpp TestJSON.cpp TestLEB128.cpp - TestLexicalPath.cpp TestMemory.cpp TestMemoryStream.cpp TestNeverDestroyed.cpp @@ -70,7 +70,6 @@ set(AK_TEST_SOURCES TestStringFloatingPointConversions.cpp TestStringUtils.cpp TestStringView.cpp - TestDuration.cpp TestTrie.cpp TestTuple.cpp TestTypeTraits.cpp @@ -83,10 +82,21 @@ set(AK_TEST_SOURCES TestWeakPtr.cpp ) +# FIXME: LexicalPathWindows has some parenting and path parts sizing inconsistencies with LexicalPath, so it deserves +# it's own platform-specific tests to avoid if-def soup in the Unix-based tests. +if(NOT WIN32) + list(APPEND AK_TEST_SOURCES TestLexicalPath.cpp) +endif() + foreach(source IN LISTS AK_TEST_SOURCES) serenity_test("${source}" AK) endforeach() +if (WIN32) + # FIXME: Windows on ARM + target_link_libraries(TestUFixedBigInt PRIVATE clang_rt.builtins-x86_64.lib) +endif() + if (CXX_COMPILER_SUPPORTS_BLOCKS) serenity_test(TestFunction.mm AK NAME TestFunction) target_link_libraries(TestFunction PRIVATE ${BLOCKS_REQUIRED_LIBRARIES}) diff --git a/Tests/AK/TestDuration.cpp b/Tests/AK/TestDuration.cpp index 7b7feebaa96..f9b7952dc19 100644 --- a/Tests/AK/TestDuration.cpp +++ b/Tests/AK/TestDuration.cpp @@ -7,11 +7,10 @@ #include #include -#include using AK::Duration; -#if defined(__TIMESIZE) && __TIMESIZE < 64 +#if (defined(__TIMESIZE) && __TIMESIZE < 64) || defined(AK_OS_WINDOWS) // NOTE: See AK/Time.h, on Windows we hardcode to long's for timeval # define TIME_T_IS_32BIT #endif diff --git a/Tests/AK/TestFormat.cpp b/Tests/AK/TestFormat.cpp index 427cd765472..e9678ba35d6 100644 --- a/Tests/AK/TestFormat.cpp +++ b/Tests/AK/TestFormat.cpp @@ -9,8 +9,10 @@ #include #include #include -#include -#include + +#ifdef AK_OS_WINDOWS +# include +#endif TEST_CASE(is_integral_works_properly) { @@ -232,8 +234,12 @@ TEST_CASE(file_descriptor) { char filename[] = "/tmp/test-file-descriptor-XXXXXX"; +#ifdef AK_OS_WINDOWS + FILE* file = tmpfile(); +#else int fd = mkstemp(filename); FILE* file = fdopen(fd, "w+"); +#endif outln(file, "{}", "Hello, World!"); out(file, "foo"); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 859d9ffdda1..99b011940c6 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1,4 +1,10 @@ add_subdirectory(AK) + +# FIXME: Increase support for building targets on Windows +if (WIN32 AND ENABLE_WINDOWS_CI) + return() +endif() + add_subdirectory(LibCrypto) add_subdirectory(LibCompress) add_subdirectory(LibCore) diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index 013347c6a39..dbe5044d626 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -1,3 +1,8 @@ +# FIXME: Increase support for building targets on Windows +if (WIN32 AND ENABLE_WINDOWS_CI) + return() +endif() + lagom_utility(abench SOURCES abench.cpp LIBS LibMain LibFileSystem LibMedia) lagom_utility(dns SOURCES dns.cpp LIBS LibDNS LibMain LibTLS LibCrypto)