Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
emper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Fischer
emper
Commits
e1aa4ff9
Commit
e1aa4ff9
authored
3 years ago
by
Florian Schmaus
Browse files
Options
Downloads
Patches
Plain Diff
[SimpleFibTest] Use EMPER's test runner
parent
c156e1a9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/SimpleFibTest.cpp
+11
-26
11 additions, 26 deletions
tests/SimpleFibTest.cpp
tests/meson.build
+1
-0
1 addition, 0 deletions
tests/meson.build
with
12 additions
and
26 deletions
tests/SimpleFibTest.cpp
+
11
−
26
View file @
e1aa4ff9
// 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
);
}
}
This diff is collapsed.
Click to expand it.
tests/meson.build
+
1
−
0
View file @
e1aa4ff9
...
...
@@ -11,6 +11,7 @@ tests = [
'source'
:
files
(
'SimpleFibTest.cpp'
),
'name'
:
'SimpleFibTest'
,
'description'
:
'Simple test'
,
'test_runner'
:
'emper'
,
},
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment