Commit e06030d5 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Tests: Fix crashing clangstaticanalyzerrunner test

...due to a not set master temporary directory.

Change-Id: I6668209e9b724f6560331f683b63e1c41616f060
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent da1f1326
......@@ -27,6 +27,7 @@
#include <clangstaticanalyzer/clangstaticanalyzerrunner.h>
#include <utils/hostosinfo.h>
#include <utils/temporarydirectory.h>
#include <QtTest>
......@@ -168,8 +169,7 @@ void ClangStaticAnalyzerRunnerTest::runWithTestCodeGeneratedOneIssue()
"}\n";
QVERIFY(writeFile(testFilePath, source));
QTemporaryDir temporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangstaticanalyzer-XXXXXX"));
QVERIFY(temporaryDir.isValid());
Utils::TemporaryDirectory temporaryDir("runWithTestCodeGeneratedOneIssue");
ClangStaticAnalyzerRunner runner(m_clangExecutable, temporaryDir.path(),
Utils::Environment::systemEnvironment());
......@@ -185,8 +185,7 @@ void ClangStaticAnalyzerRunnerTest::runWithNonExistentFileToAnalyze()
if (m_clangExecutable.isEmpty())
QSKIP("Clang executable in PATH required.");
QTemporaryDir temporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangstaticanalyzer-XXXXXX"));
QVERIFY(temporaryDir.isValid());
Utils::TemporaryDirectory temporaryDir("runWithNonExistentFileToAnalyze");
ClangStaticAnalyzerRunner runner(m_clangExecutable, temporaryDir.path(),
Utils::Environment::systemEnvironment());
......@@ -197,6 +196,14 @@ void ClangStaticAnalyzerRunnerTest::runWithNonExistentFileToAnalyze()
QVERIFY(st.expectFinishWithFailureSignal(finishedWithBadExitCode(1)));
}
QTEST_MAIN(ClangStaticAnalyzerRunnerTest)
int main(int argc, char *argv[])
{
Utils::TemporaryDirectory::setMasterTemporaryDirectory(
QDir::tempPath() + "/qtc-clangstaticanalyzer-test-XXXXXX");
QCoreApplication app(argc, argv);
ClangStaticAnalyzerRunnerTest test;
return QTest::qExec(&test, argc, argv);
}
#include "tst_clangstaticanalyzerrunner.moc"
Markdown is supported
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