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
fa16d6c8
Commit
fa16d6c8
authored
6 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
moved some tests from testControlSystemAccessors to testDirectDeviceToCS.
parent
b07d05dd
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
tests/executables_src/testControlSystemAccessors.cc
+0
-65
0 additions, 65 deletions
tests/executables_src/testControlSystemAccessors.cc
tests/executables_src/testDirectDeviceToCS.cc
+106
-3
106 additions, 3 deletions
tests/executables_src/testDirectDeviceToCS.cc
with
106 additions
and
68 deletions
tests/executables_src/testControlSystemAccessors.cc
+
0
−
65
View file @
fa16d6c8
...
@@ -339,71 +339,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultipleRePublications, T, test_types ) {
...
@@ -339,71 +339,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultipleRePublications, T, test_types ) {
}
}
/*********************************************************************************************************************/
/* test direct control system to device connections */
BOOST_AUTO_TEST_CASE_TEMPLATE
(
testDirectCStoDev
,
T
,
test_types
)
{
TestApplication
<
T
>
app
;
auto
pvManagers
=
ctk
::
createPVManager
();
app
.
setPVManager
(
pvManagers
.
second
);
app
.
cs
(
"myFeeder"
,
typeid
(
T
),
1
)
>>
app
.
dev
(
"/MyModule/actuator"
);
app
.
initialise
();
app
.
run
();
ChimeraTK
::
Device
dev
;
dev
.
open
(
"Dummy0"
);
BOOST_CHECK_EQUAL
(
pvManagers
.
first
->
getAllProcessVariables
().
size
(),
1
);
auto
myFeeder
=
pvManagers
.
first
->
getProcessArray
<
T
>
(
"/myFeeder"
);
BOOST_CHECK
(
myFeeder
->
getName
()
==
"/myFeeder"
);
myFeeder
->
accessData
(
0
)
=
18
;
myFeeder
->
write
();
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/actuator"
)
==
18
,
3000
);
myFeeder
->
accessData
(
0
)
=
20
;
myFeeder
->
write
();
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/actuator"
)
==
20
,
3000
);
}
/*********************************************************************************************************************/
/* test direct control system to device connections with fan out */
BOOST_AUTO_TEST_CASE_TEMPLATE
(
testDirectCStoDevFanOut
,
T
,
test_types
)
{
TestApplication
<
T
>
app
;
auto
pvManagers
=
ctk
::
createPVManager
();
app
.
setPVManager
(
pvManagers
.
second
);
app
.
cs
(
"myFeeder"
,
typeid
(
T
),
1
)
>>
app
.
dev
(
"/MyModule/actuator"
)
>>
app
.
dev
(
"/MyModule/readBack"
);
app
.
initialise
();
app
.
run
();
ChimeraTK
::
Device
dev
;
dev
.
open
(
"Dummy0"
);
BOOST_CHECK_EQUAL
(
pvManagers
.
first
->
getAllProcessVariables
().
size
(),
1
);
auto
myFeeder
=
pvManagers
.
first
->
getProcessArray
<
T
>
(
"/myFeeder"
);
BOOST_CHECK
(
myFeeder
->
getName
()
==
"/myFeeder"
);
myFeeder
->
accessData
(
0
)
=
18
;
myFeeder
->
write
();
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/actuator"
)
==
18
,
3000
);
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/readBack"
)
==
18
,
3000
);
myFeeder
->
accessData
(
0
)
=
20
;
myFeeder
->
write
();
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/actuator"
)
==
20
,
3000
);
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/readBack"
)
==
20
,
3000
);
}
/*********************************************************************************************************************/
/*********************************************************************************************************************/
/* test direct control system to control system connections */
/* test direct control system to control system connections */
...
...
This diff is collapsed.
Click to expand it.
tests/executables_src/testDirectDeviceToCS.cc
+
106
−
3
View file @
fa16d6c8
...
@@ -19,6 +19,12 @@
...
@@ -19,6 +19,12 @@
using
namespace
boost
::
unit_test_framework
;
using
namespace
boost
::
unit_test_framework
;
namespace
ctk
=
ChimeraTK
;
namespace
ctk
=
ChimeraTK
;
// list of user types the accessors are tested with
typedef
boost
::
mpl
::
list
<
int8_t
,
uint8_t
,
int16_t
,
uint16_t
,
int32_t
,
uint32_t
,
float
,
double
>
test_types
;
#define CHECK_TIMEOUT(condition, maxMilliseconds) \
#define CHECK_TIMEOUT(condition, maxMilliseconds) \
{ \
{ \
std::chrono::steady_clock::time_point t0 = std::chrono::steady_clock::now(); \
std::chrono::steady_clock::time_point t0 = std::chrono::steady_clock::now(); \
...
@@ -30,13 +36,45 @@ namespace ctk = ChimeraTK;
...
@@ -30,13 +36,45 @@ namespace ctk = ChimeraTK;
} \
} \
}
}
/*********************************************************************************************************************/
/* the ApplicationModule for the test is a template of the user type */
template
<
typename
T
>
struct
TestModule
:
public
ctk
::
ApplicationModule
{
using
ctk
::
ApplicationModule
::
ApplicationModule
;
ctk
::
ScalarPushInput
<
T
>
consumer
{
this
,
"consumer"
,
""
,
"No comment."
};
ctk
::
ScalarOutput
<
T
>
feeder
{
this
,
"feeder"
,
"MV/m"
,
"Some fancy explanation about this variable"
};
void
mainLoop
()
{}
};
/*********************************************************************************************************************/
/*********************************************************************************************************************/
/* dummy application */
/* dummy application */
struct
TestApplication
:
ctk
::
Application
{
template
<
typename
T
>
TestApplication
()
:
Application
(
"testSuite"
)
{}
struct
TestApplication
:
public
ctk
::
Application
{
TestApplication
()
:
Application
(
"testSuite"
)
{
ChimeraTK
::
BackendFactory
::
getInstance
().
setDMapFilePath
(
"test.dmap"
);
}
~
TestApplication
()
{
shutdown
();
}
~
TestApplication
()
{
shutdown
();
}
using
Application
::
makeConnections
;
// we call makeConnections() manually in the tests to catch exceptions etc.
void
defineConnections
()
{}
// the setup is done in the tests
TestModule
<
T
>
testModule
{
this
,
"TestModule"
,
"The test module"
};
ctk
::
ControlSystemModule
cs
;
ctk
::
DeviceModule
dev
{
"Dummy0"
};
};
/*********************************************************************************************************************/
/* dummy application for connectTo() test */
struct
TestApplicationConnectTo
:
ctk
::
Application
{
TestApplicationConnectTo
()
:
Application
(
"testSuite"
)
{}
~
TestApplicationConnectTo
()
{
shutdown
();
}
using
Application
::
makeConnections
;
// we call makeConnections() manually in the tests to catch exceptions etc.
using
Application
::
makeConnections
;
// we call makeConnections() manually in the tests to catch exceptions etc.
void
defineConnections
()
{
void
defineConnections
()
{
dev
.
connectTo
(
cs
,
trigger
.
tick
);
dev
.
connectTo
(
cs
,
trigger
.
tick
);
...
@@ -96,6 +134,71 @@ void testDirectRegister(ctk::TestFacility &test, ChimeraTK::ScalarRegisterAccess
...
@@ -96,6 +134,71 @@ void testDirectRegister(ctk::TestFacility &test, ChimeraTK::ScalarRegisterAccess
}
}
/*********************************************************************************************************************/
/* test direct control system to device connections */
BOOST_AUTO_TEST_CASE_TEMPLATE
(
testDirectCStoDev
,
T
,
test_types
)
{
TestApplication
<
T
>
app
;
auto
pvManagers
=
ctk
::
createPVManager
();
app
.
setPVManager
(
pvManagers
.
second
);
app
.
cs
(
"myFeeder"
,
typeid
(
T
),
1
)
>>
app
.
dev
(
"/MyModule/actuator"
);
app
.
initialise
();
app
.
run
();
ChimeraTK
::
Device
dev
;
dev
.
open
(
"Dummy0"
);
BOOST_CHECK_EQUAL
(
pvManagers
.
first
->
getAllProcessVariables
().
size
(),
1
);
auto
myFeeder
=
pvManagers
.
first
->
getProcessArray
<
T
>
(
"/myFeeder"
);
BOOST_CHECK
(
myFeeder
->
getName
()
==
"/myFeeder"
);
myFeeder
->
accessData
(
0
)
=
18
;
myFeeder
->
write
();
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/actuator"
)
==
18
,
3000
);
myFeeder
->
accessData
(
0
)
=
20
;
myFeeder
->
write
();
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/actuator"
)
==
20
,
3000
);
}
/*********************************************************************************************************************/
/* test direct control system to device connections with fan out */
BOOST_AUTO_TEST_CASE_TEMPLATE
(
testDirectCStoDevFanOut
,
T
,
test_types
)
{
TestApplication
<
T
>
app
;
auto
pvManagers
=
ctk
::
createPVManager
();
app
.
setPVManager
(
pvManagers
.
second
);
app
.
cs
(
"myFeeder"
,
typeid
(
T
),
1
)
>>
app
.
dev
(
"/MyModule/actuator"
)
>>
app
.
dev
(
"/MyModule/readBack"
);
app
.
initialise
();
app
.
run
();
ChimeraTK
::
Device
dev
;
dev
.
open
(
"Dummy0"
);
BOOST_CHECK_EQUAL
(
pvManagers
.
first
->
getAllProcessVariables
().
size
(),
1
);
auto
myFeeder
=
pvManagers
.
first
->
getProcessArray
<
T
>
(
"/myFeeder"
);
BOOST_CHECK
(
myFeeder
->
getName
()
==
"/myFeeder"
);
myFeeder
->
accessData
(
0
)
=
18
;
myFeeder
->
write
();
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/actuator"
)
==
18
,
3000
);
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/readBack"
)
==
18
,
3000
);
myFeeder
->
accessData
(
0
)
=
20
;
myFeeder
->
write
();
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/actuator"
)
==
20
,
3000
);
CHECK_TIMEOUT
(
dev
.
read
<
T
>
(
"/MyModule/readBack"
)
==
20
,
3000
);
}
/*********************************************************************************************************************/
/*********************************************************************************************************************/
/* test connectTo */
/* test connectTo */
...
@@ -105,7 +208,7 @@ BOOST_AUTO_TEST_CASE( testConnectTo ) {
...
@@ -105,7 +208,7 @@ BOOST_AUTO_TEST_CASE( testConnectTo ) {
ctk
::
Device
dev
;
ctk
::
Device
dev
;
dev
.
open
(
"(dummy?map=test3.map)"
);
dev
.
open
(
"(dummy?map=test3.map)"
);
TestApplication
app
;
TestApplication
ConnectTo
app
;
ctk
::
TestFacility
test
;
ctk
::
TestFacility
test
;
auto
devActuator
=
dev
.
getScalarRegisterAccessor
<
int32_t
>
(
"/MyModule/actuator"
);
auto
devActuator
=
dev
.
getScalarRegisterAccessor
<
int32_t
>
(
"/MyModule/actuator"
);
...
...
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