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

Fix test compilation errors on Windows #144

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mheily
Copy link
Owner

@mheily mheily commented Jun 21, 2022

No description provided.

@mheily mheily linked an issue Jun 21, 2022 that may be closed by this pull request
* Disable EVFILT_PROC as this is not supported.

* Initialize kevent() timeouts using an older syntax.

* Use Sleep() instead of usleep().

* Disable test_transition_from_write_to_read().

* Emulate the POSIX API for shutdown(2) and pipe(2).
@mheily
Copy link
Owner Author

mheily commented Jun 21, 2022

The tests don't actually run successfully, but at least they compile.

@mheily mheily changed the title Always enable testing Fix test compilation errors on Windows Jun 21, 2022

EV_SET(&kev, 0, EVFILT_LIBKQUEUE, EV_ADD, NOTE_VERSION, 0, NULL);
if (kevent(ctx->kqfd, &kev, 1, &receipt, 1, &(struct timespec){}) != 1) {
if (kevent(ctx->kqfd, &kev, 1, &receipt, 1, &ts) != 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Windows still doesn't support C11?!

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think it still doesn't support compound literals. I even tried enabling the latest conforming preprocessor:

https://devblogs.microsoft.com/cppblog/announcing-full-support-for-a-c-c-conformant-preprocessor-in-msvc/

#define SHUT_RDWR SD_BOTH

/* Emulate the POSIX pipe(2) interface */
#define pipe(x) _pipe(x, 512, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd wrap a lot of these in ifdef _MSC_VER

MinGW supports a lot of this, including pthread.

@@ -16,6 +16,12 @@

#include "common.h"

#if defined(_WIN32)
Copy link
Contributor

Choose a reason for hiding this comment

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

MinGW supports usleep.

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.

tests fail to compile on Windows
3 participants