Skip to content

SourceKit: use std::chrono in unittests #22058

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
Jan 24, 2019
Merged

Conversation

compnerd
Copy link
Member

Rather than using the usleep function which is both deprecated and
non-portable (does not exist on Windows), prefer using the C++11 chrono library
for the sleep. This also allows us to use the UDL to simplify the code rather
than relying on the comments. NFCI

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@compnerd
Copy link
Member Author

CC: @benlangmuir @akyrtzi

@compnerd
Copy link
Member Author

@swift-ci please test

@benlangmuir
Copy link
Contributor

The comment implies that you're changing to not use usleep, but in fact it still calls usleep. Did you mean to use std::this_thread::sleep_for or something similar?

@compnerd
Copy link
Member Author

😒 I are dum-dums. Yes, that should be a std::this_thread::sleep_for. I swear I had that changed! I hate pushing from a different machine than what I'm testing on.

@compnerd
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - e2ed661f717189be667e43a5f7641a095868d4cc

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - e2ed661f717189be667e43a5f7641a095868d4cc

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - e2ed661f717189be667e43a5f7641a095868d4cc

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - e2ed661f717189be667e43a5f7641a095868d4cc

@compnerd
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 15f6854de533dd3b637f0331a1dcd1041b9ff8c7

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 15f6854de533dd3b637f0331a1dcd1041b9ff8c7

@benlangmuir
Copy link
Contributor

Hmm, could we have an issue because we're building with -std=c++11? The literal operators are a C++14ism, I think.

@compnerd
Copy link
Member Author

Hmm, okay, well, thats easy to deal with (std::chrono::*seconds)

Rather than using the `usleep` function which is both deprecated and
non-portable (does not exist on Windows), prefer using the C++11 chrono library
for the sleep.  This also allows us to use the UDL to simplify the code rather
than relying on the comments.  NFCI
@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 15f6854de533dd3b637f0331a1dcd1041b9ff8c7

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@benlangmuir any concerns with this now?

Copy link
Contributor

@benlangmuir benlangmuir left a comment

Choose a reason for hiding this comment

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

LGTM

@compnerd compnerd merged commit 159b4ef into swiftlang:master Jan 24, 2019
@compnerd compnerd deleted the chrono branch January 24, 2019 00:47
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.

3 participants