summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtextstream
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2012-10-02 08:39:11 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-02 17:45:50 +0200
commite086f429a148ce48c8a0332918fa95951025a70f (patch)
tree2b1ffdd258e762352991935eaf1d8752a1ab1e57 /tests/auto/qtextstream
parentd412f11cea4dc336c684aafcd8979d5cec751cb5 (diff)
Fix autotests that no longer find executables on Windows.
The tests are now run from the 'debug', 'release' subdirectories on Windows by 'make check'. Go up one directory so that the relative paths are correct. Network tests only. Task-number: QTQAINFRA-428 Change-Id: I03bc04028b405bc4f897cbf9d7cb400cc009bb8f Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Diffstat (limited to 'tests/auto/qtextstream')
-rw-r--r--tests/auto/qtextstream/test/test.pro2
-rw-r--r--tests/auto/qtextstream/tst_qtextstream.cpp42
2 files changed, 39 insertions, 5 deletions
diff --git a/tests/auto/qtextstream/test/test.pro b/tests/auto/qtextstream/test/test.pro
index 635404ed89..41aeacf0df 100644
--- a/tests/auto/qtextstream/test/test.pro
+++ b/tests/auto/qtextstream/test/test.pro
@@ -36,5 +36,3 @@ wince*: {
}else {
DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
-
-win32:CONFIG+=insignificant_test # QTQAINFRA-428
diff --git a/tests/auto/qtextstream/tst_qtextstream.cpp b/tests/auto/qtextstream/tst_qtextstream.cpp
index b8322f5871..c34cae59bf 100644
--- a/tests/auto/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/qtextstream/tst_qtextstream.cpp
@@ -89,6 +89,7 @@ public:
virtual ~tst_QTextStream();
public slots:
+ void initTestCase();
void init();
void cleanup();
@@ -342,6 +343,9 @@ private:
QBuffer *inBuffer;
QString *inString;
bool file_is_empty;
+ QString m_readAllStdinProcess;
+ QString m_stdinProcess;
+ QString m_readLineStdinProcess;
};
// Testing get/set functions
@@ -484,6 +488,38 @@ tst_QTextStream::~tst_QTextStream()
{
}
+void tst_QTextStream::initTestCase()
+{
+ QDir workingDirectory = QDir::current();
+ QString readAllStdinProcess = QLatin1String("readAllStdinProcess/readAllStdinProcess");
+ QString stdinProcess = QLatin1String("stdinProcess/stdinProcess");
+ QString readLineStdinProcess = QLatin1String("readLineStdinProcess/readLineStdinProcess");
+ // Windows: cd up to be able to locate the binary of the sub-process.
+#ifdef Q_OS_WIN
+ const QString suffix = QLatin1String(".exe");
+ readAllStdinProcess.append(suffix);
+ stdinProcess.append(suffix);
+ readLineStdinProcess.append(suffix);
+ if (workingDirectory.absolutePath().endsWith(QLatin1String("/debug"), Qt::CaseInsensitive)
+ || workingDirectory.absolutePath().endsWith(QLatin1String("/release"), Qt::CaseInsensitive)) {
+ QVERIFY(workingDirectory.cdUp());
+ QVERIFY(QDir::setCurrent(workingDirectory.absolutePath()));
+ }
+#endif
+ m_readAllStdinProcess = workingDirectory.absoluteFilePath(readAllStdinProcess);
+ m_readLineStdinProcess = workingDirectory.absoluteFilePath(readLineStdinProcess);
+ m_stdinProcess = workingDirectory.absoluteFilePath(stdinProcess);
+ QVERIFY2(QFileInfo(m_readAllStdinProcess).exists(),
+ qPrintable(QString::fromLatin1("ReadAllStdinProcess executable '%1' does not exist!")
+ .arg(QDir::toNativeSeparators(m_readAllStdinProcess))));
+ QVERIFY2(QFileInfo(m_readLineStdinProcess).exists(),
+ qPrintable(QString::fromLatin1("ReadLineStdinProcess executable '%1' does not exist!")
+ .arg(QDir::toNativeSeparators(m_readLineStdinProcess))));
+ QVERIFY2(QFileInfo(m_stdinProcess).exists(),
+ qPrintable(QString::fromLatin1("StdinProcess executable '%1' does not exist!")
+ .arg(QDir::toNativeSeparators(m_stdinProcess))));
+}
+
void tst_QTextStream::init()
{
// Initialize Qt 3 data
@@ -1544,7 +1580,7 @@ void tst_QTextStream::readStdin()
QSKIP("Qt/CE and Symbian have no stdin/out support for processes", SkipAll);
#endif
QProcess stdinProcess;
- stdinProcess.start("stdinProcess/stdinProcess");
+ stdinProcess.start(m_stdinProcess);
stdinProcess.setReadChannel(QProcess::StandardError);
QTextStream stream(&stdinProcess);
@@ -1570,7 +1606,7 @@ void tst_QTextStream::readAllFromStdin()
QSKIP("Qt/CE and Symbian have no stdin/out support for processes", SkipAll);
#endif
QProcess stdinProcess;
- stdinProcess.start("readAllStdinProcess/readAllStdinProcess", QIODevice::ReadWrite | QIODevice::Text);
+ stdinProcess.start(m_readAllStdinProcess, QIODevice::ReadWrite | QIODevice::Text);
stdinProcess.setReadChannel(QProcess::StandardError);
QTextStream stream(&stdinProcess);
@@ -1591,7 +1627,7 @@ void tst_QTextStream::readLineFromStdin()
QSKIP("Qt/CE and Symbian have no stdin/out support for processes", SkipAll);
#endif
QProcess stdinProcess;
- stdinProcess.start("readLineStdinProcess/readLineStdinProcess", QIODevice::ReadWrite | QIODevice::Text);
+ stdinProcess.start(m_readLineStdinProcess, QIODevice::ReadWrite | QIODevice::Text);
stdinProcess.setReadChannel(QProcess::StandardError);
stdinProcess.write("abc\n");