Commit ad51bbdb authored by lealv's avatar lealv
Browse files

FIXED - CTEST - TestComponents: define a default output directory to save data if not defined.

Info: tests level 1 and level 2 were not executed due to this.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1595 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 1c7a1fc2
......@@ -15,7 +15,7 @@ class options {
std::string --input | -i {"<file>",
"Test file to open"};
std::string --odir | -o {"<path>",
"Directory where the output file will be saved"};
"[Optional] Directory where the output file will be saved"};
std::string --component | -c {"<component>",
"The component extension to be tested (provide full path of the dynamic library)"};
std::string --level | -l {"<level>",
......
......@@ -400,7 +400,8 @@ print_usage (::std::ostream& os)
os << "--input|-i <file> Test file to open" << ::std::endl;
os << "--odir|-o <path> Directory where the output file will be saved" << ::std::endl;
os << "--odir|-o <path> [Optional] Directory where the output file will be" << ::std::endl
<< " saved" << ::std::endl;
os << "--component|-c <component> The component extension to be tested (provide full" << ::std::endl
<< " path of the dynamic library)" << ::std::endl;
......
......@@ -30,6 +30,7 @@
#include <Core.h>
#include <ExtensionManager.h>
#include <stdlib.h>
#include <QDir>
// Different test levels to procede
const int LEVEL1 = 1;// Open application - Open extension - Open component
......@@ -65,13 +66,13 @@ int main(int argc, char *argv[]) {
int ret = EXIT_SUCCESS;
if ( o.help()
|| (o.input() == "" && o.odir() == "" && o.component() == "" && o.level() == "")
|| (o.input() == "" && o.component() == "" && o.level() == "")
)
{
std::cout << "Help or no arguments: " << std::endl;
usage(argv[0]);
}
else if (o.input() == "" || o.odir() == "" || o.component() == "" && o.level() == "") {
else if (o.input() == "" || o.component() == "" || o.level() == "") {
std::cout << "Bad arguments: " << std::endl;
usage(argv[0]);
}
......@@ -80,8 +81,17 @@ int main(int argc, char *argv[]) {
std::cout << "Arguments OK: " << std::endl;
QFileInfo ifile(o.input().c_str());
QFileInfo icomponent(o.component().c_str());
QString odirectory(o.odir().c_str());
int level = atoi(o.level().c_str());
QString odirectory;
if (o.odir() == "")//optional argument
{
odirectory = QDir::temp().absolutePath();
}
else
{
odirectory = o.odir().c_str();
}
int level = atoi(o.level().c_str());
// init the camitk application context
Application a("camitk-testcomponents", argc, argv, false, false);//No autoload + registerFileExtension false to avoid the execution of this testapp hampered by PopUp message
......@@ -101,9 +111,10 @@ int main(int argc, char *argv[]) {
{
std::cout << "Open component: " << ifile.fileName().toStdString() << " SUCCESS" << std::endl;
comp->setFileName(odirectory + "/" + ifile.fileName());
if (level >= LEVEL2){
Application::save(comp);
}
if (level >= LEVEL2){
std::cout << "Save component: " << ifile.fileName().toStdString() << std::endl;
Application::save(comp);
}
}
else
{
......
......@@ -31,7 +31,7 @@ Print CamiTK version message
Test file to open
.IP "\fB--odir\fP|\fB-o\fP \fIpath\fP"
Directory where the output file will be saved
[Optional] Directory where the output file will be saved
.IP "\fB--component\fP|\fB-c\fP \fIcomponent\fP"
The component extension to be tested (provide full path of the dynamic
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment