summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-04 17:36:11 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-04 17:36:11 (GMT)
commite3ee3780777b07e6283a8b33cd4f7e1d56241d1c (patch)
tree810aad53b4537f21d41dc2bf2b37dbbe42e69d05 /tests/auto
parentb408c0b25061bb7244a4da4a40a64c442c99a224 (diff)
parentc5beba29f1ac44ce225d73da67503f23f8aeffdc (diff)
downloadQt-e3ee3780777b07e6283a8b33cd4f7e1d56241d1c.zip
Qt-e3ee3780777b07e6283a8b33cd4f7e1d56241d1c.tar.gz
Qt-e3ee3780777b07e6283a8b33cd4f7e1d56241d1c.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging: Fixed unescaped backslashes in testcase.prf Skip tst_maketestselftest::make_check by default on Windows Fixed tst_maketestselftest on QWS and Windows. Add a test for the `make check' feature. Fix `make check' for debug-and-release on Windows. Move `check' target for autotests into testcase.prf
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/maketestselftest/checktest/checktest.pro7
-rw-r--r--tests/auto/maketestselftest/checktest/main.cpp99
-rw-r--r--tests/auto/maketestselftest/maketestselftest.pro9
-rw-r--r--tests/auto/maketestselftest/test/test.pro18
-rw-r--r--tests/auto/maketestselftest/tst_maketestselftest.cpp76
5 files changed, 203 insertions, 6 deletions
diff --git a/tests/auto/maketestselftest/checktest/checktest.pro b/tests/auto/maketestselftest/checktest/checktest.pro
new file mode 100644
index 0000000..79c5ca5
--- /dev/null
+++ b/tests/auto/maketestselftest/checktest/checktest.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+TARGET = checktest
+CONFIG += console
+CONFIG -= app_bundle
+DESTDIR = ./
+QT = core
+SOURCES += main.cpp
diff --git a/tests/auto/maketestselftest/checktest/main.cpp b/tests/auto/maketestselftest/checktest/main.cpp
new file mode 100644
index 0000000..af98953
--- /dev/null
+++ b/tests/auto/maketestselftest/checktest/main.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QCoreApplication>
+#include <QDir>
+#include <QFile>
+#include <QFileInfo>
+#include <QStringList>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+void fail(QString const& message)
+{
+ printf("CHECKTEST FAIL: %s\n", qPrintable(message));
+ exit(0);
+}
+
+void pass(QString const& message)
+{
+ printf("CHECKTEST PASS: %s\n", qPrintable(message));
+ exit(0);
+}
+
+int main(int argc, char** argv)
+{
+ QCoreApplication app(argc, argv);
+
+ QStringList args = app.arguments();
+ args.removeFirst(); // ourself
+
+ QString args_quoted = QString("'%1'").arg(args.join("','"));
+
+#ifdef Q_WS_QWS
+ {
+ // for QWS we expect tests to be run as the QWS server
+ QString qws = args.takeLast();
+ if (qws != "-qws") {
+ fail(QString("Expected test to be run with `-qws', but it wasn't; args: %1").arg(args_quoted));
+ }
+ }
+#endif
+
+ if (args.count() != 1) {
+ fail(QString("These arguments are not what I expected: %1").arg(args_quoted));
+ }
+
+ QString test = args.at(0);
+
+ QFileInfo testfile(test);
+ if (!testfile.exists()) {
+ fail(QString("File %1 does not exist (my working directory is: %2, my args are: %3)")
+ .arg(test)
+ .arg(QDir::currentPath())
+ .arg(args_quoted)
+ );
+ }
+
+ pass(args_quoted);
+}
+
diff --git a/tests/auto/maketestselftest/maketestselftest.pro b/tests/auto/maketestselftest/maketestselftest.pro
index 6cc1744..a27d5d7 100644
--- a/tests/auto/maketestselftest/maketestselftest.pro
+++ b/tests/auto/maketestselftest/maketestselftest.pro
@@ -1,9 +1,6 @@
-load(qttest_p4)
-
-SOURCES += tst_maketestselftest.cpp
-QT = core
-
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
+TEMPLATE = subdirs
+SUBDIRS = checktest test
+test.depends = checktest
requires(!cross_compile)
diff --git a/tests/auto/maketestselftest/test/test.pro b/tests/auto/maketestselftest/test/test.pro
new file mode 100644
index 0000000..d9de51e
--- /dev/null
+++ b/tests/auto/maketestselftest/test/test.pro
@@ -0,0 +1,18 @@
+load(qttest_p4)
+
+TARGET = ../tst_maketestselftest
+SOURCES += ../tst_maketestselftest.cpp
+QT = core
+
+DEFINES += SRCDIR=\\\"$$PWD/..\\\"
+
+requires(!cross_compile)
+
+win32 {
+ CONFIG(debug, debug|release) {
+ TARGET = ../../debug/tst_maketestselftest
+} else {
+ TARGET = ../../release/tst_maketestselftest
+ }
+}
+
diff --git a/tests/auto/maketestselftest/tst_maketestselftest.cpp b/tests/auto/maketestselftest/tst_maketestselftest.cpp
index 437e143..3d1bbed 100644
--- a/tests/auto/maketestselftest/tst_maketestselftest.cpp
+++ b/tests/auto/maketestselftest/tst_maketestselftest.cpp
@@ -66,6 +66,8 @@ private slots:
void naming_convention();
void naming_convention_data();
+ void make_check();
+
private:
QStringList find_subdirs(QString const&, FindSubdirsMode, QString const& = QString());
@@ -446,6 +448,80 @@ QStringList tst_MakeTestSelfTest::find_subdirs(QString const& pro_file, FindSubd
return out;
}
+void tst_MakeTestSelfTest::make_check()
+{
+ /*
+ Run `make check' over the whole tests tree with a custom TESTRUNNER,
+ to verify that the TESTRUNNER mechanism works right.
+ */
+ QString testsDir(SRCDIR "/..");
+ QString checktest(SRCDIR "/checktest/checktest");
+
+#ifdef Q_OS_WIN32
+ if (qgetenv("RUN_SLOW_TESTS").isEmpty()) {
+ QSKIP("This test is too slow to run by default on Windows. Set RUN_SLOW_TESTS=1 to run it.", SkipAll);
+ }
+ checktest.replace("/", "\\");
+ checktest += ".exe";
+#endif
+
+ QProcess make;
+ make.setWorkingDirectory(testsDir);
+
+ QStringList arguments;
+ arguments << "-k";
+ arguments << "check";
+ arguments << QString("TESTRUNNER=%1").arg(checktest);
+
+ // find the right make; from externaltests.cpp
+ static const char makes[] =
+ "nmake.exe\0"
+ "mingw32-make.exe\0"
+ "gmake\0"
+ "make\0"
+ ;
+
+ bool ok = false;
+ for (const char *p = makes; *p; p += strlen(p) + 1) {
+ make.start(p, arguments);
+ if (make.waitForStarted()) {
+ ok = true;
+ break;
+ }
+ }
+
+ if (!ok) {
+ QFAIL("Could not find the right make tool in PATH");
+ }
+
+ QVERIFY(make.waitForFinished(1000 * 60 * 10));
+ QCOMPARE(make.exitStatus(), QProcess::NormalExit);
+
+ int pass = 0;
+ QList<QByteArray> out = make.readAllStandardOutput().split('\n');
+ QStringList fails;
+ foreach (QByteArray line, out) {
+ while (line.endsWith("\r")) {
+ line.chop(1);
+ }
+ if (line.startsWith("CHECKTEST FAIL")) {
+ fails << QString::fromLocal8Bit(line);
+ }
+ if (line.startsWith("CHECKTEST PASS")) {
+ ++pass;
+ }
+ }
+
+ // We can't check that the exit code of make is 0, because some tests
+ // may have failed to compile, but that doesn't mean `make check' is broken.
+ // We do assume there are at least this many unbroken tests, though.
+ QVERIFY2(fails.count() == 0,
+ qPrintable(QString("`make check' doesn't work for %1 tests:\n%2")
+ .arg(fails.count()).arg(fails.join("\n")))
+ );
+ QVERIFY(pass > 50);
+}
+
QStringList find_test_class(QString const& filename)
{
QStringList out;