Files
swift-mirror/test/SourceKit/CursorInfo/cursor_info_async.swift
Ben Langmuir 18be066651 [sourcekit] Synchronize cursor-info requests on generated interfaces
Cursor info requires access to the underlying AST, which is not
thread-safe. This manifest as crashes when performing concurrent
cursor-info requests on the same generated interface. We already
prevented concurrent cursor-infos on regular Swift files by using the
ASTManager, but generated interfaces use the InterfaceGenContext which
may use either an ASTUnit or its own internal CompilerInstance.

rdar://problem/27311624
2016-07-13 16:35:23 -07:00

27 lines
1.7 KiB
Swift

import Foo
// REQUIRES: objc_interop
// Perform 8 concurrent cursor infos, which is often enough to cause
// contention. We disable printing the requests to minimize delay.
// RUN: %sourcekitd-test -req=interface-gen-open -module Foo -- \
// RUN: -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %clang-importer-sdk \
// RUN: == -async -dont-print-request -req=cursor -pos=60:15 \
// RUN: == -async -dont-print-request -req=cursor -pos=60:15 \
// RUN: == -async -dont-print-request -req=cursor -pos=60:15 \
// RUN: == -async -dont-print-request -req=cursor -pos=60:15 \
// RUN: == -async -dont-print-request -req=cursor -pos=60:15 \
// RUN: == -async -dont-print-request -req=cursor -pos=60:15 \
// RUN: == -async -dont-print-request -req=cursor -pos=60:15 \
// RUN: == -async -dont-print-request -req=cursor -pos=60:15 | FileCheck %s -check-prefix=CHECK-FOO
// CHECK-FOO: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>FooRuncingOptions
// CHECK-FOO: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>FooRuncingOptions
// CHECK-FOO: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>FooRuncingOptions
// CHECK-FOO: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>FooRuncingOptions
// CHECK-FOO: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>FooRuncingOptions
// CHECK-FOO: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>FooRuncingOptions
// CHECK-FOO: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>FooRuncingOptions
// CHECK-FOO: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>FooRuncingOptions