diff --git a/tests/SimpleFibTest.cpp b/tests/SimpleFibTest.cpp index 79bd1f725a7dcc0b2cf209b4ae341a977e71d886..ae3d698e9d4595938597d617f6ff298c0a06c5c8 100644 --- a/tests/SimpleFibTest.cpp +++ b/tests/SimpleFibTest.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright © 2020 Florian Schmaus +// Copyright © 2020-2021 Florian Schmaus #include <cstdlib> // for exit, EXIT_FAILURE, EXIT_SUC... #include "BinaryPrivateSemaphore.hpp" // for BPS @@ -7,7 +7,6 @@ #include "Fiber.hpp" // for Fiber #include "PrivateSemaphore.hpp" // for PS #include "Runtime.hpp" // for Runtime -#include "emper-common.h" // for UNUSED_ARG using fibParams = struct { int n; @@ -52,31 +51,17 @@ static void fib(void* voidParams) { sem->signalAndExit(); } -auto main(UNUSED_ARG int argc, UNUSED_ARG char* argv[]) -> int { - Runtime runtime; +void emperTest() { + const int fibNum = 13; + int result; + BPS sem; + fibParams params = {fibNum, &result, &sem}; - Fiber* fibFiber = Fiber::from( - [](UNUSED_ARG void* arg) { - const int fibNum = 13; - int result; - BPS sem; - fibParams params = {fibNum, &result, &sem}; + fib(¶ms); - fib(¶ms); + sem.wait(); - sem.wait(); - - if (result != 233) { - exit(EXIT_FAILURE); - } - - exit(EXIT_SUCCESS); - }, - nullptr); - - runtime.scheduleFromAnywhere(*fibFiber); - - runtime.waitUntilFinished(); - - return EXIT_FAILURE; + if (result != 233) { + exit(EXIT_FAILURE); + } } diff --git a/tests/meson.build b/tests/meson.build index 723ba5fb3ec6f7e7666917b56c1b4d32156dba31..f2d4ef05966c34b216ebc1405d402d5efde34508 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -11,6 +11,7 @@ tests = [ 'source': files('SimpleFibTest.cpp'), 'name': 'SimpleFibTest', 'description': 'Simple test', + 'test_runner': 'emper', }, {