Improve logging when testing applications

This commit is contained in:
Martchus 2016-08-05 01:43:46 +02:00
parent eba61510a0
commit ed527021f9
3 changed files with 13 additions and 5 deletions

View File

@ -288,8 +288,8 @@ ArgumentParser::ArgumentParser() :
* \remarks
* - The parser does not take ownership. Do not destroy the arguments as long as they are used as
* main arguments.
* - Sets the first specified argument as default argument if none is assigned yet and the
* first argument has no mandatory sub arguments.
* - Sets the first specified argument as default argument if none has been assigned yet and the
* first argument does not require any values or has no mandatory sub arguments.
*/
void ArgumentParser::setMainArguments(const ArgumentInitializerList &mainArguments)
{
@ -301,7 +301,7 @@ void ArgumentParser::setMainArguments(const ArgumentInitializerList &mainArgumen
if(!m_defaultArg) {
if(!(*mainArguments.begin())->requiredValueCount()) {
bool subArgsRequired = false;
for(Argument *subArg : (*mainArguments.begin())->subArguments()) {
for(const Argument *subArg : (*mainArguments.begin())->subArguments()) {
if(subArg->isRequired()) {
subArgsRequired = true;
break;

View File

@ -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.
* - 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
const char *appPath = m_applicationPathArg.firstValue();
if(!appPath || !*appPath) {

View File

@ -18,7 +18,7 @@ public:
std::string testFilePath(const std::string &name) const;
#ifdef PLATFORM_UNIX
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
bool unitsSpecified() const;
const std::vector<const char *> &units() const;