Skip to content
Snippets Groups Projects
Commit e1aa4ff9 authored by Florian Schmaus's avatar Florian Schmaus
Browse files

[SimpleFibTest] Use EMPER's test runner

parent c156e1a9
No related branches found
No related tags found
No related merge requests found
// 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(&params);
fib(&params);
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);
}
}
......@@ -11,6 +11,7 @@ tests = [
'source': files('SimpleFibTest.cpp'),
'name': 'SimpleFibTest',
'description': 'Simple test',
'test_runner': 'emper',
},
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment