Tidy up testlib's parsing of -callgrind parameter
Invert a condition to turn a nested if (that was missing one of its layers of braces) into an else-if chain, split some long strings to limit line length. Change-Id: I10d90487a09affe981aa11c3588281aeb3666df5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
93830d9ed3
commit
b67c367e0e
@ -734,14 +734,17 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
|
|||||||
QTest::noCrashHandler = true;
|
QTest::noCrashHandler = true;
|
||||||
#if QT_CONFIG(valgrind)
|
#if QT_CONFIG(valgrind)
|
||||||
} else if (strcmp(argv[i], "-callgrind") == 0) {
|
} else if (strcmp(argv[i], "-callgrind") == 0) {
|
||||||
if (QBenchmarkValgrindUtils::haveValgrind())
|
if (!QBenchmarkValgrindUtils::haveValgrind()) {
|
||||||
if (QFileInfo(QDir::currentPath()).isWritable()) {
|
fprintf(stderr,
|
||||||
QBenchmarkGlobalData::current->setMode(QBenchmarkGlobalData::CallgrindParentProcess);
|
"WARNING: Valgrind not found or too old. "
|
||||||
|
"Make sure it is installed and in your path. "
|
||||||
|
"Using the walltime measurer.\n");
|
||||||
|
} else if (QFileInfo(QDir::currentPath()).isWritable()) {
|
||||||
|
QBenchmarkGlobalData::current->setMode(
|
||||||
|
QBenchmarkGlobalData::CallgrindParentProcess);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "WARNING: Current directory not writable. Using the walltime measurer.\n");
|
fprintf(stderr,
|
||||||
}
|
"WARNING: Current directory not writable. "
|
||||||
else {
|
|
||||||
fprintf(stderr, "WARNING: Valgrind not found or too old. Make sure it is installed and in your path. "
|
|
||||||
"Using the walltime measurer.\n");
|
"Using the walltime measurer.\n");
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-callgrindchild") == 0) { // "private" option
|
} else if (strcmp(argv[i], "-callgrindchild") == 0) { // "private" option
|
||||||
|
Loading…
x
Reference in New Issue
Block a user