Commit 323e1d77 authored by Florian Fischer's avatar Florian Fischer
Browse files

test/io: skip tests not supported when using synchronous IO

parent f4ca362d
......@@ -4,6 +4,7 @@
#include <cerrno> // for ECANCELED, ETIME
#include <cstdint> // for uint64_t, int32_t
#include <cstdlib>
#include <memory>
#include <ostream>
......@@ -149,6 +150,8 @@ static void massCancelOnDifferentWorker() {
}
void emperTest() {
if constexpr (emper::IO_SYNCHRONOUS) exit(77);
efd = eventfd(0, 0);
if (efd == -1) {
DIE_MSG_ERRNO("eventfd failed");
......
......@@ -25,7 +25,7 @@
#define BUF_SIZE 1024
auto main(int argc, char* argv[]) -> int {
if constexpr (!emper::IO) {
if constexpr (!emper::IO || emper::IO_SYNCHRONOUS) {
exit(77);
}
......
......@@ -2,8 +2,10 @@
// Copyright © 2020-2021 Florian Fischer
#include <cerrno> // for ETIME
#include <cstdint> // for int32_t
#include <cstdlib>
#include "BinaryPrivateSemaphore.hpp"
#include "Emper.hpp"
#include "emper.hpp"
#include "fixtures/assert.hpp"
#include "io/Future.hpp" // for AlarmFuture
......@@ -64,6 +66,8 @@ static void blockingCallbackTest() {
}
void emperTest() {
if constexpr (emper::IO_SYNCHRONOUS) exit(77);
signallingCallbackTest();
spawningCallbackTest();
blockingCallbackTest();
......
......@@ -3,9 +3,11 @@
#include <unistd.h> // for pipe
#include <cstdint> // for uint64_t, int32_t
#include <cstdlib>
#include <cstring> // for memcmp
#include "Common.hpp"
#include "Emper.hpp"
#include "fixtures/assert.hpp"
#include "io/Future.hpp" // for ReadFuture, CloseFuture, WriteFuture
......@@ -16,6 +18,8 @@ using emper::io::WriteFuture;
static const size_t MEMSIZE = 10 << 20;
void emperTest() {
if constexpr (emper::IO_SYNCHRONOUS) exit(77);
auto* memOut = new char[MEMSIZE];
auto* memIn = new char[MEMSIZE];
// NOLINTNEXTLINE(modernize-avoid-c-arrays)
......
......@@ -7,9 +7,11 @@
#include <array>
#include <cerrno> // for EBADF, ECANCELED
#include <cstdint> // for uint64_t, int32_t
#include <cstdlib>
#include "Common.hpp" // for DIE_MSG_ERRNO, DIE_MSG
#include "Debug.hpp"
#include "Emper.hpp"
#include "emper-config.h"
#include "fixtures/assert.hpp"
#include "io.hpp"
......@@ -129,6 +131,8 @@ static void failureChainCorInvCor() {
}
void emperTest() {
if constexpr (emper::IO_SYNCHRONOUS) exit(77);
// Test if a invalid chain leaves the IoContext in an unexpected / invalid state
failureChainCorInvCor();
successChain();
......
......@@ -13,6 +13,7 @@
#include "Common.hpp"
#include "Debug.hpp"
#include "Emper.hpp"
#include "Runtime.hpp"
#include "fixtures/assert.hpp"
#include "fixtures/network.hpp"
......@@ -159,4 +160,7 @@ static void testIov() {
void emperTest() {
testDiskAndNetwork();
testIov();
// The blocking accept4 done by the tcp_listener will never return and thus prevent
// the Runtime from terminating properly.
if constexpr (emper::IO_SYNCHRONOUS) exit(0);
}
......@@ -6,12 +6,14 @@
#include <cerrno>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <memory>
#include "Common.hpp"
#include "CountingPrivateSemaphore.hpp"
#include "Debug.hpp"
#include "Emper.hpp"
#include "Future.hpp"
#include "emper.hpp"
#include "fixtures/assert.hpp"
......@@ -131,6 +133,8 @@ void writeTest() {
}
void emperTest() {
if constexpr (emper::IO_SYNCHRONOUS) exit(77);
sockTest();
readTest();
writeTest();
......
......@@ -4,8 +4,10 @@
#include <cerrno> // for ECANCELED, ETIME
#include <cstdint> // for uint64_t, int32_t
#include <cstdlib>
#include "Common.hpp"
#include "Emper.hpp"
#include "fixtures/assert.hpp"
#include "io/Future.hpp" // for ReadFuture, TimeoutWrapper
......@@ -13,6 +15,8 @@ using emper::io::ReadFuture;
using emper::io::TimeoutWrapper;
void emperTest() {
if constexpr (emper::IO_SYNCHRONOUS) exit(77);
int efd = eventfd(0, EFD_SEMAPHORE);
if (efd == -1) {
DIE_MSG_ERRNO("eventfd failed");
......
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2020-2021 Florian Fischer
#include <array>
#include <cstddef>
#include <cstdlib>
#include "Emper.hpp"
#include "emper-config.h" // for EMPER_IO_WORKER_URING_ENTRIES
#include "io/Future.hpp" // for AlarmFuture
using emper::io::AlarmFuture;
void emperTest() {
if constexpr (emper::IO_SYNCHRONOUS) exit(77);
const size_t links = static_cast<size_t>(EMPER_IO_WORKER_URING_ENTRIES) * 2;
std::array<AlarmFuture*, links> futures;
AlarmFuture::Timespec ts = {.tv_sec = 0, .tv_nsec = 100};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment