Skip to content

Commit 1751010

Browse files
committed
CI: add support to skip testing selectively on full builds
This adds the ability to selectively skip the tests for various pieces (e.g. foundation or xctest) to give us better control for CI for some projects.
1 parent 050f3e2 commit 1751010

File tree

1 file changed

+99
-81
lines changed

1 file changed

+99
-81
lines changed

utils/build-windows-toolchain.bat

Lines changed: 99 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ set TEMP=%BuildRoot%\tmp
4040
set TMP=%BuildRoot%\tmp
4141
set TMPDIR=%BuildRoot%\tmp
4242

43+
if "%SKIP_TESTS%"=="" SET SKIP_TESTS=";"
44+
4345
call :CloneDependencies || (exit /b)
4446
call :CloneRepositories || (exit /b)
4547

@@ -709,87 +711,103 @@ move %PackageRoot%\installer\installer.exe %BuildRoot%\artifacts || (exit /b)
709711

710712
:: TODO(compnerd) test LLVM
711713

712-
:: Test Swift
713-
:: TODO(compnerd) make lit adjust the path properly
714-
path %BuildRoot%\3;%BuildRoot%\1\bin;%PATH%;%SystemDrive%\Program Files\Git\usr\bin
715-
cmake --build %BuildRoot%\1 --target check-swift || (exit /b)
716-
717-
:: Test dispatch
718-
cmake --build %BuildRoot%\3 --target ExperimentalTest || (exit /b)
719-
720-
:: NOTE(compnerd) update the path *before* the build because the tests are
721-
:: executed to shard the test suite.
722-
path %BuildRoot%\5;%BuildRoot%\4\bin;%PATH%
723-
724-
:: Rebuild Foundation (w/ testing)
725-
cmake ^
726-
-B %BuildRoot%\4 ^
727-
728-
-D CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
729-
-D CMAKE_C_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
730-
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
731-
-D CMAKE_CXX_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
732-
-D CMAKE_CXX_FLAGS="/GS- /Oy /Gw /Gy" ^
733-
-D CMAKE_MT=mt ^
734-
-D CMAKE_Swift_COMPILER=%BuildRoot%/1/bin/swiftc.exe ^
735-
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
736-
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
737-
738-
-D CMAKE_INSTALL_PREFIX=%SDKInstallRoot%\usr ^
739-
740-
-D CURL_DIR=%BuildRoot%\Library\curl-7.77.0\usr\lib\cmake\CURL ^
741-
-D ICU_ROOT=%BuildRoot%\Library\icu-69.1\usr ^
742-
-D ICU_DATA_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicudt69.lib ^
743-
-D ICU_I18N_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicuin69.lib ^
744-
-D ICU_UC_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicuuc69.lib ^
745-
-D LIBXML2_LIBRARY=%BuildRoot%\Library\libxml2-2.9.12\usr\lib\libxml2s.lib ^
746-
-D LIBXML2_INCLUDE_DIR=%BuildRoot%\Library\libxml2-2.9.12\usr\include\libxml2 ^
747-
-D LIBXML2_DEFINITIONS="/DLIBXML_STATIC" ^
748-
-D ZLIB_LIBRARY=%BuildRoot%\Library\zlib-1.2.11\usr\lib\zlibstatic.lib ^
749-
-D ZLIB_INCLUDE_DIR=%BuildRoot%\Library\zlib-1.2.11\usr\include ^
750-
-D dispatch_DIR=%BuildRoot%\3\cmake\modules ^
751-
-D XCTest_DIR=%BuildRoot%\5\cmake\modules ^
752-
753-
-D ENABLE_TESTING=YES ^
754-
755-
-G Ninja ^
756-
-S %SourceRoot%\swift-corelibs-foundation || (exit /b)
757-
cmake --build %BuildRoot%\4 || (exit /b)
758-
759-
:: Test Foundation
760-
set CTEST_OUTPUT_ON_FAILURE=1
761-
cmake --build %BuildRoot%\4 --target test || (exit /b)
762-
763-
:: Rebuild XCTest (w/ testing)
764-
cmake ^
765-
-B %BuildRoot%\5 ^
766-
767-
-D CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
768-
-D CMAKE_C_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
769-
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
770-
-D CMAKE_CXX_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
771-
-D CMAKE_CXX_FLAGS="/GS- /Oy /Gw /Gy" ^
772-
-D CMAKE_MT=mt ^
773-
-D CMAKE_Swift_COMPILER=%BuildRoot%/1/bin/swiftc.exe ^
774-
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
775-
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
776-
777-
-D CMAKE_INSTALL_PREFIX=%PlatformRoot%\Developer\Library\XCTest-development\usr ^
778-
779-
-D dispatch_DIR=%BuildRoot%\3\cmake\modules ^
780-
-D Foundation_DIR=%BuildRoot%\4\cmake\modules ^
781-
782-
-D ENABLE_TESTING=YES ^
783-
-D XCTEST_PATH_TO_LIBDISPATCH_BUILD=%BuildRoot%\3 ^
784-
-D XCTEST_PATH_TO_LIBDISPATCH_SOURCE=%SourceRoot%\swift-corelibs-libdispatch ^
785-
-D XCTEST_PATH_TO_FOUNDATION_BUILD=%BuildRoot%\4 ^
786-
787-
-G Ninja ^
788-
-S %SourceRoot%\swift-corelibs-xctest || (exit /b)
789-
cmake --build %BuildRoot%\5 || (exit /b)
790-
791-
:: Test XCTest
792-
cmake --build %BuildRoot%\5 --target check-xctest || (exit /b)
714+
SET SKIP_TEST=0
715+
FOR %%T IN (%SKIP_TESTS%) DO (IF /I %%T==swift SET SKIP_TEST=1)
716+
IF "%SKIP_TEST%"=="1" (
717+
:: Test Swift
718+
:: TODO(compnerd) make lit adjust the path properly
719+
path %BuildRoot%\3;%BuildRoot%\1\bin;%PATH%;%SystemDrive%\Program Files\Git\usr\bin
720+
cmake --build %BuildRoot%\1 --target check-swift || (exit /b)
721+
)
722+
723+
SET SKIP_TEST=0
724+
FOR %%T IN (%SKIP_TESTS%) DO (IF /I %T==dispatch SET SKIP_TEST=1)
725+
IF "%SKIP_TEST%"=="1"(
726+
:: Test dispatch
727+
cmake --build %BuildRoot%\3 --target ExperimentalTest || (exit /b)
728+
)
729+
730+
SET SKIP_TEST=0
731+
FOR %%T IN (%SKIP_TESTS%) DO (IF /I %T==foundation SET SKIP_TEST=1)
732+
IF "%SKIP_TEST%"=="1" (
733+
:: NOTE(compnerd) update the path *before* the build because the tests are
734+
:: executed to shard the test suite.
735+
path %BuildRoot%\5;%BuildRoot%\4\bin;%PATH%
736+
737+
:: Rebuild Foundation (w/ testing)
738+
cmake ^
739+
-B %BuildRoot%\4 ^
740+
741+
-D CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
742+
-D CMAKE_C_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
743+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
744+
-D CMAKE_CXX_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
745+
-D CMAKE_CXX_FLAGS="/GS- /Oy /Gw /Gy" ^
746+
-D CMAKE_MT=mt ^
747+
-D CMAKE_Swift_COMPILER=%BuildRoot%/1/bin/swiftc.exe ^
748+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
749+
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
750+
751+
-D CMAKE_INSTALL_PREFIX=%SDKInstallRoot%\usr ^
752+
753+
-D CURL_DIR=%BuildRoot%\Library\curl-7.77.0\usr\lib\cmake\CURL ^
754+
-D ICU_ROOT=%BuildRoot%\Library\icu-69.1\usr ^
755+
-D ICU_DATA_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicudt69.lib ^
756+
-D ICU_I18N_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicuin69.lib ^
757+
-D ICU_UC_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicuuc69.lib ^
758+
-D LIBXML2_LIBRARY=%BuildRoot%\Library\libxml2-2.9.12\usr\lib\libxml2s.lib ^
759+
-D LIBXML2_INCLUDE_DIR=%BuildRoot%\Library\libxml2-2.9.12\usr\include\libxml2 ^
760+
-D LIBXML2_DEFINITIONS="/DLIBXML_STATIC" ^
761+
-D ZLIB_LIBRARY=%BuildRoot%\Library\zlib-1.2.11\usr\lib\zlibstatic.lib ^
762+
-D ZLIB_INCLUDE_DIR=%BuildRoot%\Library\zlib-1.2.11\usr\include ^
763+
-D dispatch_DIR=%BuildRoot%\3\cmake\modules ^
764+
-D XCTest_DIR=%BuildRoot%\5\cmake\modules ^
765+
766+
-D ENABLE_TESTING=YES ^
767+
768+
-G Ninja ^
769+
-S %SourceRoot%\swift-corelibs-foundation || (exit /b)
770+
cmake --build %BuildRoot%\4 || (exit /b)
771+
772+
:: Test Foundation
773+
set CTEST_OUTPUT_ON_FAILURE=1
774+
cmake --build %BuildRoot%\4 --target test || (exit /b)
775+
)
776+
777+
SET SKIP_TEST=0
778+
FOR %%T IN (%SKIP_TESTS%) DO (IF /I %T==xctest SET SKIP_TEST=1)
779+
IF "%SKIP_TEST%"=="1" (
780+
:: Rebuild XCTest (w/ testing)
781+
cmake ^
782+
-B %BuildRoot%\5 ^
783+
784+
-D CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
785+
-D CMAKE_C_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
786+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
787+
-D CMAKE_CXX_COMPILER=%BuildRoot%/1/bin/clang-cl.exe ^
788+
-D CMAKE_CXX_FLAGS="/GS- /Oy /Gw /Gy" ^
789+
-D CMAKE_MT=mt ^
790+
-D CMAKE_Swift_COMPILER=%BuildRoot%/1/bin/swiftc.exe ^
791+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
792+
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
793+
794+
-D CMAKE_INSTALL_PREFIX=%PlatformRoot%\Developer\Library\XCTest-development\usr ^
795+
796+
-D dispatch_DIR=%BuildRoot%\3\cmake\modules ^
797+
-D Foundation_DIR=%BuildRoot%\4\cmake\modules ^
798+
799+
-D ENABLE_TESTING=YES ^
800+
-D XCTEST_PATH_TO_LIBDISPATCH_BUILD=%BuildRoot%\3 ^
801+
-D XCTEST_PATH_TO_LIBDISPATCH_SOURCE=%SourceRoot%\swift-corelibs-libdispatch ^
802+
-D XCTEST_PATH_TO_FOUNDATION_BUILD=%BuildRoot%\4 ^
803+
804+
-G Ninja ^
805+
-S %SourceRoot%\swift-corelibs-xctest || (exit /b)
806+
cmake --build %BuildRoot%\5 || (exit /b)
807+
808+
:: Test XCTest
809+
cmake --build %BuildRoot%\5 --target check-xctest || (exit /b)
810+
)
793811

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

0 commit comments

Comments
 (0)