diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e50b47bdf6d04c968a2823c2645574bd9b88f519..e4c194338c481d65f6c1d9eb488d9f9f4e3dc95a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -125,6 +125,10 @@ clang-tidy: variables: EMPER_USERSPACE_RCU: 'true' +.emper-no-io: + variables: + EMPER_IO: 'false' + .emper-pipe-sleep-strategy: variables: EMPER_WORKER_SLEEP_STRATEGY: 'pipe' @@ -369,6 +373,11 @@ test-mmapped-log: - .meson-test script: make && EMPER_LOG_FILE=emper.log make test +test-no-io: + extends: + - .test + - .emper-no-io + test-single-uring: extends: - .test diff --git a/tests/ScheduleOnTest.cpp b/tests/ScheduleOnTest.cpp index f458a99dd16ed3557d7c9d848334bcb406c23598..6b7f5ceb69e095d42a84103bca27e1dd6805e7d4 100644 --- a/tests/ScheduleOnTest.cpp +++ b/tests/ScheduleOnTest.cpp @@ -1,6 +1,10 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // Copyright © 2021 Florian Fischer +#include <chrono> +#include <thread> + #include "CountingPrivateSemaphore.hpp" +#include "Emper.hpp" #include "Fiber.hpp" #include "Runtime.hpp" #include "Worker.hpp" @@ -25,7 +29,12 @@ static void scheduleOnTest() { ASSERT(runtime); workerCount = runtime->getWorkerCount(); - emper::sleep(1); + // Wait so all workers can suspend themselves + if constexpr (emper::IO) { + emper::sleep(1); + } else { // We can not sleep using emper mechanisms -> block the worker thread + std::this_thread::sleep_for(std::chrono::seconds(1)); + } CPS cps(1); runtime->scheduleOn(*Fiber::from([&] { runOn(cps); }), (iteration % workerCount));