Skip to content

Commit

Permalink
android test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hyp committed May 6, 2024
1 parent 378f474 commit 4786393
Show file tree
Hide file tree
Showing 34 changed files with 77 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/AutoDiff/SILOptimizer/vjp_and_pullback_inlining.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import _Differentiation
#if canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#else
import Foundation
#endif
Expand Down Expand Up @@ -111,4 +113,4 @@ func caller_of_more_complex_pb_with_control_flow() -> Float {
}

// CHECK: decision {{{.*}}, b=70, {{.*}}} more_complex_pb_with_control_flowTJpSpSr
// CHECK-NEXT: "more_complex_pb_with_control_flowTJpSpSr" inlined into "caller_of_more_complex_pb_with_control_flow"
// CHECK-NEXT: "more_complex_pb_with_control_flowTJpSpSr" inlined into "caller_of_more_complex_pb_with_control_flow"
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import _Differentiation
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
#else
Expand Down
2 changes: 2 additions & 0 deletions test/AutoDiff/stdlib/tgmath_derivatives.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import Darwin.C.tgmath
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
#else
Expand Down
2 changes: 2 additions & 0 deletions test/AutoDiff/validation-test/custom_derivatives.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import StdlibUnittest
import Darwin.C
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
#else
Expand Down
2 changes: 2 additions & 0 deletions test/AutoDiff/validation-test/separate_tangent_type.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import StdlibUnittest
import Darwin.C
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
#else
Expand Down
2 changes: 2 additions & 0 deletions test/ClangImporter/clang_builtins.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(WASI)
import WASILibc
#elseif os(Windows)
Expand Down
2 changes: 2 additions & 0 deletions test/Concurrency/Runtime/async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import StdlibUnittest
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#endif

var asyncTests = TestSuite("Async")
Expand Down
2 changes: 2 additions & 0 deletions test/Concurrency/Runtime/async_task_locals_copy_to_sync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import Dispatch
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#endif

enum TL {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import Glibc
#elseif os(Windows)
import MSVCRT
#elseif canImport(Android)
import Android
#else
import Darwin
#endif
Expand All @@ -36,4 +38,4 @@ func test_withUnsafeCurrentTask() async {
static func main() async {
await test_withUnsafeCurrentTask()
}
}
}
2 changes: 2 additions & 0 deletions test/Concurrency/Runtime/cancellation_handler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif canImport(WASILibc)
import WASILibc
#elseif os(Windows)
Expand Down
2 changes: 2 additions & 0 deletions test/Concurrency/Runtime/data_race_detection_crash.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import Dispatch
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#endif

@MainActor func onMainActor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import Dispatch
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#endif

