Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CamiTK
CamiTK Community Edition
Commits
4c785127
Commit
4c785127
authored
Dec 09, 2017
by
Emmanuel Promayon
Browse files
NEW option to load extra component extension
Required to include additional auto test for external CEP
parent
03f1c240
Changes
7
Hide whitespace changes
Inline
Side-by-side
sdk/cmake/modules/macros/camitk/test/CamiTKAdditionalActionTest.cmake
View file @
4c785127
...
...
@@ -35,12 +35,28 @@ macro(camitk_additional_action_test)
set
(
multiValueArgs ACTION_EXTENSIONS TEST_FILES
)
cmake_parse_arguments
(
CAMITK_ADDITIONAL_ACTION_TEST
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
if
()
if
(
CAMITK_ADDITIONAL_ACTION_TEST_TEST_SUFFIX
)
set
(
CAMITK_ADDITIONAL_ACTION_TEST_SUFFIX
${
CAMITK_ADDITIONAL_ACTION_TEST_TEST_SUFFIX
}
)
else
()
set
(
CAMITK_ADDITIONAL_ACTION_TEST_SUFFIX
${
EXTENSION_NAME
}
)
endif
()
# COMPONENT_EXTENSION_PLUGIN_FILE
# determine the extension full file name depending on the plateform
if
(
MSVC
)
set
(
COMPONENT_EXTENSION_PLUGIN_FILE
"components/
${${
TYPE_EXTENSION_CMAKE
}
_OUTPUT_NAME
}${
CAMITK_DEBUG_POSTFIX
}
.dll"
)
elseif
(
APPLE
)
set
(
COMPONENT_EXTENSION_PLUGIN_FILE
"components/lib
${${
TYPE_EXTENSION_CMAKE
}
_OUTPUT_NAME
}
.dylib"
)
else
()
# Must be Linux
set
(
COMPONENT_EXTENSION_PLUGIN_FILE
"components/lib
${${
TYPE_EXTENSION_CMAKE
}
_OUTPUT_NAME
}
.so"
)
endif
()
# if this is not SDK, then it is required
if
(
NOT CAMITK_SDK_BUILD
)
set
(
ADDITIONAL_COMPONENT_EXTENSION_ARG
"-c
${
CAMITK_BUILD_PRIVATE_LIB_DIR
}
/
${
COMPONENT_EXTENSION_PLUGIN_FILE
}
"
)
endif
()
# loop over actions
# if (action extension exists in repository) CAMITK_USER_PRIVATE_LIB_DIR CAMITK_PRIVATE_LIB_DIR CAMITK_BUILD_PRIVATE_LIB_DIR
# loop over test files
...
...
@@ -59,12 +75,12 @@ macro(camitk_additional_action_test)
# check if action can be found in (this order) : build dir (CAMITK_BUILD_PRIVATE_LIB_DIR),
# user install (CAMITK_USER_PRIVATE_LIB_DIR, and global install (CAMITK_PRIVATE_LIB_DIR)
set
(
EXTENSION_PLUGIN_FILE
${
CAMITK_BUILD_PRIVATE_LIB_DIR
}
/
${
EXTENSION_FILE
}
)
if
(
NOT EXISTS
${
EXTENSION_PLUGIN_FILE
}
)
set
(
EXTENSION_PLUGIN_FILE
${
CAMITK_USER_PRIVATE_LIB_DIR
}
/
${
EXTENSION_FILE
}
)
if
(
NOT EXISTS
${
EXTENSION_PLUGIN_FILE
}
)
set
(
EXTENSION_PLUGIN_FILE
${
CAMITK_PRIVATE_LIB_DIR
}
/
${
EXTENSION_FILE
}
)
if
(
NOT EXISTS
${
EXTENSION_PLUGIN_FILE
}
)
set
(
ACTION_
EXTENSION_PLUGIN_FILE
${
CAMITK_BUILD_PRIVATE_LIB_DIR
}
/
${
EXTENSION_FILE
}
)
if
(
NOT EXISTS
${
ACTION_
EXTENSION_PLUGIN_FILE
}
)
set
(
ACTION_
EXTENSION_PLUGIN_FILE
${
CAMITK_USER_PRIVATE_LIB_DIR
}
/
${
EXTENSION_FILE
}
)
if
(
NOT EXISTS
${
ACTION_
EXTENSION_PLUGIN_FILE
}
)
set
(
ACTION_
EXTENSION_PLUGIN_FILE
${
CAMITK_PRIVATE_LIB_DIR
}
/
${
EXTENSION_FILE
}
)
if
(
NOT EXISTS
${
ACTION_
EXTENSION_PLUGIN_FILE
}
)
message
(
SEND_ERROR
"Action extension
\"
${
ACTION_EXTENSION
}
\"
not found: no additional test added"
)
return
()
endif
()
...
...
@@ -94,7 +110,7 @@ macro(camitk_additional_action_test)
foreach
(
ACTION_TESTDATA_FILE
${
TESTFILES
}
)
# Test procedure: Open a file - load an action extension - Apply an action on the component wrapping the file
camitk_add_test
(
EXECUTABLE_ARGS
"-i
${
ACTION_TESTDATA_FILE
}
-a
${
EXTENSION_PLUGIN_FILE
}
"
camitk_add_test
(
EXECUTABLE_ARGS
"-i
${
ACTION_TESTDATA_FILE
}
-a
${
ACTION_
EXTENSION_PLUGIN_FILE
}
${
ADDITIONAL_COMPONENT_EXTENSION_ARG
}
"
TEST_SUFFIX
"-additional-
${
CAMITK_ADDITIONAL_ACTION_TEST_SUFFIX
}
-level1-"
PROJECT_NAME
"action-
${
ACTION_EXTENSION
}
"
)
...
...
sdk/testapplications/testactions/CommandLineOptions.cli
View file @
4c785127
...
...
@@ -20,7 +20,7 @@ class options {
std::string --action | -a
{
"<
action
>",
"<
path
>",
"The action extension to be tested (please provide the full path of the dynamic library)."
};
...
...
@@ -29,4 +29,14 @@ class options {
"<file>",
"input component file to test the actions on (please provide the full path to the file). Note that this file is not modified."
};
std::string --component | -c
{
"<path>",
"[Optional] Additional component extension to be loaded before opening the input file (please provide the full
path to the dynamic library).
This is generally needed when an automatic test is added. The component extension that manages will not be
automatically loaded in this case. Use this option to provide it."
};
};
sdk/testapplications/testactions/CommandLineOptions.cxx
View file @
4c785127
...
...
@@ -311,7 +311,8 @@ options (int& argc,
::
cli
::
unknown_mode
arg
)
:
help_
(),
action_
(),
input_
()
input_
(),
component_
()
{
::
cli
::
argv_scanner
s
(
argc
,
argv
,
erase
);
_parse
(
s
,
opt
,
arg
);
...
...
@@ -326,7 +327,8 @@ options (int start,
::
cli
::
unknown_mode
arg
)
:
help_
(),
action_
(),
input_
()
input_
(),
component_
()
{
::
cli
::
argv_scanner
s
(
start
,
argc
,
argv
,
erase
);
_parse
(
s
,
opt
,
arg
);
...
...
@@ -341,7 +343,8 @@ options (int& argc,
::
cli
::
unknown_mode
arg
)
:
help_
(),
action_
(),
input_
()
input_
(),
component_
()
{
::
cli
::
argv_scanner
s
(
argc
,
argv
,
erase
);
_parse
(
s
,
opt
,
arg
);
...
...
@@ -358,7 +361,8 @@ options (int start,
::
cli
::
unknown_mode
arg
)
:
help_
(),
action_
(),
input_
()
input_
(),
component_
()
{
::
cli
::
argv_scanner
s
(
start
,
argc
,
argv
,
erase
);
_parse
(
s
,
opt
,
arg
);
...
...
@@ -371,7 +375,8 @@ options (::cli::scanner& s,
::
cli
::
unknown_mode
arg
)
:
help_
(),
action_
(),
input_
()
input_
(),
component_
()
{
_parse
(
s
,
opt
,
arg
);
}
...
...
@@ -379,13 +384,18 @@ options (::cli::scanner& s,
void
options
::
print_usage
(
::
std
::
ostream
&
os
)
{
os
<<
"--help|-h Print usage information and exit."
<<
::
std
::
endl
;
os
<<
"--help|-h
Print usage information and exit."
<<
::
std
::
endl
;
os
<<
"--action|-a <
action>
The action extension to be tested (please provide the full"
<<
::
std
::
endl
<<
" path of the dynamic library)."
<<
::
std
::
endl
;
os
<<
"--action|-a <
path>
The action extension to be tested (please provide the full"
<<
::
std
::
endl
<<
"
path of the dynamic library)."
<<
::
std
::
endl
;
os
<<
"--input|-i <file> input component file to test the actions on (please provide"
<<
::
std
::
endl
<<
" the full path to the file)."
<<
::
std
::
endl
;
os
<<
"--input|-i <file> input component file to test the actions on (please"
<<
::
std
::
endl
<<
" provide the full path to the file)."
<<
::
std
::
endl
;
os
<<
"--component|-c <path> [Optional] Additional component extension to be loaded"
<<
::
std
::
endl
<<
" before opening the input file (please provide the full"
<<
::
std
::
endl
<<
::
std
::
endl
<<
" path to the dynamic library)."
<<
::
std
::
endl
;
}
typedef
...
...
@@ -410,6 +420,10 @@ struct _cli_options_map_init
&::
cli
::
thunk
<
options
,
std
::
string
,
&
options
::
input_
>
;
_cli_options_map_
[
"-i"
]
=
&::
cli
::
thunk
<
options
,
std
::
string
,
&
options
::
input_
>
;
_cli_options_map_
[
"--component"
]
=
&::
cli
::
thunk
<
options
,
std
::
string
,
&
options
::
component_
>
;
_cli_options_map_
[
"-c"
]
=
&::
cli
::
thunk
<
options
,
std
::
string
,
&
options
::
component_
>
;
}
}
_cli_options_map_init_
;
...
...
sdk/testapplications/testactions/CommandLineOptions.hxx
View file @
4c785127
...
...
@@ -242,6 +242,9 @@ class options
const
std
::
string
&
input
()
const
;
const
std
::
string
&
component
()
const
;
// Print usage information.
//
static
void
...
...
@@ -257,6 +260,7 @@ class options
bool
help_
;
std
::
string
action_
;
std
::
string
input_
;
std
::
string
component_
;
};
#include "CommandLineOptions.ixx"
...
...
sdk/testapplications/testactions/CommandLineOptions.ixx
View file @
4c785127
...
...
@@ -126,3 +126,9 @@ input () const
return this->input_;
}
inline const std::string& options::
component () const
{
return this->component_;
}
sdk/testapplications/testactions/main.cpp
View file @
4c785127
...
...
@@ -36,7 +36,7 @@ using namespace camitk;
#include "CommandLineOptions.hxx"
// description of the application. Please update the manpage-prologue.1.in also if you modify this string.
const
char
*
description
=
"camitk-testactions aims at testing a action extension individually.
\n
"
const
char
*
description
=
"camitk-testactions aims at testing a
n
action extension individually.
\n
"
"It loads the given action extension library (dll or so), opens the
\n
"
"given component, and apply all the action that work on the given
\n
"
"component.
\n\n
"
"Please visit http://camitk.imag.fr for more information.
\n
"
...
...
@@ -80,6 +80,7 @@ int main(int argc, char* argv[]) {
try
{
int
end
;
// End of options.
options
o
(
argc
,
argv
,
end
);
bool
loadAdditionnalComponentExtension
=
false
;
// if specific help or no options provided
if
(
o
.
help
()
||
(
o
.
action
().
empty
()
&&
o
.
input
().
empty
()))
{
...
...
@@ -98,8 +99,9 @@ int main(int argc, char* argv[]) {
}
// check input files
QFileInfo
inputComponent
(
o
.
input
().
c_str
());
QFileInfo
inputActionExtension
(
o
.
action
().
c_str
());
QFileInfo
inputComponent
{
o
.
input
().
c_str
()};
QFileInfo
inputActionExtension
{
o
.
action
().
c_str
()};
QFileInfo
additionaleComponentExtension
{
o
.
component
().
c_str
()};
if
(
!
inputComponent
.
exists
())
{
usage
(
"Argument error: component test file
\"
"
+
o
.
input
()
+
"
\"
does not exist."
);
...
...
@@ -110,10 +112,21 @@ int main(int argc, char* argv[]) {
usage
(
"Argument error: action dll/so file
\"
"
+
o
.
action
()
+
"
\"
does not exist."
);
return
EXIT_FAILURE
;
}
if
(
!
o
.
component
().
empty
()
&&
!
additionaleComponentExtension
.
exists
())
{
usage
(
"Argument error: action dll/so file
\"
"
+
o
.
component
()
+
"
\"
does not exist."
);
return
EXIT_FAILURE
;
}
else
{
loadAdditionnalComponentExtension
=
true
;
}
std
::
cout
<<
"camitk-testactions run with arguments:"
<<
std
::
endl
;
std
::
cout
<<
"- action library file:
\"
"
<<
o
.
action
()
<<
"
\"
"
<<
std
::
endl
;
std
::
cout
<<
"- input test file:
\"
"
<<
o
.
input
()
<<
"
\"
"
<<
std
::
endl
;
if
(
loadAdditionnalComponentExtension
)
{
std
::
cout
<<
"- additional component extension:
\"
"
<<
o
.
component
()
<<
"
\"
"
<<
std
::
endl
;
}
testInit
(
"Starting the camitk default application..."
);
...
...
@@ -129,6 +142,15 @@ int main(int argc, char* argv[]) {
testPassed
();
if
(
loadAdditionnalComponentExtension
)
{
testInit
(
"Loading additional component extension..."
);
if
(
!
ExtensionManager
::
loadExtension
(
ExtensionManager
::
COMPONENT
,
additionaleComponentExtension
.
absoluteFilePath
()))
{
testFailed
();
return
EXIT_FAILURE
;
}
testPassed
();
}
testInit
(
"Opening component: "
+
o
.
input
()
+
"..."
);
Component
*
comp
=
Application
::
open
(
o
.
input
().
data
());
...
...
sdk/testapplications/testactions/resources/camitk-testactions.1.in
View file @
4c785127
...
...
@@ -24,7 +24,7 @@ The targeted users are in R&D departments or laboratories.
.IP "\fB--help\fP|\fB-h\fP"
Print usage information and exit\.
.IP "\fB--action\fP|\fB-a\fP \fI
action
\fP"
.IP "\fB--action\fP|\fB-a\fP \fI
path
\fP"
The action extension to be tested (please provide the full path of the
dynamic library)\.
...
...
@@ -32,6 +32,16 @@ dynamic library)\.
input component file to test the actions on (please provide the full path to
the file)\. Note that this file is not modified\.
.IP "\fB--component\fP|\fB-c\fP \fIpath\fP"
[Optional] Additional component extension to be loaded before opening the
input file (please provide the full
path to the dynamic library)\.
This is generally needed when an automatic test is added\. The component
extension that manages will not be automatically loaded in this case\. Use
this option to provide it\.
.SH "AUTHORS"
CamiTK and camitk\-@APPLICATION_NAME@ is currently developed by the Univ. Grenoble Alpes,
CNRS in the TIMC\-IMAG UMR 5525 laboratory (GMCAO).
...
...
Write
Preview
Supports
Markdown
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