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

[Windows] Missing 'sleep()' for MSVC #10295

Closed
wants to merge 1 commit into from
Closed

[Windows] Missing 'sleep()' for MSVC #10295

wants to merge 1 commit into from

Conversation

gvanem
Copy link
Contributor

@gvanem gvanem commented Jan 13, 2023

Done similar to how lib1515.c and lib1542.c does it for Windows.
Although MinGW do have sleep(), this patch should not hurt.
But perhaps add this to test.h instead?

@bagder
Copy link
Member

bagder commented Jan 13, 2023

But perhaps add this to test.h instead?

That seems clever:

$ git grep -l 'sleep(' *.c
lib1515.c
lib1542.c
lib2301.c
lib2302.c
lib2304.c

@bagder bagder added tests Windows Windows-specific labels Jan 13, 2023
@jay
Copy link
Member

jay commented Jan 15, 2023

I agree. server\util.h already does something similar:

curl/tests/server/util.h

Lines 45 to 49 in c12fb3d

#ifdef WIN32
#include <process.h>
#include <fcntl.h>
#define sleep(sec) Sleep ((sec)*1000)

@gvanem
Copy link
Contributor Author

gvanem commented Jan 16, 2023

So what about this PR? Should I or @bagder merge it and change the other files in another PR?

@jay
Copy link
Member

jay commented Jan 16, 2023

So what about this PR?

You could update this PR with your proposed changes then force push to lib2304-sleep, for example

git checkout lib2304-sleep
#make changes
#stage changes using git gui or some other way
git commit --amend
git push -f

curl_setup.h is included by test.h so you don't need to check _WIN32 just WIN32

curl/lib/curl_setup.h

Lines 48 to 50 in c12fb3d

#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
#define WIN32
#endif

Review push access guidelines, specifically commit style, for example libtest: add sleep() macro for Windows

@gvanem
Copy link
Contributor Author

gvanem commented Jan 16, 2023

You could update this PR

Sorry, no. That's beyond my git knowledge.

@jay
Copy link
Member

jay commented Jan 17, 2023

Ok, I understand that, but it doesn't have to be. Amending a single commit can be done in git gui. If you can't or don't want to do that then you could add another commit to this branch with the new changes and I will squash them together (essentially, your existing changes in lib2304 would disappear) before I commit it.

(Also, as described in the guidelines you should work in your own fork of the curl repo. There are some exceptions for this suchas @bagder.)

Here's a screenshot from git gui

Capture

@jay
Copy link
Member

jay commented Jan 26, 2023

@gvanem if you want I can finish this

@gvanem
Copy link
Contributor Author

gvanem commented Jan 26, 2023

@jay Yes, please do.

jay pushed a commit that referenced this pull request Feb 2, 2023
.. because sleep() is used in some libtests.

Closes #10295
.. because sleep() is used in some libtests.

Closes #10295
@jay jay closed this in 62097a7 Feb 5, 2023
@jay
Copy link
Member

jay commented Feb 5, 2023

Thanks

@jay jay deleted the lib2304-sleep branch February 5, 2023 08:19
bch pushed a commit to bch/curl that referenced this pull request Jul 19, 2023
.. because sleep() is used in some libtests.

Closes curl#10295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Windows Windows-specific
Development

Successfully merging this pull request may close these issues.

None yet

4 participants