@@ -145,27 +145,25 @@ class OutOfProcessReferenceResolverTests: XCTestCase {
145145
146146 func testResolvingTopicLinkProcess( ) throws {
147147 #if os(macOS)
148- throw XCTSkip ( " This test is flaky (rdar://91678333) " )
149-
150- // try assertResolvesTopicLink(makeResolver: { testMetadata in
151- // let temporaryFolder = try createTemporaryDirectory()
152- // let executableLocation = temporaryFolder.appendingPathComponent("link-resolver-executable")
153- //
154- // let encodedMetadata = try String(data: JSONEncoder().encode(testMetadata), encoding: .utf8)!
155- //
156- // try """
157- // #!/bin/bash
158- // echo '{"bundleIdentifier":"com.test.bundle"}' # Write this resolver's bundle identifier
159- // read # Wait for docc to send a topic URL
160- // echo '{"resolvedInformation":\(encodedMetadata)}' # Respond with the test metadata (above)
161- // """.write(to: executableLocation, atomically: true, encoding: .utf8)
162- //
163- // // `0o0700` is `-rwx------` (read, write, & execute only for owner)
164- // try FileManager.default.setAttributes([.posixPermissions: 0o0700], ofItemAtPath: executableLocation.path)
165- // XCTAssert(FileManager.default.isExecutableFile(atPath: executableLocation.path))
166- //
167- // return try OutOfProcessReferenceResolver(processLocation: executableLocation, errorOutputHandler: { _ in })
168- // })
148+ try assertResolvesTopicLink ( makeResolver: { testMetadata in
149+ let temporaryFolder = try createTemporaryDirectory ( )
150+ let executableLocation = temporaryFolder. appendingPathComponent ( " link-resolver-executable " )
151+
152+ let encodedMetadata = try String ( data: JSONEncoder ( ) . encode ( testMetadata) , encoding: . utf8) !
153+
154+ try """
155+ #!/bin/bash
156+ echo '{ " bundleIdentifier " : " com.test.bundle " }' # Write this resolver's bundle identifier
157+ read # Wait for docc to send a topic URL
158+ echo '{ " resolvedInformation " : \( encodedMetadata) }' # Respond with the test metadata (above)
159+ """ . write ( to: executableLocation, atomically: true , encoding: . utf8)
160+
161+ // `0o0700` is `-rwx------` (read, write, & execute only for owner)
162+ try FileManager . default. setAttributes ( [ . posixPermissions: 0o0700 ] , ofItemAtPath: executableLocation. path)
163+ XCTAssert ( FileManager . default. isExecutableFile ( atPath: executableLocation. path) )
164+
165+ return try OutOfProcessReferenceResolver ( processLocation: executableLocation, errorOutputHandler: { _ in } )
166+ } )
169167
170168 #endif
171169 }
@@ -370,34 +368,32 @@ class OutOfProcessReferenceResolverTests: XCTestCase {
370368 }
371369
372370 func testForwardsErrorOutputProcess( ) throws {
373- throw XCTSkip ( " This test is flaky rdar://88498898 " )
374-
375- // #if os(macOS)
376- // let temporaryFolder = try createTemporaryDirectory()
377- //
378- // let executableLocation = temporaryFolder.appendingPathComponent("link-resolver-executable")
379- // try """
380- // #!/bin/bash
381- // echo "Some error output" 1>&2 # Write to stderr
382- // echo '{"bundleIdentifier":"com.test.bundle"}' # Write this resolver's bundle identifier
383- // read # Wait for docc to send a topic URL
384- // """.write(to: executableLocation, atomically: true, encoding: .utf8)
385- //
386- // // `0o0700` is `-rwx------` (read, write, & execute only for owner)
387- // try FileManager.default.setAttributes([.posixPermissions: 0o0700], ofItemAtPath: executableLocation.path)
388- // XCTAssert(FileManager.default.isExecutableFile(atPath: executableLocation.path))
389- //
390- // let didReadErrorOutputExpectation = AsyncronousExpectation(description: "Did read forwarded error output.")
391- // DispatchQueue.global().async {
392- // let resolver = try? OutOfProcessReferenceResolver(processLocation: executableLocation, errorOutputHandler: {
393- // errorMessage in
394- // XCTAssertEqual(errorMessage, "Some error output\n")
395- // didReadErrorOutputExpectation.fulfill()
396- // })
397- // XCTAssertEqual(resolver?.bundleIdentifier, "com.test.bundle")
398- // }
399- // XCTAssertNotEqual(didReadErrorOutputExpectation.wait(timeout: 20.0), .timedOut)
400- // #endif
371+ #if os(macOS)
372+ let temporaryFolder = try createTemporaryDirectory ( )
373+
374+ let executableLocation = temporaryFolder. appendingPathComponent ( " link-resolver-executable " )
375+ try """
376+ #!/bin/bash
377+ echo '{ " bundleIdentifier " : " com.test.bundle " }' # Write this resolver's bundle identifier
378+ echo " Some error output " 1>&2 # Write to stderr
379+ read # Wait for docc to send a topic URL
380+ """ . write ( to: executableLocation, atomically: true , encoding: . utf8)
381+
382+ // `0o0700` is `-rwx------` (read, write, & execute only for owner)
383+ try FileManager . default. setAttributes ( [ . posixPermissions: 0o0700 ] , ofItemAtPath: executableLocation. path)
384+ XCTAssert ( FileManager . default. isExecutableFile ( atPath: executableLocation. path) )
385+
386+ let didReadErrorOutputExpectation = expectation ( description: " Did read forwarded error output. " )
387+
388+ let resolver = try ? OutOfProcessReferenceResolver ( processLocation: executableLocation, errorOutputHandler: {
389+ errorMessage in
390+ XCTAssertEqual ( errorMessage, " Some error output \n " )
391+ didReadErrorOutputExpectation. fulfill ( )
392+ } )
393+ XCTAssertEqual ( resolver? . bundleIdentifier, " com.test.bundle " )
394+
395+ wait ( for: [ didReadErrorOutputExpectation] , timeout: 20.0 )
396+ #endif
401397 }
402398
403399 func assertForwardsResolverErrors( resolver: OutOfProcessReferenceResolver ) throws {
0 commit comments