Skip to content

[SourceKit] Fix flakey VFS completion tests #35042

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

Merged
merged 1 commit into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions test/SourceKit/CodeComplete/complete_checkdeps_vfs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,30 @@ func foo(value: MyStruct) {

// REQUIRES: shell

// RUN: DEPCHECK_INTERVAL=2
// RUN: SLEEP_TIME=3

// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/VFS)
// RUN: cp %S/Inputs/checkdeps/MyProject/LibraryExt.swift %t/VFS/

// RUN: %sourcekitd-test \
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=${DEPCHECK_INTERVAL} == \
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=100 == \

// RUN: -shell -- echo "### Initial" == \
// RUN: -req=complete -pos=2:9 -pass-as-sourcetext -vfs-files=%t/VFS/Main.swift=@%s,%t/VFS/Library.swift=@%S/Inputs/checkdeps/MyProject/Library.swift %t/VFS/Main.swift -- -target %target-triple %t/VFS/Main.swift %t/VFS/LibraryExt.swift %t/VFS/Library.swift == \

// RUN: -shell -- echo "### Modify" == \
// RUN: -shell -- sleep ${SLEEP_TIME} == \
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=0 == \
// RUN: -req=complete -pos=2:9 -pass-as-sourcetext -vfs-files=%t/VFS/Main.swift=@%s,%t/VFS/Library.swift=@%S/Inputs/checkdeps/MyProject_mod/Library.swift %t/VFS/Main.swift -- -target %target-triple %t/VFS/Main.swift %t/VFS/LibraryExt.swift %t/VFS/Library.swift == \

// RUN: -shell -- echo "### Keep" == \
// RUN: -shell -- sleep ${SLEEP_TIME} == \
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=0 == \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not strictly required but I thought it made the behaviour we're emulating slightly more obvious, let me know if you'd prefer it removed.

Copy link
Member

Choose a reason for hiding this comment

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

Let's keep it 👍

// RUN: -req=complete -pos=2:9 -pass-as-sourcetext -vfs-files=%t/VFS/Main.swift=@%s,%t/VFS/Library.swift=@%S/Inputs/checkdeps/MyProject_mod/Library.swift %t/VFS/Main.swift -- -target %target-triple %t/VFS/Main.swift %t/VFS/LibraryExt.swift %t/VFS/Library.swift == \

// RUN: -shell -- echo "### Rollback without sleep" == \
// RUN: -shell -- echo "### Rollback without check" == \
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=100 == \
// RUN: -req=complete -pos=2:9 -pass-as-sourcetext -vfs-files=%t/VFS/Main.swift=@%s,%t/VFS/Library.swift=@%S/Inputs/checkdeps/MyProject/Library.swift %t/VFS/Main.swift -- -target %target-triple %t/VFS/Main.swift %t/VFS/LibraryExt.swift %t/VFS/Library.swift == \

// RUN: -shell -- echo "### After sleep" == \
// RUN: -shell -- sleep ${SLEEP_TIME} == \
// RUN: -shell -- echo "### Check" == \
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=0 == \
// RUN: -req=complete -pos=2:9 -pass-as-sourcetext -vfs-files=%t/VFS/Main.swift=@%s,%t/VFS/Library.swift=@%S/Inputs/checkdeps/MyProject/Library.swift %t/VFS/Main.swift -- -target %target-triple %t/VFS/Main.swift %t/VFS/LibraryExt.swift %t/VFS/Library.swift \

// RUN: | %FileCheck %s
Expand Down Expand Up @@ -58,15 +56,15 @@ func foo(value: MyStruct) {
// CHECK: ]
// CHECK: key.reusingastcontext: 1

// CHECK-LABEL: ### Rollback without sleep
// CHECK-LABEL: ### Rollback without check
// CHECK: key.results: [
// CHECK-DAG: key.description: "myStructMethod_mod()"
// CHECK-DAG: key.description: "extensionMethod()"
// CHECK-DAG: key.description: "self"
// CHECK: ]
// CHECK: key.reusingastcontext: 1

// CHECK-LABEL: ### After sleep
// CHECK-LABEL: ### Check
// CHECK: key.results: [
// CHECK-DAG: key.description: "myStructMethod()"
// CHECK-DAG: key.description: "extensionMethod()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,24 @@ func foo(value: MyStruct) {

// REQUIRES: shell

// RUN: DEPCHECK_INTERVAL=1
// RUN: SLEEP_TIME=2

// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/VFS)
// RUN: cp %S/Inputs/checkdeps/MyProject/LibraryExt.swift %t/VFS/

// RUN: %sourcekitd-test \
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=${DEPCHECK_INTERVAL} == \
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=100 == \

// RUN: -shell -- echo "### Initial" == \
// RUN: -req=complete.open -pos=2:9 -pass-as-sourcetext -vfs-files=%t/VFS/Main.swift=@%s,%t/VFS/Library.swift=@%S/Inputs/checkdeps/MyProject/Library.swift %t/VFS/Main.swift -- -target %target-triple %t/VFS/Main.swift %t/VFS/LibraryExt.swift %t/VFS/Library.swift == \
// RUN: -req=complete.close -pos=2:9 -name %t/VFS/Main.swift %s == \

// RUN: -shell -- echo "### Modify" == \
// RUN: -shell -- sleep ${SLEEP_TIME} == \
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=0 == \
// RUN: -req=complete.open -pos=2:9 -pass-as-sourcetext -vfs-files=%t/VFS/Main.swift=@%s,%t/VFS/Library.swift=@%S/Inputs/checkdeps/MyProject_mod/Library.swift %t/VFS/Main.swift -- -target %target-triple %t/VFS/Main.swift %t/VFS/LibraryExt.swift %t/VFS/Library.swift == \
// RUN: -req=complete.close -pos=2:9 -name %t/VFS/Main.swift %s == \

// RUN: -shell -- echo "### Keep" == \
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=100 == \
// RUN: -req=complete.open -pos=2:9 -pass-as-sourcetext -vfs-files=%t/VFS/Main.swift=@%s,%t/VFS/Library.swift=@%S/Inputs/checkdeps/MyProject_mod/Library.swift %t/VFS/Main.swift -- -target %target-triple %t/VFS/Main.swift %t/VFS/LibraryExt.swift %t/VFS/Library.swift == \
// RUN: -req=complete.close -pos=2:9 -name %t/VFS/Main.swift %s \

Expand Down