Skip to content

Commit 42a1b2d

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 0ce821a commit 42a1b2d

File tree

1 file changed

+96
-80
lines changed

1 file changed

+96
-80
lines changed

utils/build-windows-toolchain.bat

Lines changed: 96 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -706,86 +706,102 @@ move %PackageRoot%\installer\installer.exe %BuildRoot%\artifacts || (exit /b)
706706

707707
:: TODO(compnerd) test LLVM
708708

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

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

0 commit comments

Comments
 (0)