diff --git a/SOURCES/qttools-fix-data-files-path-for-tests.patch b/SOURCES/qttools-fix-data-files-path-for-tests.patch new file mode 100644 index 0000000..81e7cd9 --- /dev/null +++ b/SOURCES/qttools-fix-data-files-path-for-tests.patch @@ -0,0 +1,213 @@ +diff --git a/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.cpp b/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.cpp +index 63ee55c..09dfa2e 100644 +--- a/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.cpp ++++ b/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.cpp +@@ -84,12 +84,12 @@ private: + void tst_QHelpContentModel::init() + { + // defined in profile +- QString path = QLatin1String(SRCDIR); ++ QString path = QFINDTESTDATA("data/"); + +- m_colFile = path + QLatin1String("/data/col.qhc"); ++ m_colFile = path + QLatin1String("col.qhc"); + if (QFile::exists(m_colFile)) + QDir::current().remove(m_colFile); +- if (!QFile::copy(path + "/data/collection.qhc", m_colFile)) ++ if (!QFile::copy(path + "collection.qhc", m_colFile)) + QFAIL("Cannot copy file!"); + QFile f(m_colFile); + f.setPermissions(QFile::WriteUser|QFile::ReadUser); +diff --git a/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp b/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp +index 4793250..2398e83 100644 +--- a/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp ++++ b/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp +@@ -81,14 +81,14 @@ private: + void tst_QHelpEngineCore::init() + { + // defined in profile +- m_path = QLatin1String(SRCDIR); ++ m_path = QFINDTESTDATA("data/"); + + m_path = QFileInfo(m_path).absoluteFilePath(); + +- m_colFile = m_path + QLatin1String("/data/col.qhc"); ++ m_colFile = m_path + QLatin1String("col.qhc"); + if (QFile::exists(m_colFile)) + QDir::current().remove(m_colFile); +- if (!QFile::copy(m_path + "/data/collection.qhc", m_colFile)) ++ if (!QFile::copy(m_path + "collection.qhc", m_colFile)) + QFAIL("Cannot copy file!"); + QFile f(m_colFile); + f.setPermissions(QFile::WriteUser|QFile::ReadUser); +@@ -111,7 +111,7 @@ void tst_QHelpEngineCore::setCollectionFile() + QHelpEngineCore help(m_colFile, 0); + QCOMPARE(help.collectionFile(), QFileInfo(m_colFile).absoluteFilePath()); + +- QString col1File = m_path + QLatin1String("/data/collection1.qhc"); ++ QString col1File = m_path + QLatin1String("collection1.qhc"); + help.setCollectionFile(col1File); + QCOMPARE(help.collectionFile(), QFileInfo(col1File).absoluteFilePath()); + +@@ -125,7 +125,7 @@ void tst_QHelpEngineCore::copyCollectionFile() + QHelpEngineCore help(m_colFile, 0); + QCOMPARE(help.collectionFile(), QFileInfo(m_colFile).absoluteFilePath()); + +- QString copiedFile = m_path + QLatin1String("/collectionCopy.qhc"); ++ QString copiedFile = m_path + QLatin1String("collectionCopy.qhc"); + if (QFile::exists(copiedFile)) + QDir::current().remove(copiedFile); + +@@ -165,7 +165,7 @@ void tst_QHelpEngineCore::copyCollectionFile() + while (m_query->next()) { + if (i == 0) { + QCOMPARE(m_query->value(0).toString(), QString("trolltech.com.3-3-8.qmake")); +- QCOMPARE(m_query->value(1).toString(), QString("data/qmake-3.3.8.qch")); ++ QCOMPARE(m_query->value(1).toString(), QString("qmake-3.3.8.qch")); + } + ++i; + } +@@ -179,9 +179,9 @@ void tst_QHelpEngineCore::copyCollectionFile() + + void tst_QHelpEngineCore::namespaceName() + { +- QCOMPARE(QHelpEngineCore::namespaceName(m_path + "/data/qmake-3.3.8.qch"), ++ QCOMPARE(QHelpEngineCore::namespaceName(m_path + "qmake-3.3.8.qch"), + QString("trolltech.com.3-3-8.qmake")); +- QCOMPARE(QHelpEngineCore::namespaceName(m_path + "/data/linguist-3.3.8.qch"), ++ QCOMPARE(QHelpEngineCore::namespaceName(m_path + "linguist-3.3.8.qch"), + QString("trolltech.com.3-3-8.linguist")); + } + +@@ -206,11 +206,11 @@ void tst_QHelpEngineCore::registerDocumentation() + { + QHelpEngineCore c(m_colFile); + QCOMPARE(c.setupData(), true); +- c.registerDocumentation(m_path + "/data/qmake-3.3.8.qch"); ++ c.registerDocumentation(m_path + "qmake-3.3.8.qch"); + QCOMPARE(c.registeredDocumentations().count(), 1); +- c.registerDocumentation(m_path + "/data/qmake-3.3.8.qch"); ++ c.registerDocumentation(m_path + "qmake-3.3.8.qch"); + QCOMPARE(c.registeredDocumentations().count(), 1); +- c.registerDocumentation(m_path + "/data/linguist-3.3.8.qch"); ++ c.registerDocumentation(m_path + "linguist-3.3.8.qch"); + QCOMPARE(c.registeredDocumentations().count(), 2); + } + +@@ -248,9 +248,9 @@ void tst_QHelpEngineCore::documentationFileName() + QHelpEngineCore c(m_colFile); + QCOMPARE(c.setupData(), true); + QCOMPARE(c.documentationFileName(QLatin1String("trolltech.com.3-3-8.qmake")), +- QString(m_path + "/data/qmake-3.3.8.qch")); ++ QString(m_path + "qmake-3.3.8.qch")); + QCOMPARE(c.documentationFileName(QLatin1String("trolltech.com.1-0-0.test")), +- QString(m_path + "/data/test.qch")); ++ QString(m_path + "test.qch")); + QCOMPARE(c.documentationFileName(QLatin1String("trolltech.com.empty")), + QString()); + } +@@ -367,7 +367,7 @@ void tst_QHelpEngineCore::fileData() + QCOMPARE(ba.size(), 0); + ba = help.fileData(QUrl("qthelp://trolltech.com.1-0-0.test/testFolder/test.html")); + QTextStream s(ba, QIODevice::ReadOnly|QIODevice::Text); +- QFile f(m_path + "/data/test.html"); ++ QFile f(m_path + "test.html"); + if (!f.open(QIODevice::ReadOnly|QIODevice::Text)) + QFAIL("Cannot open original file!"); + QTextStream ts(&f); +@@ -433,9 +433,9 @@ void tst_QHelpEngineCore::setAutoSaveFilter() + + void tst_QHelpEngineCore::metaData() + { +- QCOMPARE(QHelpEngineCore::metaData(m_path + "/data/test.qch", "author").toString(), ++ QCOMPARE(QHelpEngineCore::metaData(m_path + "test.qch", "author").toString(), + QString("Digia Plc and/or its subsidiary(-ies)")); +- QCOMPARE(QHelpEngineCore::metaData(m_path + "/data/test.qch", "notExisting").isValid(), ++ QCOMPARE(QHelpEngineCore::metaData(m_path + "test.qch", "notExisting").isValid(), + false); + } + +diff --git a/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp b/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp +index 10cfff9..fdb3b93 100644 +--- a/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp ++++ b/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp +@@ -57,8 +57,8 @@ private: + + void tst_QHelpGenerator::initTestCase() + { +- QString path = QLatin1String(SRCDIR); +- m_outputFile = path + QLatin1String("/data/test.qch"); ++ QString path = QFINDTESTDATA("data/"); ++ m_outputFile = path + QLatin1String("test.qch"); + if (QFile::exists(m_outputFile)) { + QDir d; + if (!d.remove(m_outputFile)) +@@ -69,9 +69,9 @@ void tst_QHelpGenerator::initTestCase() + void tst_QHelpGenerator::generateHelp() + { + // defined in profile +- QString path = QLatin1String(SRCDIR); ++ QString path = QFINDTESTDATA("data/"); + +- QString inputFile(path + "/data/test.qhp"); ++ QString inputFile(path + "test.qhp"); + QHelpProjectData data; + if (!data.readData(inputFile)) + QFAIL("Cannot read qthp file!"); +@@ -194,17 +194,17 @@ void tst_QHelpGenerator::checkMetaData() + void tst_QHelpGenerator::generateTwice() + { + // defined in profile +- QString path = QLatin1String(SRCDIR); ++ QString path = QFINDTESTDATA("data/"); + +- QString inputFile(path + "/data/test.qhp"); ++ QString inputFile(path + "test.qhp"); + QHelpProjectData data; + if (!data.readData(inputFile)) + QFAIL("Cannot read qhp file!"); + + QHelpGenerator generator1; + QHelpGenerator generator2; +- QString outputFile1 = path + QLatin1String("/data/test1.qch"); +- QString outputFile2 = path + QLatin1String("/data/test2.qch"); ++ QString outputFile1 = path + QLatin1String("test1.qch"); ++ QString outputFile2 = path + QLatin1String("test2.qch"); + QCOMPARE(generator1.generate(&data, outputFile1), true); + QCOMPARE(generator2.generate(&data, outputFile2), true); + +diff --git a/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp b/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp +index 494355c..4e1c015 100644 +--- a/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp ++++ b/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp +@@ -84,12 +84,12 @@ private: + + void tst_QHelpIndexModel::init() + { +- QString path = QLatin1String(SRCDIR); ++ QString path = QFINDTESTDATA("data/"); + +- m_colFile = path + QLatin1String("/data/col.qhc"); ++ m_colFile = path + QLatin1String("col.qhc"); + if (QFile::exists(m_colFile)) + QDir::current().remove(m_colFile); +- if (!QFile::copy(path + "/data/collection.qhc", m_colFile)) ++ if (!QFile::copy(path + "collection.qhc", m_colFile)) + QFAIL("Cannot copy file!"); + QFile f(m_colFile); + f.setPermissions(QFile::WriteUser|QFile::ReadUser); +diff --git a/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp b/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp +index 3686416..bb507fa 100644 +--- a/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp ++++ b/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp +@@ -52,8 +52,8 @@ private: + + void tst_QHelpProjectData::initTestCase() + { +- const QString path = QLatin1String(SRCDIR); +- m_inputFile = path + QLatin1String("/data/test.qhp"); ++ const QString path = QFINDTESTDATA("data/"); ++ m_inputFile = path + QLatin1String("test.qhp"); + } + + void tst_QHelpProjectData::readData() diff --git a/SPECS/qt5-qttools.spec b/SPECS/qt5-qttools.spec index 04cfeab..d2ae6e5 100644 --- a/SPECS/qt5-qttools.spec +++ b/SPECS/qt5-qttools.spec @@ -1,11 +1,12 @@ %global qt_module qttools %global qdoc 1 +%global build_tests 1 Summary: Qt5 - QtTool components Name: qt5-qttools Version: 5.11.1 -Release: 5%{?dist} +Release: 9%{?dist} License: LGPLv3 or LGPLv2 Url: http://www.qt.io @@ -22,6 +23,9 @@ Patch4: qttools-opensource-src-5.7-add-libatomic.patch Patch5: qttools-find-clang.patch ## upstream patches +%if 0%{?build_tests} +Patch100: qttools-fix-data-files-path-for-tests.patch +%endif Source20: assistant.desktop Source21: designer.desktop @@ -163,6 +167,15 @@ Requires: %{name}-common = %{version}-%{release} %description examples %{summary}. +%if 0%{?build_tests} +%package tests +Summary: Unit tests for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description tests +%{summary}. +%endif + %prep %setup -q -n %{qt_module}-everywhere-src-%{version} @@ -174,6 +187,10 @@ Requires: %{name}-common = %{version}-%{release} %patch5 -p1 -b .qttools-find-clang %endif +%if 0%{?build_tests} +%patch100 -p1 -b .fix-data-files-path-for-tests +%endif + %build export LLVM_INSTALL_DIR=/usr @@ -181,10 +198,33 @@ export LLVM_INSTALL_DIR=/usr make %{?_smp_mflags} +%if 0%{?build_tests} +make sub-tests %{?_smp_mflags} -k ||: +%endif %install make install INSTALL_ROOT=%{buildroot} +%if 0%{?build_tests} +# Install tests for gating +pushd tests +make install INSTALL_ROOT=%{buildroot} +popd + +mkdir -p %{buildroot}%{_qt5_libdir}/qt5/tests/tst_{lconvert,qhelpcontentmodel,qhelpenginecore,qhelpgenerator,qhelpindexmodel,qhelpprojectdata}/data +mkdir -p %{buildroot}%{_qt5_libdir}/qt5/tests/tst_{lrelease,lupdate,qtattributionsscanner}/testdata +# FIXME install doesn't seem to work well with directories +cp -r tests/auto/linguist/lconvert/data/* %{buildroot}%{_qt5_libdir}/qt5/tests/tst_lconvert/data +cp -r tests/auto/linguist/lrelease/testdata/* %{buildroot}%{_qt5_libdir}/qt5/tests/tst_lrelease/testdata +cp -r tests/auto/linguist/lupdate/testdata/* %{buildroot}%{_qt5_libdir}/qt5/tests/tst_lupdate/testdata +cp -r tests/auto/qhelpcontentmodel/data/* %{buildroot}%{_qt5_libdir}/qt5/tests/tst_qhelpcontentmodel/data +cp -r tests/auto/qhelpenginecore/data/* %{buildroot}%{_qt5_libdir}/qt5/tests/tst_qhelpenginecore/data +cp -r tests/auto/qhelpgenerator/data/* %{buildroot}%{_qt5_libdir}/qt5/tests/tst_qhelpgenerator/data +cp -r tests/auto/qhelpindexmodel/data/* %{buildroot}%{_qt5_libdir}/qt5/tests/tst_qhelpindexmodel/data +cp -r tests/auto/qhelpprojectdata/data/* %{buildroot}%{_qt5_libdir}/qt5/tests/tst_qhelpprojectdata/data +cp -r tests/auto/qtattributionsscanner/testdata/* %{buildroot}%{_qt5_libdir}/qt5/tests/tst_qtattributionsscanner/testdata +%endif + # Add desktop files, --vendor=... helps avoid possible conflicts with qt3/qt4 desktop-file-install \ --dir=%{buildroot}%{_datadir}/applications \ @@ -461,8 +501,28 @@ fi %dir %{_qt5_libdir}/cmake/Qt5Designer %{_qt5_libdir}/cmake/Qt5Designer/Qt5Designer_* +%if 0%{?build_tests} +%files tests +%{_qt5_libdir}/qt5/tests +%endif %changelog +* Fri Jun 07 2019 Jan Grulich - 5.11.1-9 +- Fix unit tests for gating + Resolves: bz#1681905 + +* Tue Jun 04 2019 Jan Grulich - 5.11.1-8 +- Fix unit tests for gating + Resolves: bz#1681905 + +* Mon May 20 2019 Jan Grulich - 5.11.1-7 +- Create a tests subpkg with unit tests for gating + Resolves: bz#1681905 + +* Fri May 17 2019 Jan Grulich - 5.11.1-6 +- Rebuild for LLVM 8.0.0 + Resolves: bz#1709949 + * Wed Dec 12 2018 Tom Stellard - 5.11.1-5 - Rebuld for LLVM 7.0.1 Resolves: bz#1657229