From e1aa4ff9eea0f8e3bdad3c6245404245297fb5de Mon Sep 17 00:00:00 2001 From: Florian Schmaus <flow@cs.fau.de> Date: Mon, 12 Apr 2021 13:49:12 +0200 Subject: [PATCH] [SimpleFibTest] Use EMPER's test runner --- tests/SimpleFibTest.cpp | 37 +++++++++++-------------------------- tests/meson.build | 1 + 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/tests/SimpleFibTest.cpp b/tests/SimpleFibTest.cpp index 79bd1f72..ae3d698e 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 723ba5fb..f2d4ef05 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', }, { -- GitLab