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
1ba83df1
Commit
1ba83df1
authored
7 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
do not count poll-type variables in the testable mode, since this would lead to hanging tests
parent
a123b18f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/Application.h
+3
-0
3 additions, 0 deletions
include/Application.h
include/TestDecoratorRegisterAccessor.h
+7
-1
7 additions, 1 deletion
include/TestDecoratorRegisterAccessor.h
src/Application.cc
+13
-4
13 additions, 4 deletions
src/Application.cc
with
23 additions
and
5 deletions
include/Application.h
+
3
−
0
View file @
1ba83df1
...
...
@@ -247,6 +247,9 @@ namespace ChimeraTK {
/** Map of unique IDs to namess, used along with testableMode_perVarCounter to print sensible information. */
std
::
map
<
size_t
,
std
::
string
>
testableMode_names
;
/** Map of unique IDs to process variables which have been decorated with the TestDecoratorRegisterAccessor. */
std
::
map
<
size_t
,
boost
::
shared_ptr
<
TransferElement
>>
testableMode_processVars
;
template
<
typename
UserType
>
friend
class
TestDecoratorRegisterAccessor
;
// needs access to the testableMode_mutex and testableMode_counter
...
...
This diff is collapsed.
Click to expand it.
include/TestDecoratorRegisterAccessor.h
+
7
−
1
View file @
1ba83df1
...
...
@@ -90,6 +90,7 @@ namespace ChimeraTK {
_accessor
(
accessor
)
{
buffer_2D
.
resize
(
_accessor
->
getNumberOfChannels
());
for
(
size_t
i
=
0
;
i
<
_accessor
->
getNumberOfChannels
();
++
i
)
buffer_2D
[
i
]
=
_accessor
->
accessChannel
(
i
);
Application
::
getInstance
().
testableMode_processVars
[
getUniqueId
()]
=
accessor
;
}
virtual
~
TestDecoratorRegisterAccessor
()
{}
...
...
@@ -133,7 +134,12 @@ namespace ChimeraTK {
}
bool
doReadTransferLatest
()
override
{
return
_accessor
->
doReadTransferLatest
();
bool
retval
=
_accessor
->
doReadTransferLatest
();
// the queue has been emptied, so make sure that the testableMode_counter reflects this
auto
&
app
=
Application
::
getInstance
();
app
.
testableMode_counter
-=
app
.
testableMode_perVarCounter
[
_accessor
->
getUniqueId
()];
return
retval
;
}
TransferFuture
&
readAsync
()
override
{
...
...
This diff is collapsed.
Click to expand it.
src/Application.cc
+
13
−
4
View file @
1ba83df1
...
...
@@ -298,6 +298,7 @@ boost::shared_ptr<mtca4u::NDRegisterAccessor<UserType>> Application::createProce
// decorate the process variable if testable mode is enabled and this is the receiving end of the variable
// don't decorate if the feeding side is a constant!
/// @todo if the mode is polling, do not decorate on both sides!
if
(
testableMode
&&
node
.
getDirection
()
==
VariableDirection
::
feeding
&&
node
.
getType
()
!=
NodeType
::
Constant
)
{
auto
pvarDec
=
boost
::
make_shared
<
TestDecoratorRegisterAccessor
<
UserType
>>
(
pvar
);
testableMode_names
[
pvarDec
->
getUniqueId
()]
=
"ControlSystem:"
+
node
.
getPublicName
();
...
...
@@ -324,8 +325,8 @@ std::pair< boost::shared_ptr<mtca4u::NDRegisterAccessor<UserType>>, boost::share
assert
(
pvarPair
.
first
->
getName
()
!=
""
);
assert
(
pvarPair
.
second
->
getName
()
!=
""
);
// decorate the process variable if testable mode is enabled
if
(
testableMode
)
{
// decorate the process variable if testable mode is enabled
and mode is push-type
if
(
testableMode
&&
node
.
getMode
()
==
UpdateMode
::
push
)
{
std
::
pair
<
boost
::
shared_ptr
<
mtca4u
::
NDRegisterAccessor
<
UserType
>>
,
boost
::
shared_ptr
<
mtca4u
::
NDRegisterAccessor
<
UserType
>>
>
pvarPairDec
;
pvarPairDec
.
first
=
boost
::
make_shared
<
TestDecoratorRegisterAccessor
<
UserType
>>
(
pvarPair
.
first
);
...
...
@@ -819,10 +820,18 @@ void Application::testableModeLock(const std::string& name) {
if
(
getInstance
().
testableMode_repeatingMutexOwner
>
1000
)
{
// print an informative message first, which lists also all variables currently containing unread data.
std
::
cout
<<
"*** Tests are stalled due to data which has been sent but not received."
<<
std
::
endl
;
std
::
cout
<<
" The following variables still contain unread values:"
<<
std
::
endl
;
std
::
cout
<<
" The following variables still contain unread values
or had data loss due to a queue overflow
:"
<<
std
::
endl
;
for
(
auto
&
pair
:
Application
::
getInstance
().
testableMode_perVarCounter
)
{
if
(
pair
.
second
>
0
)
{
std
::
cout
<<
" - "
<<
Application
::
getInstance
().
testableMode_names
[
pair
.
first
]
<<
std
::
endl
;
std
::
cout
<<
" - "
<<
Application
::
getInstance
().
testableMode_names
[
pair
.
first
];
// check if process variable still has data in the queue
if
(
getInstance
().
testableMode_processVars
[
pair
.
first
]
->
readNonBlocking
())
{
std
::
cout
<<
" (unread data in queue)"
;
}
else
{
std
::
cout
<<
" (data loss)"
;
}
std
::
cout
<<
std
::
endl
;
}
}
// throw an exception which cannot be caught (other than with catch all). This makes sure that the tests fail
...
...
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