@MainActor func onMainActor() {
Expand Down
2 changes: 2 additions & 0 deletions test/Concurrency/Runtime/exclusivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ var global3: Int = 7
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif canImport(CRT)
import CRT
#endif
Expand Down
2 changes: 2 additions & 0 deletions test/Concurrency/Runtime/exclusivity_custom_executors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import StdlibUnittest
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif canImport(CRT)
import CRT
#endif
Expand Down
2 changes: 2 additions & 0 deletions test/Concurrency/Runtime/executor_deinit3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#endif

@available(SwiftStdlib 5.1, *)
Expand Down
2 changes: 2 additions & 0 deletions test/Concurrency/async_task_base_priority.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import Dispatch
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(WASI)
import WASILibc
#elseif os(Windows)
Expand Down
2 changes: 2 additions & 0 deletions test/IRGen/builtin_math.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import Glibc
#elseif os(WASI)
import WASILibc
#elseif os(Android)

This comment has been minimized.

Copy link
@finagolfin

finagolfin May 7, 2024

Member

Always use canImport(), since this is a Swift module.

import Android
#elseif os(Windows)
import CRT
#else
Expand Down
2 changes: 2 additions & 0 deletions test/IRGen/sanitize_coverage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
#else
Expand Down
6 changes: 6 additions & 0 deletions test/Interop/Cxx/libc/include-glibc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
// REQUIRES: executable_test
// REQUIRES: OS=linux-gnu || OS=linux-android

#if canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#else
#error ("unsupported platform")
#endif

This comment has been minimized.

Copy link
@finagolfin

finagolfin May 7, 2024

Member

Consider renaming the file and the variable below to libc

import StdlibUnittest

var GlibcTests = TestSuite("GlibcTests")
Expand Down
2 changes: 2 additions & 0 deletions test/Interpreter/dynamicReplacement_property_observer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
import WinSDK
Expand Down
2 changes: 2 additions & 0 deletions test/Interpreter/dynamic_replacement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ import StdlibUnittest
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
import WinSDK
Expand Down
2 changes: 2 additions & 0 deletions test/Interpreter/dynamic_replacement_chaining.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import StdlibUnittest
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
import WinSDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import StdlibUnittest
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
import WinSDK
Expand Down
2 changes: 2 additions & 0 deletions test/Prototypes/BigInt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import StdlibUnittest
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
#else
Expand Down
2 changes: 2 additions & 0 deletions test/SILOptimizer/c_string_optimization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#elseif os(Windows)
import CRT
#else
Expand Down
2 changes: 2 additions & 0 deletions test/multifile/protocol-conformance-redundant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import StdlibUnittest
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#else
#error("Unsupported platform")
#endif
Expand Down
2 changes: 2 additions & 0 deletions test/stdlib/FloatConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import Glibc
#elseif os(WASI)
import WASILibc
#elseif os(Android)

This comment has been minimized.

Copy link
@finagolfin

finagolfin May 7, 2024

Member

canImport

import Android
#elseif os(Windows)
import CRT
#else
Expand Down
2 changes: 2 additions & 0 deletions test/stdlib/MathConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import Glibc
#elseif os(WASI)
import WASILibc
#elseif os(Android)

This comment has been minimized.

Copy link
@finagolfin

finagolfin May 7, 2024

Member

canImport

import Android
#elseif os(Windows)
import CRT
#else
Expand Down
2 changes: 2 additions & 0 deletions test/stdlib/POSIX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import SwiftPrivateLibcExtras
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#else
#error("Unsupported platform")
#endif
Expand Down
2 changes: 2 additions & 0 deletions test/stdlib/PrintFloat.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import SwiftPrivateLibcExtras
import Glibc
#elseif os(WASI)
import WASILibc
#elseif os(Android)

This comment has been minimized.

Copy link
@finagolfin

finagolfin May 7, 2024

Member

canImport

import Android
#elseif os(Windows)
import CRT
#else
Expand Down
2 changes: 2 additions & 0 deletions test/stdlib/Runtime.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import SwiftShims
import Glibc
#elseif os(WASI)
import WASILibc
#elseif os(Android)

This comment has been minimized.

Copy link
@finagolfin

finagolfin May 7, 2024

Member

canImport

import Android
#elseif os(Windows)
import CRT
import WinSDK
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/VarArgs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ runAllTests()
#elseif os(WASI)
import WASILibc
typealias CGFloat = Double
#elseif canImport(Android)
import Android
typealias CGFloat = Double
#elseif os(Windows)
import CRT
#if arch(x86_64) || arch(arm64)
Expand Down
4 changes: 4 additions & 0 deletions test/stdlib/mmap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import StdlibUnittest
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
// MAP_FAILED is not available on android.
let MAP_FAILED = UnsafeMutableRawPointer(bitPattern: -1)
#else
#error("Unsupported platform")
#endif
Expand Down
2 changes: 2 additions & 0 deletions test/stdlib/tgmath_optimized.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import Glibc
#elseif os(WASI)
import WASILibc
#elseif os(Android)

This comment has been minimized.

Copy link
@finagolfin

finagolfin May 7, 2024

Member

canImport

import Android
#elseif os(Windows)
import CRT
#else
Expand Down

0 comments on commit 4786393

Please sign in to comment.