Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
Lima
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
65
Issues
65
List
Boards
Labels
Service Desk
Milestones
Jira
Jira
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LimaGroup
Lima
Commits
428aaa76
Commit
428aaa76
authored
Aug 28, 2020
by
Samuel Debionne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a CmdThread test with a command throwing a Lima Exception
parent
fd7933dc
Pipeline
#32172
passed with stages
in 35 minutes and 7 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
common/test/CMakeLists.txt
common/test/CMakeLists.txt
+13
-0
common/test/test_cmdthread.cpp
common/test/test_cmdthread.cpp
+57
-0
No files found.
common/test/CMakeLists.txt
View file @
428aaa76
...
...
@@ -26,3 +26,16 @@ if (NOT WIN32)
endif
()
limatools_run_camera_tests
(
"
${
test_src
}
"
${
NAME
}
)
add_executable
(
test_cmdthread
test_cmdthread.cpp
)
target_link_libraries
(
test_cmdthread
limacore
)
add_test
(
NAME test_cmdthread
COMMAND test_cmdthread
)
common/test/test_cmdthread.cpp
0 → 100644
View file @
428aaa76
#include <iostream>
#include <lima/Exceptions.h>
#include <lima/ThreadUtils.h>
using
namespace
lima
;
struct
CommandThread
:
public
CmdThread
{
enum
{
Ready
=
MaxThreadStatus
};
enum
Cmd
{
Hello
=
MaxThreadCmd
,
Throw
};
~
CommandThread
()
{
abort
();
}
protected:
void
init
()
override
{
setStatus
(
Ready
);
}
void
execCmd
(
int
cmd
)
override
{
switch
(
cmd
)
{
case
Cmd
::
Hello
:
std
::
cout
<<
"Hello"
<<
std
::
endl
;
break
;
case
Cmd
::
Throw
:
LIMA_COM_EXC
(
Error
,
"Something bad happend"
);
}
}
};
int
main
(
int
/*argc*/
,
char
*/
*
argv
*/
[])
{
try
{
CommandThread
thread
;
thread
.
start
();
thread
.
waitStatus
(
CommandThread
::
Ready
);
std
::
cout
<<
"Sending Hello command"
<<
std
::
endl
;
thread
.
sendCmd
(
CommandThread
::
Hello
);
std
::
cout
<<
"Sending Throw command"
<<
std
::
endl
;
thread
.
sendCmd
(
CommandThread
::
Throw
);
}
catch
(
Exception
e
)
{
std
::
cerr
<<
"LIMA Exception: "
<<
e
<<
std
::
endl
;
}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment