Improve logging when testing applications
This commit is contained in:
parent
eba61510a0
commit
ed527021f9
|
@ -288,8 +288,8 @@ ArgumentParser::ArgumentParser() :
|
||||||
* \remarks
|
* \remarks
|
||||||
* - The parser does not take ownership. Do not destroy the arguments as long as they are used as
|
* - The parser does not take ownership. Do not destroy the arguments as long as they are used as
|
||||||
* main arguments.
|
* main arguments.
|
||||||
* - Sets the first specified argument as default argument if none is assigned yet and the
|
* - Sets the first specified argument as default argument if none has been assigned yet and the
|
||||||
* first argument has no mandatory sub arguments.
|
* first argument does not require any values or has no mandatory sub arguments.
|
||||||
*/
|
*/
|
||||||
void ArgumentParser::setMainArguments(const ArgumentInitializerList &mainArguments)
|
void ArgumentParser::setMainArguments(const ArgumentInitializerList &mainArguments)
|
||||||
{
|
{
|
||||||
|
@ -301,7 +301,7 @@ void ArgumentParser::setMainArguments(const ArgumentInitializerList &mainArgumen
|
||||||
if(!m_defaultArg) {
|
if(!m_defaultArg) {
|
||||||
if(!(*mainArguments.begin())->requiredValueCount()) {
|
if(!(*mainArguments.begin())->requiredValueCount()) {
|
||||||
bool subArgsRequired = false;
|
bool subArgsRequired = false;
|
||||||
for(Argument *subArg : (*mainArguments.begin())->subArguments()) {
|
for(const Argument *subArg : (*mainArguments.begin())->subArguments()) {
|
||||||
if(subArg->isRequired()) {
|
if(subArg->isRequired()) {
|
||||||
subArgsRequired = true;
|
subArgsRequired = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -221,8 +221,16 @@ string TestApplication::workingCopyPath(const string &name) const
|
||||||
* - The specified \a args must be 0 terminated. The first argument is the application name.
|
* - The specified \a args must be 0 terminated. The first argument is the application name.
|
||||||
* - Currently only available under UNIX.
|
* - Currently only available under UNIX.
|
||||||
*/
|
*/
|
||||||
int TestApplication::execApp(const char *const *args, string &stdout, string &stderr) const
|
int TestApplication::execApp(const char *const *args, string &stdout, string &stderr, bool suppressLogging) const
|
||||||
{
|
{
|
||||||
|
// print log message
|
||||||
|
if(!suppressLogging) {
|
||||||
|
cout << '-';
|
||||||
|
for(const char *const *i = args; *i; ++i) {
|
||||||
|
cout << ' ' << *i;
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
// determine application path
|
// determine application path
|
||||||
const char *appPath = m_applicationPathArg.firstValue();
|
const char *appPath = m_applicationPathArg.firstValue();
|
||||||
if(!appPath || !*appPath) {
|
if(!appPath || !*appPath) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
std::string testFilePath(const std::string &name) const;
|
std::string testFilePath(const std::string &name) const;
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
std::string workingCopyPath(const std::string &name) const;
|
std::string workingCopyPath(const std::string &name) const;
|
||||||
int execApp(const char *const *args, std::string &output, std::string &errors) const;
|
int execApp(const char *const *args, std::string &output, std::string &errors, bool suppressLogging = false) const;
|
||||||
#endif
|
#endif
|
||||||
bool unitsSpecified() const;
|
bool unitsSpecified() const;
|
||||||
const std::vector<const char *> &units() const;
|
const std::vector<const char *> &units() const;
|
||||||
|
|
Loading…
Reference in New Issue