Fixed qfile unittest on windows

- Changed to set working directory based on subprogram
  stdinprocess's directory location.
- Changed QProcess execution of subprograms to use
  relative paths.

Change-Id: Idbccca635f0f61adba9721bcceeceb0a8a961dcf
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
bb10
Kurt Korbatits 2012-02-01 10:08:33 +10:00 committed by Qt by Nokia
parent ef25df9fec
commit 5fa777de96
2 changed files with 7 additions and 14 deletions

View File

@ -9,13 +9,6 @@ TESTDATA += ../dosfile.txt ../noendofline.txt ../testfile.txt \
../Makefile ../forCopying.txt ../forRenaming.txt \
../resources/file1.ext1
win32 {
CONFIG(debug, debug|release) {
TARGET = ../../debug/tst_qfile
} else {
TARGET = ../../release/tst_qfile
}
LIBS+=-lole32 -luuid
}
win32: LIBS+=-lole32 -luuid
mac*:CONFIG+=insignificant_test

View File

@ -343,9 +343,9 @@ void tst_QFile::cleanup()
void tst_QFile::initTestCase()
{
// chdir to testdata directory and use relative paths.
QString testdata_dir = QFileInfo(QFINDTESTDATA("testfile.txt")).absolutePath();
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
QString workingDir = QFileInfo(QFINDTESTDATA("stdinprocess")).absolutePath();
QVERIFY2(!workingDir.isEmpty(), qPrintable("Could not find working directory!"));
QVERIFY2(QDir::setCurrent(workingDir), qPrintable("Could not chdir to " + workingDir));
QFile::remove("noreadfile");
@ -832,7 +832,7 @@ void tst_QFile::readAllStdin()
QByteArray lotsOfData(1024, '@'); // 10 megs
QProcess process;
process.start(QFINDTESTDATA("stdinprocess/stdinprocess")+" all");
process.start("stdinprocess/stdinprocess all");
QVERIFY( process.waitForStarted() );
for (int i = 0; i < 5; ++i) {
QTest::qWait(1000);
@ -867,7 +867,7 @@ void tst_QFile::readLineStdin()
for (int i = 0; i < 2; ++i) {
QProcess process;
process.start((QFINDTESTDATA("stdinprocess/stdinprocess")+QString(" line %1").arg(i)), QIODevice::Text | QIODevice::ReadWrite);
process.start((QString("stdinprocess/stdinprocess line %1").arg(i)), QIODevice::Text | QIODevice::ReadWrite);
for (int i = 0; i < 5; ++i) {
QTest::qWait(1000);
process.write(lotsOfData);
@ -901,7 +901,7 @@ void tst_QFile::readLineStdin_lineByLine()
#else
for (int i = 0; i < 2; ++i) {
QProcess process;
process.start(QFINDTESTDATA("stdinprocess/stdinprocess")+ QString(" line %1").arg(i), QIODevice::Text | QIODevice::ReadWrite);
process.start(QString("stdinprocess/stdinprocess line %1").arg(i), QIODevice::Text | QIODevice::ReadWrite);
QVERIFY(process.waitForStarted());
for (int j = 0; j < 3; ++j) {