[test][gardening] Prefer os(macOS) over os(OSX)

This commit is contained in:
Sho Ikeda
2018-03-10 22:22:24 +09:00
parent c26f40b45b
commit b68be20e9d
27 changed files with 48 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
// RUN: %target-swift-frontend -typecheck -verify %s
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
typealias JumpBuffer = Int32
#else

View File

@@ -3,7 +3,7 @@
// RUN: not %target-swift-frontend -swift-version 4 -typecheck %s 2> %t.4.txt
// RUN: %FileCheck -check-prefix=CHECK-4 -check-prefix=CHECK-%target-runtime-4 %s < %t.4.txt
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#else
import Glibc
@@ -27,7 +27,7 @@ func test() {
// CHECK-4: [[@LINE-2]]:16: error: cannot convert value of type '({{.+}}) -> Int'{{( [(]aka .+[)])?}} to specified type 'Int'
}
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
// These functions aren't consistently available across platforms, so only
// test for them on Apple platforms.
func testApple() {

View File

@@ -8,7 +8,7 @@
// XFAIL: OS=watchos
// CHECK: Crash!
#if os(OSX) || os(iOS)
#if os(macOS) || os(iOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin)
import Glibc

View File

@@ -8,7 +8,7 @@
// XFAIL: OS=tvos
// XFAIL: OS=watchos
#if os(OSX) || os(iOS)
#if os(macOS) || os(iOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin)
import Glibc

View File

@@ -280,8 +280,8 @@ class NestedPoundIf {
// CHECK: <kw>class</kw> NestedPoundIf {
func foo1() {
// CHECK: <kw>func</kw> foo1() {
#if os(OSX)
// CHECK: <#kw>#if</#kw> <#id>os</#id>(<#id>OSX</#id>)
#if os(macOS)
// CHECK: <#kw>#if</#kw> <#id>os</#id>(<#id>macOS</#id>)
var a = 1
// CHECK: <kw>var</kw> a = <int>1</int>
#if USE_METAL

View File

@@ -154,7 +154,7 @@ func rethrowFunc(_ f: () throws -> () = {}) rethrows {}
class NestedPoundIf{
func foo1() {
#if os(OSX)
#if os(macOS)
var a = 1
#if USE_METAL
var b = 2

View File

@@ -2,8 +2,8 @@
@_exported import ObjectiveC
public struct ObjCBool : CustomStringConvertible {
#if os(OSX) || (os(iOS) && (arch(i386) || arch(arm)))
// On OS X and 32-bit iOS, Objective-C's BOOL type is a "signed char".
#if os(macOS) || (os(iOS) && (arch(i386) || arch(arm)))
// On macOS and 32-bit iOS, Objective-C's BOOL type is a "signed char".
private var value: Int8
public init(_ value: Bool) {

View File

@@ -252,7 +252,7 @@ FoundationTestSuite.test("DarwinBoolean smoke test") {
let _: CFArrayEqualCallBack = { DarwinBoolean($0 == $1) }
}
#if os(OSX)
#if os(macOS)
FoundationTestSuite.test("NSRectEdge/constants") {
// Check that the following constants have the correct type and value.
//

View File

@@ -6,7 +6,7 @@
// REQUIRES: objc_interop
import Foundation
#if os(OSX)
#if os(macOS)
import AppKit
typealias XXColor = NSColor
#endif
@@ -28,7 +28,7 @@ let cgRed = CGColor(colorSpace: rgb, components: [1.0, 0.0, 0.0, 1.0])!
let nsRed = XXColor(cgColor: cgRed)
var r: CGFloat = 0.5, g: CGFloat = 0.5, b: CGFloat = 0.5, a: CGFloat = 0.5
#if os(OSX)
#if os(macOS)
nsRed!.getRed(&r, green: &g, blue: &b, alpha: &a)
#else
nsRed.getRed(&r, green: &g, blue: &b, alpha: &a)

View File

@@ -6,7 +6,7 @@
import Foundation
import StdlibUnittest
#if os(OSX)
#if os(macOS)
import AppKit
#endif

View File

@@ -3,7 +3,7 @@
// REQUIRES: objc_interop
#if os(OSX)
#if os(macOS)
import AppKit
#endif
#if os(iOS) || os(tvOS) || os(watchOS)

View File

@@ -9,7 +9,7 @@
// TODO: rdar://problem/33388782
// REQUIRES: CPU=x86_64
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android)
import Glibc

View File

@@ -8,7 +8,7 @@
// strict checking if we get a guarantee that certain types don't have
// hidden or future enumeration values.)
#if os(OSX)
#if os(macOS)
import AppKit
print(NSButtonType(rawValue: 20721)!.rawValue)

View File

@@ -63,3 +63,9 @@ var v = u
var w = Foo()
#endif
var x = w
// Test os(macOS) as well
#if os(macOS)
var y = Foo()
#endif
var z = y

View File

@@ -37,7 +37,7 @@
#if MAIN
#if os(OSX)
#if os(macOS)
import AppKit
@NSApplicationMain

View File

@@ -171,7 +171,7 @@ public enum FloatingPointSign: Int64 {
case minus
}
#if os(OSX)
#if os(macOS)
// Test open_existential_value used in a conversion context.
// (the actual bridging call is dropped because we don't import Swift).
// ---
@@ -196,7 +196,7 @@ public func _unsafeDowncastToAnyObject(fromAny any: Any) -> AnyObject {
public protocol Error {}
#if os(OSX)
#if os(macOS)
// Test open_existential_box_value in a conversion context.
// ---
// CHECK-OSX-LABEL: sil @$Ss3foo1eys5Error_pSg_tF : $@convention(thin) (@owned Optional<Error>) -> () {

View File

@@ -7,7 +7,7 @@
// https://bugs.swift.org/browse/SR-6622
// XFAIL: linux
#if os(OSX) || os(iOS)
#if os(macOS) || os(iOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin)
import Glibc
@@ -38,7 +38,7 @@ var threads: [pthread_t] = []
var racey_x: Int;
for _ in 1...5 {
#if os(OSX) || os(iOS)
#if os(macOS) || os(iOS)
var t : pthread_t?
#else
var t : pthread_t = 0
@@ -49,7 +49,7 @@ for _ in 1...5 {
return nil
}, nil)
#if os(OSX) || os(iOS)
#if os(macOS) || os(iOS)
threads.append(t!)
#else
threads.append(t)

View File

@@ -117,7 +117,7 @@ struct UUIDCodingWrapper : Codable, Equatable {
// MARK: - Tests
class TestCodable : TestCodableSuper {
// MARK: - AffineTransform
#if os(OSX)
#if os(macOS)
lazy var affineTransformValues: [Int : AffineTransform] = [
#line : AffineTransform.identity,
#line : AffineTransform(),
@@ -776,7 +776,7 @@ var tests = [
"test_UUID_Plist" : TestCodable.test_UUID_Plist,
]
#if os(OSX)
#if os(macOS)
tests["test_AffineTransform_JSON"] = TestCodable.test_AffineTransform_JSON
tests["test_AffineTransform_Plist"] = TestCodable.test_AffineTransform_Plist
#endif

View File

@@ -1,6 +1,6 @@
// RUN: %target-typecheck-verify-swift
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android)
import Glibc

View File

@@ -1,6 +1,6 @@
// RUN: %target-typecheck-verify-swift
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android)
import Glibc

View File

@@ -72,7 +72,7 @@ if #available(OSX 10.13, iOS 11.0, tvOS 11.0, *) {
/* Setup */
let device = MTLCreateSystemDefaultDevice()!
#if os(OSX)
#if os(macOS)
let options = MTLResourceOptions.storageModeManaged
#else
let options = MTLResourceOptions.storageModePrivate
@@ -81,7 +81,7 @@ if #available(OSX 10.13, iOS 11.0, tvOS 11.0, *) {
/* Call APIs */
#if os(OSX)
#if os(macOS)
buf.didModifyRange(0..<4)
#endif
buf.addDebugMarker("test marker", range: 0..<4)
@@ -97,7 +97,7 @@ if #available(OSX 10.13, iOS 11.0, tvOS 11.0, *) {
let queue = device.makeCommandQueue()!
let cmdBuf = queue.makeCommandBuffer()!
#if os(OSX)
#if os(macOS)
let options = MTLResourceOptions.storageModeManaged
#else
let options = MTLResourceOptions.storageModePrivate
@@ -162,7 +162,7 @@ if #available(OSX 10.13, iOS 11.0, tvOS 11.0, *) {
let queue = device.makeCommandQueue()!
let cmdBuf = queue.makeCommandBuffer()!
#if os(OSX)
#if os(macOS)
let options = MTLResourceOptions.storageModeManaged
#else
let options = MTLResourceOptions.storageModePrivate
@@ -182,7 +182,7 @@ if #available(OSX 10.13, iOS 11.0, tvOS 11.0, *) {
let encoder = cmdBuf.makeRenderCommandEncoder(descriptor: rpDesc)!
encoder.useResources([buf], usage: MTLResourceUsage.read)
encoder.useHeaps([heap])
#if os(OSX)
#if os(macOS)
encoder.setViewports([MTLViewport()])
encoder.setScissorRects([MTLScissorRect(x:0, y:0, width:1, height:1)])
#endif

View File

@@ -1329,7 +1329,7 @@ NSStringAPIs.test("smallestEncoding") {
}
func getHomeDir() -> String {
#if os(OSX)
#if os(macOS)
return String(cString: getpwuid(getuid()).pointee.pw_dir)
#elseif os(iOS) || os(tvOS) || os(watchOS)
// getpwuid() returns null in sandboxed apps under iOS simulator.

View File

@@ -59,7 +59,7 @@ ${ testCase("NSRange", "NSRange(location: 17, length: 38)", "range", "rangesEqua
// For historic reasons, macOS has different NSValue methods for the
// CoreGraphics types from other Apple platforms.
#if os(OSX)
#if os(macOS)
${ testCase("CGRect", "CGRect(x: 17, y: 38, width: 6, height: 79)", "rect", "(==)") }
${ testCase("CGPoint", "CGPoint(x: 17, y: 38)", "point", "(==)") }

View File

@@ -15,7 +15,7 @@
import Swift
import Foundation
#if os(OSX)
#if os(macOS)
import AppKit
typealias OSImage = NSImage

View File

@@ -9,7 +9,7 @@ import Swift
import StdlibUnittest
import SwiftShims
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android)
import Glibc
@@ -553,7 +553,7 @@ Runtime.test("Struct layout with reference storage types") {
}
Runtime.test("SwiftError layout constants for LLDB") {
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: -2)
#elseif os(Linux)
let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: 0)
@@ -565,7 +565,7 @@ Runtime.test("SwiftError layout constants for LLDB") {
dlsym(RTLD_DEFAULT, "_swift_lldb_offsetof_SwiftError_typeMetadata")!
let sizeof_SwiftError =
dlsym(RTLD_DEFAULT, "_swift_lldb_sizeof_SwiftError")!
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if arch(i386) || arch(arm)
expectEqual(20, offsetof_SwiftError_typeMetadata.load(as: UInt.self))
expectEqual(36, sizeof_SwiftError.load(as: UInt.self))
@@ -1671,7 +1671,7 @@ AvailabilityVersionsTestSuite.test("_stdlib_isOSVersionAtLeast") {
// _stdlib_isOSVersionAtLeast is broken for
// watchOS. rdar://problem/20234735
#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS)
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
// This test assumes that no version component on an OS we test upon
// will ever be greater than 1066 and that every major version will always
// be greater than 1.

View File

@@ -12,7 +12,7 @@
import Foundation
#if os(OSX)
#if os(macOS)
#if FOUNDATION_XCTEST
import XCTest

View File

@@ -67,7 +67,7 @@ class TestURL : TestURLSuper {
}
}
#if os(OSX)
#if os(macOS)
func testQuarantineProperties() {
// Test the quarantine stuff; it has special logic
if #available(OSX 10.11, iOS 9.0, *) {
@@ -383,7 +383,7 @@ var URLTests = TestSuite("TestURL")
URLTests.test("testBasics") { TestURL().testBasics() }
URLTests.test("testProperties") { TestURL().testProperties() }
URLTests.test("testSetProperties") { TestURL().testSetProperties() }
#if os(OSX)
#if os(macOS)
URLTests.test("testQuarantineProperties") { TestURL().testQuarantineProperties() }
#endif
URLTests.test("testMoreSetProperties") { TestURL().testMoreSetProperties() }