Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeCompletion] Migrate some tests to batch completion test #1 #36714

Merged
merged 1 commit into from
Apr 2, 2021

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Apr 2, 2021

Before:

39.27s: Swift(macosx-x86_64) :: IDE/complete_value_expr.swift
25.04s: Swift(macosx-x86_64) :: IDE/complete_unresolved_members.swift
13.93s: Swift(macosx-x86_64) :: IDE/complete_operators.swift
13.61s: Swift(macosx-x86_64) :: IDE/complete_ambiguous.swift
9.65s: Swift(macosx-x86_64) :: IDE/complete_after_self.swift

After:

4.79s: Swift(macosx-x86_64) :: IDE/complete_value_expr.swift
3.04s: Swift(macosx-x86_64) :: IDE/complete_unresolved_members.swift
2.07s: Swift(macosx-x86_64) :: IDE/complete_operators.swift
1.53s: Swift(macosx-x86_64) :: IDE/complete_ambiguous.swift
0.71s: Swift(macosx-x86_64) :: IDE/complete_after_self.swift
0.59s: Swift(macosx-x86_64) :: IDE/complete_value_expr_call_pattern_heuristics.swift

@rintaro
Copy link
Member Author

rintaro commented Apr 2, 2021

@swift-ci Please smoke test

@rintaro rintaro requested a review from bnbarham April 2, 2021 04:02
@rintaro
Copy link
Member Author

rintaro commented Apr 2, 2021

cc: @davezarzycki

Copy link
Member Author

@rintaro rintaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most migration are done by a script. Otherwise...

// CHECK: found code completion token
// CHECK-NOT: Begin completions

is rewritten to

// NORESULT: Token
// NORESULT-NOT: Begin completions

Also // NOCRASH: Token is for tokens previously not FileChecked at all.

Comment on lines -2134 to +1934
let _ = self.child.value.value.#^COMPLEX_CHAIN_1^#
let _ = child.value.value.#^COMPLEX_CHAIN_2^#
// COMPLEX_CHAIN_1: Begin completions, 3 items
// COMPLEX_CHAIN_1-DAG: Keyword[self]/CurrNominal: self[#Container.Struct2#]
// COMPLEX_CHAIN_1-DAG: Decl[InstanceVar]/CurrNominal: prop1[#Int#]
// COMPLEX_CHAIN_1-DAG: Decl[InstanceVar]/CurrNominal: prop2[#Int#]
// COMPLEX_CHAIN_1: End completions
let _ = self.child.value.value.#^COMPLEX_CHAIN_1?check=COMPLEX_CHAIN^#
let _ = child.value.value.#^COMPLEX_CHAIN_2?check=COMPLEX_CHAIN^#
// COMPLEX_CHAIN: Begin completions, 3 items
// COMPLEX_CHAIN-DAG: Keyword[self]/CurrNominal: self[#Struct2#]
// COMPLEX_CHAIN-DAG: Decl[InstanceVar]/CurrNominal: prop1[#Int#]
// COMPLEX_CHAIN-DAG: Decl[InstanceVar]/CurrNominal: prop2[#Int#]
// COMPLEX_CHAIN: End completions
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no check for COMPLEX_CHAIN_1 and COMPLEX_CHAIN_2

Comment on lines -84 to +37
// SKIP_DUPLICATES_PROPERTY: Decl[InstanceVar]/CurrNominal/IsSystem: count[#Int#]{{; name=.+$}}
// SKIP_DUPLICATES_PROPERTY-NOT: count[#Int#]
// SKIP_DUPLICATES_METHOD: Decl[InstanceMethod]/Super/IsSystem: formIndex({#(i): &Int#}, {#offsetBy: Int#})[#Void#]{{; name=.+$}}
// SKIP_DUPLICATES_METHOD-NOT: formIndex({#(i): &Int#}, {#offsetBy: Int#})[#Void#]
// SKIP_DUPLICATES-NOT: count[#Int#]
// SKIP_DUPLICATES-NOT: formIndex({#(i): &Int#}, {#offsetBy: Int#})[#Void#]
// SKIP_DUPLICATES: Decl[InstanceVar]/CurrNominal/IsSystem: count[#Int#]{{; name=.+$}}
// SKIP_DUPLICATES: Decl[InstanceMethod]/Super/IsSystem: formIndex({#(i): &Int#}, {#offsetBy: Int#})[#Void#]{{; name=.+$}}
// SKIP_DUPLICATES-NOT: count[#Int#]
// SKIP_DUPLICATES-NOT: formIndex({#(i): &Int#}, {#offsetBy: Int#})[#Void#]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously

// RUN: %swift-ide-test -code-completion  -source-filename %s -code-completion-token=SKIP_DUPLICATES > %t
// RUN: %FileCheck %s --input-file %t --check-prefixes=SKIP_DUPLICATES,SKIP_DUPLICATES_PROPERTY
// RUN: %FileCheck %s --input-file %t --check-prefixes=SKIP_DUPLICATES,SKIP_DUPLICATES_METHOD

We can do this by #^SKIP_DUPLICATES?check=SKIP_DUPLICATES,SKIP_DUPLICATES_PROPERTY;check=SKIP_DUPLICATES,SKIP_DUPLICATES_METHOD^# But it's not worth it.

@@ -1198,7 +994,7 @@ func testChainedCalls2() {

func testChainedCalls3() {
// doBaz() takes a Double. Check that we can recover.
SomeBuilder(42).doFoo().doBaz(SomeBuilder(24))#^CHAINED_CALLS_3^#
SomeBuilder(42).doFoo().doBaz(SomeBuilder(24))#^CHAINED_CALLS_3?xfail=FIXME^#
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunate. Previously

// Disabled because we aren't handling failures well.
// FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHAINED_CALLS_3 | %FileCheck %s -check-prefix=CHAINED_CALLS_3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better as an fail now though :)

Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, sorry, I have been meaning to do these... just keep doing other things instead.

@rintaro rintaro changed the title [CodeCompletion] Migrate some tests to batch completion test [CodeCompletion] Migrate some tests to batch completion test #1 Apr 2, 2021
@davezarzycki
Copy link
Collaborator

On my machine, this PR causes the IDE tests to drop out of the top 10 slowest tests for ninja check-swift and out of the top 20 for ninja check-swift-validation. Very nice!

@rintaro
Copy link
Member Author

rintaro commented Apr 2, 2021

Windows failures are unrelated and this PR is test only changes. Merging.

@rintaro rintaro merged commit 876a0ee into apple:main Apr 2, 2021
@rintaro rintaro deleted the ide-completion-batchtest1 branch April 2, 2021 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants