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
e67842ba
Commit
e67842ba
authored
5 years ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
StatusMonitor: simplified tests. MinMonitor, MaxMonitor and RangeMonitor all use >= and <=
parent
1df4749f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/include/StatusMonitor.h
+6
-6
6 additions, 6 deletions
Modules/include/StatusMonitor.h
tests/executables_src/testStatusModule.cc
+19
-63
19 additions, 63 deletions
tests/executables_src/testStatusModule.cc
with
25 additions
and
69 deletions
Modules/include/StatusMonitor.h
+
6
−
6
View file @
e67842ba
...
@@ -67,9 +67,9 @@ namespace ChimeraTK {
...
@@ -67,9 +67,9 @@ namespace ChimeraTK {
template
<
typename
T
>
template
<
typename
T
>
struct
MaxMonitor
:
public
StatusMonitor
<
T
>
{
struct
MaxMonitor
:
public
StatusMonitor
<
T
>
{
using
StatusMonitor
<
T
>::
StatusMonitor
;
using
StatusMonitor
<
T
>::
StatusMonitor
;
/** WARNING state to be reported if threshold is
cross
ed*/
/** WARNING state to be reported if threshold is
reached or exceed
ed*/
ScalarPushInput
<
T
>
warning
{
this
,
"upperWarningThreshold"
,
""
,
""
,
StatusMonitor
<
T
>::
_parameterTags
};
ScalarPushInput
<
T
>
warning
{
this
,
"upperWarningThreshold"
,
""
,
""
,
StatusMonitor
<
T
>::
_parameterTags
};
/** ERROR state to be reported if threshold is
cross
ed*/
/** ERROR state to be reported if threshold is
reached or exceed
ed*/
ScalarPushInput
<
T
>
error
{
this
,
"upperErrorThreshold"
,
""
,
""
,
StatusMonitor
<
T
>::
_parameterTags
};
ScalarPushInput
<
T
>
error
{
this
,
"upperErrorThreshold"
,
""
,
""
,
StatusMonitor
<
T
>::
_parameterTags
};
/**This is where state evaluation is done*/
/**This is where state evaluation is done*/
...
@@ -78,10 +78,10 @@ namespace ChimeraTK {
...
@@ -78,10 +78,10 @@ namespace ChimeraTK {
ReadAnyGroup
group
{
StatusMonitor
<
T
>::
oneUp
.
watch
,
warning
,
error
};
ReadAnyGroup
group
{
StatusMonitor
<
T
>::
oneUp
.
watch
,
warning
,
error
};
while
(
true
)
{
while
(
true
)
{
// evaluate and publish first, then read and wait. This takes care of the publishing the initial variables
// evaluate and publish first, then read and wait. This takes care of the publishing the initial variables
if
(
StatusMonitor
<
T
>::
oneUp
.
watch
>
error
)
{
if
(
StatusMonitor
<
T
>::
oneUp
.
watch
>
=
error
)
{
StatusMonitor
<
T
>::
status
=
ERROR
;
StatusMonitor
<
T
>::
status
=
ERROR
;
}
}
else
if
(
StatusMonitor
<
T
>::
oneUp
.
watch
>
warning
)
{
else
if
(
StatusMonitor
<
T
>::
oneUp
.
watch
>
=
warning
)
{
StatusMonitor
<
T
>::
status
=
WARNING
;
StatusMonitor
<
T
>::
status
=
WARNING
;
}
}
else
{
else
{
...
@@ -108,10 +108,10 @@ namespace ChimeraTK {
...
@@ -108,10 +108,10 @@ namespace ChimeraTK {
/** If there is a change either in value monitored or in thershold values, the status is re-evaluated*/
/** If there is a change either in value monitored or in thershold values, the status is re-evaluated*/
ReadAnyGroup
group
{
StatusMonitor
<
T
>::
oneUp
.
watch
,
warning
,
error
};
ReadAnyGroup
group
{
StatusMonitor
<
T
>::
oneUp
.
watch
,
warning
,
error
};
while
(
true
)
{
while
(
true
)
{
if
(
StatusMonitor
<
T
>::
oneUp
.
watch
<
error
)
{
if
(
StatusMonitor
<
T
>::
oneUp
.
watch
<
=
error
)
{
StatusMonitor
<
T
>::
status
=
ERROR
;
StatusMonitor
<
T
>::
status
=
ERROR
;
}
}
else
if
(
StatusMonitor
<
T
>::
oneUp
.
watch
<
warning
)
{
else
if
(
StatusMonitor
<
T
>::
oneUp
.
watch
<
=
warning
)
{
StatusMonitor
<
T
>::
status
=
WARNING
;
StatusMonitor
<
T
>::
status
=
WARNING
;
}
}
else
{
else
{
...
...
This diff is collapsed.
Click to expand it.
tests/executables_src/testStatusModule.cc
+
19
−
63
View file @
e67842ba
...
@@ -140,17 +140,17 @@ BOOST_AUTO_TEST_CASE(testMinMonitor) {
...
@@ -140,17 +140,17 @@ BOOST_AUTO_TEST_CASE(testMinMonitor) {
//app.dumpConnections();
//app.dumpConnections();
auto
warning
=
test
.
getScalar
<
uint
>
(
std
::
string
(
"/Monitor/lowerWarningThreshold"
));
auto
warning
=
test
.
getScalar
<
uint
>
(
std
::
string
(
"/Monitor/lowerWarningThreshold"
));
warning
=
5
0
;
warning
=
4
0
;
warning
.
write
();
warning
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
auto
error
=
test
.
getScalar
<
uint
>
(
std
::
string
(
"/Monitor/lowerErrorThreshold"
));
auto
error
=
test
.
getScalar
<
uint
>
(
std
::
string
(
"/Monitor/lowerErrorThreshold"
));
error
=
45
;
error
=
30
;
error
.
write
();
error
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
auto
watch
=
test
.
getScalar
<
uint
>
(
std
::
string
(
"/watch"
));
auto
watch
=
test
.
getScalar
<
uint
>
(
std
::
string
(
"/watch"
));
watch
=
5
5
;
watch
=
4
5
;
watch
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
...
@@ -160,61 +160,40 @@ BOOST_AUTO_TEST_CASE(testMinMonitor) {
...
@@ -160,61 +160,40 @@ BOOST_AUTO_TEST_CASE(testMinMonitor) {
//should be in OK state.
//should be in OK state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
//
set watch valu
e lower
than
warning
threshold
//
just abow th
e lower warning
limit
watch
=
4
8
;
watch
=
4
1
;
watch
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in WARNING state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
//
set watch value greater than error threshold
//
exactly at the lower warning limit
watch
=
4
2
;
watch
=
4
0
;
watch
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in ERROR state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
//decrease error value lower than watch
error
=
35
;
error
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
//should be in WARNING state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
//decrease warning value lower than watch
//just above the lower error limit
warning
=
40
;
watch
=
31
;
warning
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
//should be in OK state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
//set watch value lower than error threshold
watch
=
33
;
watch
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in ERROR state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
//
decrease watch value greater than error level but still lower than warning level
//
exactly at the lower error limit (only well defined for int)
watch
=
3
6
;
watch
=
3
0
;
watch
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in WARNING state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
//
decrease watch value lower than warning level
//
way bellow the lower error limit
watch
=
4
1
;
watch
=
1
2
;
watch
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in OK state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
// check that the tags are applied correctly
// check that the tags are applied correctly
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MyNiceMonitorCopy/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MyNiceMonitorCopy/Monitor/status"
));
...
@@ -329,35 +308,12 @@ BOOST_AUTO_TEST_CASE(testRangeMonitor) {
...
@@ -329,35 +308,12 @@ BOOST_AUTO_TEST_CASE(testRangeMonitor) {
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
//way bellow the lower error limit
//way bellow the lower error limit
errorUpperLimit
=
12
;
watch
=
12
;
errorUpperLimit
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
// errorLowerLimit = 61;
// errorLowerLimit.write();
// test.stepApplication();
// warningUpperLimit = 60;
// warningUpperLimit.write();
// test.stepApplication();
// warningLowerLimit = 51;
// warningLowerLimit.write();
// test.stepApplication();
// status.readLatest();
// //should be in WARNING state.
// BOOST_CHECK_EQUAL(status, ChimeraTK::States::WARNING);
// warningLowerLimit = 55;
// warningLowerLimit.write();
// test.stepApplication();
// status.readLatest();
// //should be in OK state.
// BOOST_CHECK_EQUAL(status, ChimeraTK::States::OK);
// check that the tags are applied correctly
// check that the tags are applied correctly
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MyNiceMonitorCopy/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MyNiceMonitorCopy/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MonitorOutput/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MonitorOutput/Monitor/status"
));
...
...
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