Summary:
Because event file descriptors don't exist on Windows.
This also disables the fork() test on Windows, as we don't have fork().
Reviewed By: yfeldblum
Differential Revision:
D3766266
fbshipit-source-id:
af8d81615957a3d7bdfcb204afbf648723921f76
#include <iostream>
#include <thread>
#include <sys/types.h>
#include <iostream>
#include <thread>
#include <sys/types.h>
class QueueTest {
public:
class QueueTest {
public:
- explicit QueueTest(uint32_t maxSize = 0,
- IntQueue::FdType type = IntQueue::FdType::EVENTFD) :
- queue(maxSize, type),
- terminationQueue(maxSize, type)
- {}
+ explicit QueueTest(uint32_t maxSize, IntQueue::FdType type)
+ : queue(maxSize, type), terminationQueue(maxSize, type) {}
void sendOne();
void putMessages();
void sendOne();
void putMessages();
-TEST(NotificationQueueTest, SendOne) {
- QueueTest qt;
+#ifdef FOLLY_HAVE_EVENTFD
+TEST(NotificationQueueTest, SendOneEventFD) {
+ QueueTest qt(0, IntQueue::FdType::EVENTFD);
-TEST(NotificationQueueTest, PutMessages) {
- QueueTest qt;
+TEST(NotificationQueueTest, PutMessagesEventFD) {
+ QueueTest qt(0, IntQueue::FdType::EVENTFD);
-TEST(NotificationQueueTest, MultiConsumer) {
- QueueTest qt;
+TEST(NotificationQueueTest, MultiConsumerEventFD) {
+ QueueTest qt(0, IntQueue::FdType::EVENTFD);
-TEST(NotificationQueueTest, MaxQueueSize) {
- QueueTest qt(5);
+TEST(NotificationQueueTest, MaxQueueSizeEventFD) {
+ QueueTest qt(5, IntQueue::FdType::EVENTFD);
-TEST(NotificationQueueTest, MaxReadAtOnce) {
- QueueTest qt;
+TEST(NotificationQueueTest, MaxReadAtOnceEventFD) {
+ QueueTest qt(0, IntQueue::FdType::EVENTFD);
-TEST(NotificationQueueTest, DestroyCallback) {
- QueueTest qt;
+TEST(NotificationQueueTest, DestroyCallbackEventFD) {
+ QueueTest qt(0, IntQueue::FdType::EVENTFD);
TEST(NotificationQueueTest, SendOnePipe) {
QueueTest qt(0, IntQueue::FdType::PIPE);
TEST(NotificationQueueTest, SendOnePipe) {
QueueTest qt(0, IntQueue::FdType::PIPE);
/*
* Test code that creates a NotificationQueue, then forks, and incorrectly
* tries to send a message to the queue from the child process.
/*
* Test code that creates a NotificationQueue, then forks, and incorrectly
* tries to send a message to the queue from the child process.
EXPECT_EQ(5678, consumer.messages.front());
consumer.messages.pop_front();
}
EXPECT_EQ(5678, consumer.messages.front());
consumer.messages.pop_front();
}
TEST(NotificationQueueConsumer, make) {
int value = 0;
TEST(NotificationQueueConsumer, make) {
int value = 0;