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

Conversation

bnbarham
Copy link
Contributor

@bnbarham bnbarham commented Dec 10, 2020

These tests relied on timing between completion runs in order to check
that fast completion was working properly for completions in VFS files.
That is, they would assume that two runs happening one after another
without a sleep inbetween would always run fast completion.

However, that's not necessarily the case and there have been cases where
a dependency check happens despite its interval being fairly long
(multi-second).

This change simulates the same behaviour by changing the interval
between 0/100, which should prevent any timing issues.

Resolves rdar://72144331

@bnbarham bnbarham requested a review from rintaro December 10, 2020 23:20
@bnbarham bnbarham force-pushed the fix-flakey-vfs-tests branch from 3dd5f3b to fd2cb30 Compare December 10, 2020 23:21
// 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 👍

These tests relied on timing between completion runs in order to check
that fast completion was working properly for completions in VFS files.
That is, they would assume that two runs happening one after another
without a sleep inbetween would always run fast completion.

However, that's not necessarily the case and there have been cases where
a dependency check happens despite its interval being fairly long
(multi-second).

This change emulates the same behaviour by changing the interval
between 0/100, which should prevent any timing issues.

Resolves rdar://72144331
@bnbarham bnbarham force-pushed the fix-flakey-vfs-tests branch from fd2cb30 to 68f89d4 Compare December 10, 2020 23:22
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@bnbarham bnbarham merged commit f7d0cff into swiftlang:main Dec 11, 2020
@bnbarham bnbarham deleted the fix-flakey-vfs-tests branch December 11, 2020 02:56
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.

2 participants