Merge pull request #15141 from ikesyo/if-os-macos-in-test

diff --git a/test/ClangImporter/availability_returns_twice.swift b/test/ClangImporter/availability_returns_twice.swift
index f0cee90..537c184 100644
--- a/test/ClangImporter/availability_returns_twice.swift
+++ b/test/ClangImporter/availability_returns_twice.swift
@@ -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
diff --git a/test/ClangImporter/clang_builtins.swift b/test/ClangImporter/clang_builtins.swift
index 73ef91e..b9a72eb 100644
--- a/test/ClangImporter/clang_builtins.swift
+++ b/test/ClangImporter/clang_builtins.swift
@@ -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 @@
   // 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() {
diff --git a/test/Fuzzing/fuzzer_test.swift b/test/Fuzzing/fuzzer_test.swift
index 054bf41..3795c4c 100644
--- a/test/Fuzzing/fuzzer_test.swift
+++ b/test/Fuzzing/fuzzer_test.swift
@@ -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
diff --git a/test/Fuzzing/fuzzer_test_simpler.swift b/test/Fuzzing/fuzzer_test_simpler.swift
index 94e9b6c..beade8e 100644
--- a/test/Fuzzing/fuzzer_test_simpler.swift
+++ b/test/Fuzzing/fuzzer_test_simpler.swift
@@ -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
diff --git a/test/IDE/coloring_configs.swift b/test/IDE/coloring_configs.swift
index 6bd6393..69445d0 100644
--- a/test/IDE/coloring_configs.swift
+++ b/test/IDE/coloring_configs.swift
@@ -280,8 +280,8 @@
 // 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
diff --git a/test/IDE/structure.swift b/test/IDE/structure.swift
index edee06d..87bbdfd 100644
--- a/test/IDE/structure.swift
+++ b/test/IDE/structure.swift
@@ -154,7 +154,7 @@
 
 class NestedPoundIf{
     func foo1() {
-        #if os(OSX)
+        #if os(macOS)
           var a = 1
             #if USE_METAL
               var b = 2
diff --git a/test/IRGen/Inputs/ObjectiveC.swift b/test/IRGen/Inputs/ObjectiveC.swift
index 7457f48..0e155bb 100644
--- a/test/IRGen/Inputs/ObjectiveC.swift
+++ b/test/IRGen/Inputs/ObjectiveC.swift
@@ -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) {
diff --git a/test/Interpreter/SDK/Foundation_test.swift b/test/Interpreter/SDK/Foundation_test.swift
index 50dfc96..f41b2a3 100644
--- a/test/Interpreter/SDK/Foundation_test.swift
+++ b/test/Interpreter/SDK/Foundation_test.swift
@@ -252,7 +252,7 @@
   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.
   //
diff --git a/test/Interpreter/SDK/c_pointers.swift b/test/Interpreter/SDK/c_pointers.swift
index f7f3657..c295c14 100644
--- a/test/Interpreter/SDK/c_pointers.swift
+++ b/test/Interpreter/SDK/c_pointers.swift
@@ -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 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)
diff --git a/test/Interpreter/SDK/cf_extensions.swift b/test/Interpreter/SDK/cf_extensions.swift
index 57aa920..9dcc3cb 100644
--- a/test/Interpreter/SDK/cf_extensions.swift
+++ b/test/Interpreter/SDK/cf_extensions.swift
@@ -6,7 +6,7 @@
 import Foundation
 import StdlibUnittest
 
-#if os(OSX)
+#if os(macOS)
 import AppKit
 #endif
 
diff --git a/test/Interpreter/SDK/cf_type_bridging.swift b/test/Interpreter/SDK/cf_type_bridging.swift
index e755645..23dfa86 100644
--- a/test/Interpreter/SDK/cf_type_bridging.swift
+++ b/test/Interpreter/SDK/cf_type_bridging.swift
@@ -3,7 +3,7 @@
 
 // REQUIRES: objc_interop
 
-#if os(OSX)
+#if os(macOS)
 import AppKit
 #endif
 #if os(iOS) || os(tvOS) || os(watchOS)
diff --git a/test/Interpreter/SDK/libc.swift b/test/Interpreter/SDK/libc.swift
index 13a0e17..0e1dd7d 100644
--- a/test/Interpreter/SDK/libc.swift
+++ b/test/Interpreter/SDK/libc.swift
@@ -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
diff --git a/test/Interpreter/SDK/objc_ns_enum.swift b/test/Interpreter/SDK/objc_ns_enum.swift
index e125436..b2c5d1d 100644
--- a/test/Interpreter/SDK/objc_ns_enum.swift
+++ b/test/Interpreter/SDK/objc_ns_enum.swift
@@ -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)
diff --git a/test/Parse/ConditionalCompilation/basicIdentity.swift b/test/Parse/ConditionalCompilation/basicIdentity.swift
index 14072e7..a067063 100644
--- a/test/Parse/ConditionalCompilation/basicIdentity.swift
+++ b/test/Parse/ConditionalCompilation/basicIdentity.swift
@@ -63,3 +63,9 @@
 var w = Foo()
 #endif
 var x = w
