Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
c457d3fc
Commit
c457d3fc
authored
4 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
fix data races in a test
parent
4733710a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/executables_src/testDeviceExceptionFlagPropagation.cc
+13
-6
13 additions, 6 deletions
tests/executables_src/testDeviceExceptionFlagPropagation.cc
with
13 additions
and
6 deletions
tests/executables_src/testDeviceExceptionFlagPropagation.cc
+
13
−
6
View file @
c457d3fc
...
@@ -50,11 +50,21 @@ struct TestApplication : ctk::Application {
...
@@ -50,11 +50,21 @@ struct TestApplication : ctk::Application {
ctk
::
ScalarOutput
<
int
>
set
{
this
,
"actuator"
,
""
,
""
};
ctk
::
ScalarOutput
<
int
>
set
{
this
,
"actuator"
,
""
,
""
};
}
vars
{
this
,
"vars"
,
""
,
ctk
::
HierarchyModifier
::
hideThis
};
}
vars
{
this
,
"vars"
,
""
,
ctk
::
HierarchyModifier
::
hideThis
};
void
prepare
()
override
{
vars
.
set
.
write
();
/* send intial value */
}
std
::
atomic
<
ctk
::
DataValidity
>
readDataValidity
;
void
prepare
()
override
{
readDataValidity
=
vars
.
read
.
dataValidity
();
// The receiving end of all accessor implementations should be constructed with faulty (Initial value propagation
// spec, D.1)
BOOST_CHECK
(
readDataValidity
==
ctk
::
DataValidity
::
faulty
);
vars
.
set
.
write
();
/* send intial value */
}
void
mainLoop
()
override
{
void
mainLoop
()
override
{
readDataValidity
=
vars
.
read
.
dataValidity
();
while
(
true
)
{
while
(
true
)
{
vars
.
tick
.
read
();
vars
.
tick
.
read
();
readDataValidity
=
vars
.
read
.
dataValidity
();
switch
(
readMode
)
{
switch
(
readMode
)
{
case
0
:
case
0
:
vars
.
read
.
readNonBlocking
();
vars
.
read
.
readNonBlocking
();
...
@@ -99,9 +109,6 @@ BOOST_AUTO_TEST_CASE(testDirectConnectOpen) {
...
@@ -99,9 +109,6 @@ BOOST_AUTO_TEST_CASE(testDirectConnectOpen) {
ctk
::
TestFacility
test
(
false
);
ctk
::
TestFacility
test
(
false
);
// The receiving end of all accessor implementations should be constructed with faulty (Initial value propagation spec, D.1)
BOOST_CHECK
(
app
.
module
.
vars
.
read
.
dataValidity
()
==
ctk
::
DataValidity
::
faulty
);
// Throw on device open and check if DataValidity::faulty gets propagated
// Throw on device open and check if DataValidity::faulty gets propagated
dummyBackend1
->
throwExceptionOpen
=
true
;
dummyBackend1
->
throwExceptionOpen
=
true
;
// set the read mode
// set the read mode
...
@@ -113,11 +120,11 @@ BOOST_AUTO_TEST_CASE(testDirectConnectOpen) {
...
@@ -113,11 +120,11 @@ BOOST_AUTO_TEST_CASE(testDirectConnectOpen) {
// Trigger and check
// Trigger and check
app
.
name
.
name
.
tick
.
write
();
app
.
name
.
name
.
tick
.
write
();
usleep
(
10000
);
usleep
(
10000
);
BOOST_CHECK
(
app
.
module
.
vars
.
read
.
d
ataValidity
()
==
ctk
::
DataValidity
::
faulty
);
BOOST_CHECK
(
app
.
module
.
read
D
ataValidity
==
ctk
::
DataValidity
::
faulty
);
// recover from error state
// recover from error state
dummyBackend1
->
throwExceptionOpen
=
false
;
dummyBackend1
->
throwExceptionOpen
=
false
;
CHECK_TIMEOUT
(
app
.
module
.
vars
.
read
.
d
ataValidity
()
==
ctk
::
DataValidity
::
ok
,
10000
);
CHECK_TIMEOUT
(
app
.
module
.
read
D
ataValidity
==
ctk
::
DataValidity
::
ok
,
10000
);
}
}
}
}
...
...
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