Skip to content

build: add support for testing more of the compilers on Windows #70497

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
Dec 15, 2023
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
38 changes: 33 additions & 5 deletions utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -888,18 +888,36 @@ function Build-BuildTools($Arch) {
}
}

function Build-Compilers($Arch, [switch]$Test = $false) {
function Build-Compilers() {
[CmdletBinding(PositionalBinding = $false)]
param
(
[Parameter(Position = 0, Mandatory = $true)]
[hashtable]$Arch,
[switch]$TestClang = $false,
[switch]$TestLLD = $false,
[switch]$TestLLDB = $false,
[switch]$TestLLVM = $false,
[switch]$TestSwift = $false
)

Isolate-EnvVars {
if ($Test) {
if ($TestClang -or $TestLLD -or $TestLLDB -or $TestLLVM -or $TestSwift) {
$LibdispatchBinDir = "$BinaryCache\1\tools\swift\libdispatch-windows-$($Arch.LLVMName)-prefix\bin"
$env:Path = "$LibdispatchBinDir;$BinaryCache\1\bin;$env:Path;$UnixToolsBinDir"
$Targets = @("check-swift")
$env:Path = "$LibdispatchBinDir;$BinaryCache\1\bin;$env:Path;$VSInstallRoot\DIA SDK\bin\$($HostArch.VSName);$UnixToolsBinDir"
$Targets = @()
$TestingDefines = @{
SWIFT_BUILD_DYNAMIC_SDK_OVERLAY = "YES";
SWIFT_BUILD_DYNAMIC_STDLIB = "YES";
SWIFT_BUILD_REMOTE_MIRROR = "YES";
SWIFT_NATIVE_SWIFT_TOOLS_PATH = "";
}

if ($TestClang) { $Targets += @("check-clang") }
if ($TestLLD) { $Targets += @("check-lld") }
if ($TestLLDB) { $Targets += @("check-lldb") }
if ($TestLLVM) { $Targets += @("check-llvm") }
if ($TestSwift) { $Targets += @("check-swift") }
} else {
$Targets = @("distribution", "install-distribution")
$TestingDefines = @{
Expand Down Expand Up @@ -1801,7 +1819,17 @@ if ($Stage) {
Stage-BuildArtifacts $HostArch
}

if ($Test -contains "swift") { Build-Compilers $HostArch -Test }
if ($Test -ne $null -and (Compare-Object $Test @("clang", "lld", "lldb", "llvm", "swift") -PassThru -IncludeEqual -ExcludeDifferent) -ne $null) {
$Tests = @{
"-TestClang" = $Test -contains "clang";
"-TestLLD" = $Test -contains "lld";
"-TestLLDB" = $Test -contains "lldb";
"-TestLLVM" = $Test -contains "llvm";
"-TestSwift" = $Test -contains "swift";
}
Build-Compilers $HostArch @Tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could avoid splatting by using -TestClang:($Test -contains "clang") (-Foo:$true / -Foo:$false is valid syntax)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that is certainly a viable option as well. I find it difficult to tell which is better. The collection as is does make it easier to tell at a glance what options are being setup. I would defer to your expertise if one is better than the other.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merge this for now, but happy to revisit if you have suggestions here.

}

if ($Test -contains "dispatch") { Build-Dispatch $HostArch -Test }
if ($Test -contains "foundation") { Build-Foundation $HostArch -Test }
if ($Test -contains "xctest") { Build-XCTest $HostArch -Test }
Expand Down