Skip to content

utils: add support to run the Windows toolchain tests #38927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions utils/build-windows-toolchain.bat
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ cmake ^
-D ZLIB_INCLUDE_DIR=%BuildRoot%\Library\zlib-1.2.11\usr\include ^
-D dispatch_DIR=%BuildRoot%\3\cmake\modules ^

-D ENABLE_TESTING=NO ^

-G Ninja ^
-S %SourceRoot%\swift-corelibs-foundation || (exit /b)
cmake --build %BuildRoot%\4 || (exit /b)
Expand All @@ -318,6 +320,8 @@ cmake ^
-D dispatch_DIR=%BuildRoot%\3\cmake\modules ^
-D Foundation_DIR=%BuildRoot%\4\cmake\modules ^

-D ENABLE_TESTING=NO ^

-G Ninja ^
-S %SourceRoot%\swift-corelibs-xctest || (exit /b)
cmake --build %BuildRoot%\5 || (exit /b)
Expand Down Expand Up @@ -662,6 +666,89 @@ msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\installer.wixproj
:: TODO(compnerd) actually perform the code-signing
:: signtool sign /f Apple_CodeSign.pfx /p Apple_CodeSign_Password /tr http://timestamp.digicert.com /fd sha256 %PackageRoot%\installer\installer.exe

:: TODO(compnerd) test LLVM

:: Test Swift
:: TODO(compnerd) make lit adjust the path properly
path %BuildRoot%\3;%BuildRoot%\1\bin;%BuildRoot%\Library\icu-67.1\usr\bin;%PATH%;%SystemDrive%\Program Files\Git\usr\bin
cmake --build %BuildRoot%\1 --target check-swift || (exit /b)

:: Test dispatch
cmake --build %BuildRoot%\3 --target ExperimentalTest || (exit /b)

:: NOTE(compnerd) update the path *before* the build because the tests are
:: executed to shard the test suite.
path %BuildRoot%\5;%BuildRoot%\4\bin;%PATH%

:: Rebuild Foundation (w/ testing)
cmake ^
-B %BuildRoot%\4 ^

-D CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
-D CMAKE_C_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
-D CMAKE_CXX_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
-D CMAKE_CXX_FLAGS="/GS- /Oy /Gw /Gy" ^
-D CMAKE_MT=mt ^
-D CMAKE_Swift_COMPILER=%BuildRoot%/1/bin/swiftc.exe ^
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^

-D CMAKE_INSTALL_PREFIX=%SDKInstallRoot%\usr ^

-D CURL_DIR=%BuildRoot%\Library\curl-7.77.0\usr\lib\cmake\CURL ^
-D ICU_ROOT=%BuildRoot%\Library\icu-67.1 ^
-D ICU_UC_LIBRARY=%BuildRoot%\Library\icu-67.1\lib64\icuuc67.lib ^
-D ICU_I18N_LIBRARY=%BuildRoot%\Library\icu-67.1\lib64\icuin67.lib ^
-D LIBXML2_LIBRARY=%BuildRoot%\Library\libxml2-2.9.12\usr\lib\libxml2s.lib ^
-D LIBXML2_INCLUDE_DIR=%BuildRoot%\Library\libxml2-2.9.12\usr\include\libxml2 ^
-D LIBXML2_DEFINITIONS="/DLIBXML_STATIC" ^
-D ZLIB_LIBRARY=%BuildRoot%\Library\zlib-1.2.11\usr\lib\zlibstatic.lib ^
-D ZLIB_INCLUDE_DIR=%BuildRoot%\Library\zlib-1.2.11\usr\include ^
-D dispatch_DIR=%BuildRoot%\3\cmake\modules ^
-D XCTest_DIR=%BuildRoot%\5\cmake\modules ^

-D ENABLE_TESTING=YES ^

-G Ninja ^
-S %SourceRoot%\swift-corelibs-foundation || (exit /b)
cmake --build %BuildRoot%\4 || (exit /b)

:: Test Foundation
set CTEST_OUTPUT_ON_FAILURE=1
cmake --build %BuildRoot%\4 --target test || (exit /b)

:: Rebuild XCTest (w/ testing)
cmake ^
-B %BuildRoot%\5 ^

-D CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
-D CMAKE_C_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
-D CMAKE_CXX_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
-D CMAKE_CXX_FLAGS="/GS- /Oy /Gw /Gy" ^
-D CMAKE_MT=mt ^
-D CMAKE_Swift_COMPILER=%BuildRoot%/1/bin/swiftc.exe ^
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^

-D CMAKE_INSTALL_PREFIX=%PlatformRoot%\Developer\Library\XCTest-development\usr ^

-D dispatch_DIR=%BuildRoot%\3\cmake\modules ^
-D Foundation_DIR=%BuildRoot%\4\cmake\modules ^

-D ENABLE_TESTING=YES ^
-D XCTEST_PATH_TO_LIBDISPATCH_BUILD=%BuildRoot%\3 ^
-D XCTEST_PATH_TO_LIBDISPATCH_SOURCE=%SourceRoot%\swift-corelibs-libdispatch ^
-D XCTEST_PATH_TO_FOUNDATION_BUILD=%BuildRoot%\4 ^

-G Ninja ^
-S %SourceRoot%\swift-corelibs-xctest || (exit /b)
cmake --build %BuildRoot%\5 || (exit /b)

:: Test XCTest
cmake --build %BuildRoot%\5 --target check-xctest || (exit /b)

:: Clean up the module cache
rd /s /q %LocalAppData%\clang\ModuleCache

Expand Down