aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-03-09 15:25:50 +0100
committerOla Røer Thorsen <ola@silentwings.no>2018-03-12 07:59:01 +0000
commit57523e6cd3fe880b03dec8adddb304341f13261b (patch)
treeafad30c040cbb393e5824eea35b5c8120803d5b4 /tests
parent0ea6691c8fa0b91c496aa53679064a2e18c19e10 (diff)
vcs module: Make sure the git meta data directory is absolute
git rev-parse --git-dir prints a relative or an absolute path, depending on whether you call it from the repository base directory or not. Our code now accounts for that. Change-Id: Iac5eeb0fc55fe83d6c588efbcf97cab6786a4f89 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ola Røer Thorsen <ola@silentwings.no>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp11
-rw-r--r--tests/auto/blackbox/tst_blackboxbase.cpp2
-rw-r--r--tests/auto/blackbox/tst_blackboxbase.h1
3 files changed, 10 insertions, 4 deletions
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 6ace7e674..d565e7696 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -1048,19 +1048,22 @@ void TestBlackbox::vcsGit()
QVERIFY(waitForProcessSuccess(git));
// Initial run.
- QCOMPARE(runQbs(), 0);
+ QbsRunParameters params(QStringList{"-f", repoDir.path()});
+ params.workingDir = repoDir.path() + "/..";
+ params.buildDirectory = repoDir.path();
+ QCOMPARE(runQbs(params), 0);
QVERIFY2(m_qbsStdout.contains("generating vcs-repo-state.h"), m_qbsStderr.constData());
QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData());
// Run with no changes.
- QCOMPARE(runQbs(), 0);
+ QCOMPARE(runQbs(params), 0);
QVERIFY2(!m_qbsStdout.contains("generating vcs-repo-state.h"), m_qbsStderr.constData());
QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData());
// Run with changed source file.
WAIT_FOR_NEW_TIMESTAMP();
touch("main.cpp");
- QCOMPARE(runQbs(), 0);
+ QCOMPARE(runQbs(params), 0);
QVERIFY2(!m_qbsStdout.contains("generating vcs-repo-state.h"), m_qbsStderr.constData());
QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData());
@@ -1071,7 +1074,7 @@ void TestBlackbox::vcsGit()
QVERIFY(waitForProcessSuccess(git));
git.start(gitFilePath, QStringList({"commit", "-m", "blubb!"}));
QVERIFY(waitForProcessSuccess(git));
- QCOMPARE(runQbs(), 0);
+ QCOMPARE(runQbs(params), 0);
QVERIFY2(m_qbsStdout.contains("generating vcs-repo-state.h"), m_qbsStderr.constData());
QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData());
}
diff --git a/tests/auto/blackbox/tst_blackboxbase.cpp b/tests/auto/blackbox/tst_blackboxbase.cpp
index cb36e13e1..1c9102847 100644
--- a/tests/auto/blackbox/tst_blackboxbase.cpp
+++ b/tests/auto/blackbox/tst_blackboxbase.cpp
@@ -90,6 +90,8 @@ int TestBlackboxBase::runQbs(const QbsRunParameters &params)
args.push_back(QLatin1String("profile:") + params.profile);
}
QProcess process;
+ if (!params.workingDir.isEmpty())
+ process.setWorkingDirectory(params.workingDir);
process.setProcessEnvironment(params.environment);
process.start(qbsExecutableFilePath, args);
if (!process.waitForStarted() || !process.waitForFinished(testTimeoutInMsecs())
diff --git a/tests/auto/blackbox/tst_blackboxbase.h b/tests/auto/blackbox/tst_blackboxbase.h
index 59ec5b3b7..e7df96f00 100644
--- a/tests/auto/blackbox/tst_blackboxbase.h
+++ b/tests/auto/blackbox/tst_blackboxbase.h
@@ -69,6 +69,7 @@ public:
QProcessEnvironment environment;
QString profile;
QString settingsDir;
+ QString workingDir;
bool expectFailure;
bool expectCrash;
};