Skip to content

Commit 480ea48

Browse files
Run non-executable Swift Runtime tests for x86_64 Android
1 parent 136cdee commit 480ea48

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

test/lit.cfg

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,9 +1891,11 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
18911891
config.target_pic_opt = "-fPIC"
18921892

18931893
ndk_platform_tuple = get_architecture_value(armv7="armeabi-v7a",
1894-
aarch64="arm64-v8a")
1894+
aarch64="arm64-v8a",
1895+
x86_64="x86_64")
18951896
ndk_platform_triple = get_architecture_value(armv7="arm-linux-androideabi",
1896-
aarch64="aarch64-linux-android")
1897+
aarch64="aarch64-linux-android",
1898+
x86_64="x86_64-linux-android")
18971899
if platform.system() == 'Linux':
18981900
prebuilt_directory = 'linux-x86_64'
18991901
elif platform.system() == 'Darwin':

utils/build.ps1

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ if ($AndroidSDKs.Length -gt 0) {
211211

212212
if ($Test -contains "*") {
213213
# Explicitly don't include llbuild yet since tests are known to fail on Windows
214-
$Test = @("lld", "lldb", "swift", "dispatch", "foundation", "xctest", "swift-format", "sourcekit-lsp")
214+
$Test = @("lld", "lldb", "swift", "dispatch", "foundation", "xctest", "swift-format", "sourcekit-lsp", "android")
215215
}
216216

217217
# Architecture definitions
@@ -1935,17 +1935,22 @@ function Build-CURL([Platform]$Platform, $Arch) {
19351935
})
19361936
}
19371937

1938-
function Build-Runtime([Platform]$Platform, $Arch) {
1938+
function Build-Runtime([Platform]$Platform, $Arch, [switch]$Test = $false) {
1939+
$Targets = @("install")
19391940
$PlatformDefines = @{}
19401941
if ($Platform -eq "Android") {
19411942
$PlatformDefines += @{
19421943
LLVM_ENABLE_LIBCXX = "YES";
19431944
SWIFT_USE_LINKER = "lld";
1944-
SWIFT_INCLUDE_TESTS = "NO";
1945-
SWIFT_INCLUDE_TEST_BINARIES = "NO";
19461945
}
19471946
}
1948-
1947+
if ($Test) {
1948+
$Targets += @("check-swift-all-only_non_executable")
1949+
$PlatformDefines += @{
1950+
SWIFT_INCLUDE_TESTS = "YES";
1951+
SWIFT_BUILD_TEST_SUPPORT_MODULES = "YES";
1952+
}
1953+
}
19491954

19501955
Isolate-EnvVars {
19511956
$env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
@@ -1956,6 +1961,7 @@ function Build-Runtime([Platform]$Platform, $Arch) {
19561961
Get-HostProjectBinaryCache Compilers
19571962
}
19581963

1964+
$NativeToolsPath = Join-Path -Path $CompilersBinaryCache -ChildPath "bin"
19591965
Build-CMakeProject `
19601966
-Src $SourceCache\swift `
19611967
-Bin (Get-TargetProjectBinaryCache $Arch Runtime) `
@@ -1964,6 +1970,7 @@ function Build-Runtime([Platform]$Platform, $Arch) {
19641970
-Platform $Platform `
19651971
-CacheScript $SourceCache\swift\cmake\caches\Runtime-$Platform-$($Arch.LLVMName).cmake `
19661972
-UseBuiltCompilers C,CXX,Swift `
1973+
-BuildTargets $Targets `
19671974
-Defines ($PlatformDefines + @{
19681975
CMAKE_Swift_COMPILER_TARGET = $Arch.LLVMTarget.Replace("$AndroidAPILevel", "");
19691976
CMAKE_Swift_COMPILER_WORKS = "YES";
@@ -1977,7 +1984,8 @@ function Build-Runtime([Platform]$Platform, $Arch) {
19771984
SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING = "YES";
19781985
SWIFT_ENABLE_SYNCHRONIZATION = "YES";
19791986
SWIFT_ENABLE_VOLATILE = "YES";
1980-
SWIFT_NATIVE_SWIFT_TOOLS_PATH = (Join-Path -Path $CompilersBinaryCache -ChildPath "bin");
1987+
SWIFT_NATIVE_LLVM_TOOLS_PATH = $NativeToolsPath;
1988+
SWIFT_NATIVE_SWIFT_TOOLS_PATH = $NativeToolsPath;
19811989
SWIFT_PATH_TO_LIBDISPATCH_SOURCE = "$SourceCache\swift-corelibs-libdispatch";
19821990
SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = "$SourceCache\swift-experimental-string-processing";
19831991
CMAKE_SHARED_LINKER_FLAGS = if ($Platform -eq "Windows") { @("/INCREMENTAL:NO", "/OPT:REF", "/OPT:ICF") } else { @() };
@@ -3071,6 +3079,11 @@ if (-not $IsCrossCompiling) {
30713079
Build-Compilers $HostArch @Tests
30723080
}
30733081

3082+
if ($Test -contains "android") {
3083+
Build-Runtime Android $AndroidX64 -Test
3084+
Build-Runtime Android $AndroidARM64 -Test
3085+
}
3086+
30743087
if ($Test -contains "dispatch") {
30753088
Build-Dispatch Windows $HostArch -Test
30763089
}

0 commit comments

Comments
 (0)