testlib: Add selftests for skip and fail inside cleanupTestCase().

Change-Id: I9bbe774c3259338d452cd1eb1a6f37a85db15921
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Jason McDonald 2012-02-03 10:22:13 +10:00 committed by Qt by Nokia
parent 931f4501a6
commit 95d0b27711
15 changed files with 261 additions and 1 deletions

View File

@ -0,0 +1,15 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="aTestFunction">
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="cleanupTestCase">
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp" line="59">
<Description><![CDATA['false' returned FALSE. (Fail inside cleanupTestCase)]]></Description>
</Incident>
</TestFunction>

View File

@ -0,0 +1,8 @@
********* Start testing of tst_FailCleanup *********
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_FailCleanup::initTestCase()
PASS : tst_FailCleanup::aTestFunction()
FAIL! : tst_FailCleanup::cleanupTestCase() 'false' returned FALSE. (Fail inside cleanupTestCase)
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp(59)]
Totals: 2 passed, 1 failed, 0 skipped
********* Finished testing of tst_FailCleanup *********

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<TestCase name="tst_FailCleanup">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="aTestFunction">
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="cleanupTestCase">
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp" line="59">
<Description><![CDATA['false' returned FALSE. (Fail inside cleanupTestCase)]]></Description>
</Incident>
</TestFunction>
</TestCase>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" failures="1" tests="3" name="tst_FailCleanup">
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
</properties>
<testcase result="pass" name="initTestCase"/>
<testcase result="pass" name="aTestFunction"/>
<testcase result="fail" name="cleanupTestCase">
<failure message="&apos;false&apos; returned FALSE. (Fail inside cleanupTestCase)" result="fail"/>
</testcase>
<system-err/>
</testsuite>

View File

@ -0,0 +1,15 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="aTestFunction">
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="cleanupTestCase">
<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp" line="59">
<Description><![CDATA[Skip inside cleanupTestCase.]]></Description>
</Message>
</TestFunction>

View File

@ -0,0 +1,8 @@
********* Start testing of tst_SkipCleanup *********
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_SkipCleanup::initTestCase()
PASS : tst_SkipCleanup::aTestFunction()
SKIP : tst_SkipCleanup::cleanupTestCase() Skip inside cleanupTestCase.
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp(59)]
Totals: 2 passed, 0 failed, 1 skipped
********* Finished testing of tst_SkipCleanup *********

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<TestCase name="tst_SkipCleanup">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="aTestFunction">
<Incident type="pass" file="" line="0" />
</TestFunction>
<TestFunction name="cleanupTestCase">
<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp" line="59">
<Description><![CDATA[Skip inside cleanupTestCase.]]></Description>
</Message>
</TestFunction>
</TestCase>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="1" failures="0" tests="3" name="tst_SkipCleanup">
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
</properties>
<testcase result="pass" name="initTestCase"/>
<testcase result="pass" name="aTestFunction"/>
<testcase name="cleanupTestCase">
<!-- message="Skip inside cleanupTestCase." type="skip" -->
</testcase>
<system-err>
<![CDATA[Skip inside cleanupTestCase.]]>
</system-err>
</testsuite>

View File

@ -0,0 +1,7 @@
SOURCES += tst_failcleanup.cpp
QT = core testlib
mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = failcleanup

View File

@ -0,0 +1,63 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QtTest>
class tst_FailCleanup: public QObject
{
Q_OBJECT
private slots:
void aTestFunction() const;
void cleanupTestCase() const;
};
void tst_FailCleanup::aTestFunction() const
{
QVERIFY(true);
}
void tst_FailCleanup::cleanupTestCase() const
{
QVERIFY2(false, "Fail inside cleanupTestCase");
}
QTEST_APPLESS_MAIN(tst_FailCleanup)
#include "tst_failcleanup.moc"

View File

@ -4,4 +4,4 @@ SUBPROGRAMS = subtest warnings maxwarnings cmptest globaldata skip \
exceptionthrow qexecstringlist datatable commandlinedata\ exceptionthrow qexecstringlist datatable commandlinedata\
benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \ benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \
benchliboptions xunit badxml longstring float printdatatags \ benchliboptions xunit badxml longstring float printdatatags \
printdatatagswithglobaltags findtestdata counting printdatatagswithglobaltags findtestdata counting skipcleanup failcleanup

View File

@ -64,6 +64,10 @@
<file>expected_expectfail.txt</file> <file>expected_expectfail.txt</file>
<file>expected_expectfail.xml</file> <file>expected_expectfail.xml</file>
<file>expected_expectfail.xunitxml</file> <file>expected_expectfail.xunitxml</file>
<file>expected_failcleanup.lightxml</file>
<file>expected_failcleanup.txt</file>
<file>expected_failcleanup.xml</file>
<file>expected_failcleanup.xunitxml</file>
<file>expected_failinit.lightxml</file> <file>expected_failinit.lightxml</file>
<file>expected_failinit.txt</file> <file>expected_failinit.txt</file>
<file>expected_failinit.xml</file> <file>expected_failinit.xml</file>
@ -108,6 +112,10 @@
<file>expected_skip.txt</file> <file>expected_skip.txt</file>
<file>expected_skip.xml</file> <file>expected_skip.xml</file>
<file>expected_skip.xunitxml</file> <file>expected_skip.xunitxml</file>
<file>expected_skipcleanup.lightxml</file>
<file>expected_skipcleanup.txt</file>
<file>expected_skipcleanup.xml</file>
<file>expected_skipcleanup.xunitxml</file>
<file>expected_skipinit.lightxml</file> <file>expected_skipinit.lightxml</file>
<file>expected_skipinit.txt</file> <file>expected_skipinit.txt</file>
<file>expected_skipinit.xml</file> <file>expected_skipinit.xml</file>

View File

@ -0,0 +1,7 @@
SOURCES += tst_skipcleanup.cpp
QT = core testlib
mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = skipcleanup

View File

@ -0,0 +1,63 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QtTest>
class tst_SkipCleanup: public QObject
{
Q_OBJECT
private slots:
void aTestFunction() const;
void cleanupTestCase() const;
};
void tst_SkipCleanup::aTestFunction() const
{
QVERIFY(true);
}
void tst_SkipCleanup::cleanupTestCase() const
{
QSKIP("Skip inside cleanupTestCase.");
}
QTEST_APPLESS_MAIN(tst_SkipCleanup)
#include "tst_skipcleanup.moc"

View File

@ -338,6 +338,7 @@ void tst_Selftests::runSubTest_data()
<< "exceptionthrow" << "exceptionthrow"
#endif #endif
<< "expectfail" << "expectfail"
<< "failcleanup"
<< "failinit" << "failinit"
<< "failinitdata" << "failinitdata"
#if !defined(Q_OS_WIN) #if !defined(Q_OS_WIN)
@ -354,6 +355,7 @@ void tst_Selftests::runSubTest_data()
<< "qexecstringlist" << "qexecstringlist"
<< "singleskip" << "singleskip"
<< "skip" << "skip"
<< "skipcleanup"
<< "skipinit" << "skipinit"
<< "skipinitdata" << "skipinitdata"
<< "sleep" << "sleep"