+
+// Test os(macOS) as well
+#if os(macOS)
+var y = Foo()
+#endif
+var z = y
diff --git a/test/PrintAsObjC/accessibility.swift b/test/PrintAsObjC/accessibility.swift
index bbe7d07..e509860 100644
--- a/test/PrintAsObjC/accessibility.swift
+++ b/test/PrintAsObjC/accessibility.swift
@@ -37,7 +37,7 @@
 
 
 #if MAIN
-#if os(OSX)
+#if os(macOS)
 import AppKit
 
 @NSApplicationMain
diff --git a/test/SILGen/opaque_ownership.swift b/test/SILGen/opaque_ownership.swift
index a1a1921..5fa51ce 100644
--- a/test/SILGen/opaque_ownership.swift
+++ b/test/SILGen/opaque_ownership.swift
@@ -171,7 +171,7 @@
   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 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>) -> () {
diff --git a/test/Sanitizers/tsan.swift b/test/Sanitizers/tsan.swift
index b7ffc43..3b793f5 100644
--- a/test/Sanitizers/tsan.swift
+++ b/test/Sanitizers/tsan.swift
@@ -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 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 @@
 
     return nil
   }, nil)
-#if os(OSX) || os(iOS)
+#if os(macOS) || os(iOS)
   threads.append(t!)
 #else
   threads.append(t)
diff --git a/test/stdlib/CodableTests.swift b/test/stdlib/CodableTests.swift
index 8498145..566398c 100644
--- a/test/stdlib/CodableTests.swift
+++ b/test/stdlib/CodableTests.swift
@@ -117,7 +117,7 @@
 // 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 @@
     "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
diff --git a/test/stdlib/FloatConstants.swift b/test/stdlib/FloatConstants.swift
index e3847f4..5d40927 100644
--- a/test/stdlib/FloatConstants.swift
+++ b/test/stdlib/FloatConstants.swift
@@ -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
diff --git a/test/stdlib/MathConstants.swift b/test/stdlib/MathConstants.swift
index fd3c3a0..2ecc54d 100644
--- a/test/stdlib/MathConstants.swift
+++ b/test/stdlib/MathConstants.swift
@@ -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
diff --git a/test/stdlib/Metal.swift b/test/stdlib/Metal.swift
index cb6d50e..682df24 100644
--- a/test/stdlib/Metal.swift
+++ b/test/stdlib/Metal.swift
@@ -72,7 +72,7 @@
       /* Setup */
 
       let device = MTLCreateSystemDefaultDevice()!
-      #if os(OSX)
+      #if os(macOS)
         let options = MTLResourceOptions.storageModeManaged
       #else
         let options = MTLResourceOptions.storageModePrivate
@@ -81,7 +81,7 @@
 
       /* Call APIs */
 
-      #if os(OSX)
+      #if os(macOS)
         buf.didModifyRange(0..<4)
       #endif
       buf.addDebugMarker("test marker", range: 0..<4)
@@ -97,7 +97,7 @@
       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 @@
       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 @@
       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
diff --git a/test/stdlib/NSStringAPI.swift b/test/stdlib/NSStringAPI.swift
index ac7bd20..cf9afb9 100644
--- a/test/stdlib/NSStringAPI.swift
+++ b/test/stdlib/NSStringAPI.swift
@@ -1329,7 +1329,7 @@
 }
 
 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.
diff --git a/test/stdlib/NSValueBridging.swift.gyb b/test/stdlib/NSValueBridging.swift.gyb
index 685aadf..5b322b8 100644
--- a/test/stdlib/NSValueBridging.swift.gyb
+++ b/test/stdlib/NSValueBridging.swift.gyb
@@ -59,7 +59,7 @@
 // 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", "(==)") }
diff --git a/test/stdlib/Reflection_objc.swift b/test/stdlib/Reflection_objc.swift
index 28286f7..414221c 100644
--- a/test/stdlib/Reflection_objc.swift
+++ b/test/stdlib/Reflection_objc.swift
@@ -15,7 +15,7 @@
 import Swift
 import Foundation
 
-#if os(OSX)
+#if os(macOS)
 import AppKit
 
 typealias OSImage = NSImage
diff --git a/test/stdlib/Runtime.swift.gyb b/test/stdlib/Runtime.swift.gyb
index e386aac..67ee2bf 100644
--- a/test/stdlib/Runtime.swift.gyb
+++ b/test/stdlib/Runtime.swift.gyb
@@ -9,7 +9,7 @@
 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("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 @@
     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 @@
 
 // _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.
diff --git a/test/stdlib/TestAffineTransform.swift b/test/stdlib/TestAffineTransform.swift
index ad2b07a..a0b384a 100644
--- a/test/stdlib/TestAffineTransform.swift
+++ b/test/stdlib/TestAffineTransform.swift
@@ -12,7 +12,7 @@
 
 import Foundation
 
-#if os(OSX)
+#if os(macOS)
 
 #if FOUNDATION_XCTEST
 import XCTest
diff --git a/test/stdlib/TestURL.swift b/test/stdlib/TestURL.swift
index 637e043..8c0128c 100644
--- a/test/stdlib/TestURL.swift
+++ b/test/stdlib/TestURL.swift
@@ -67,7 +67,7 @@
         }
     }
     
-#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 @@
 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() }