summaryrefslogtreecommitdiffstats
path: root/src/tools/rcc
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <dangelog@gmail.com>2012-04-01 18:53:55 +0100
committerQt by Nokia <qt-info@nokia.com>2012-04-03 23:56:10 +0200
commitfb20f9c2da369b07fc50857a90b596ae63f943da (patch)
treeda28a81ab925777e4f82346a1ce6c6684f41c326 /src/tools/rcc
parent72eb9d49a9849ba4a27b27e82b60f4bdd887a70e (diff)
Stop relying on QHash ordering
tst_rcc and tst_qdom rely on specific QHash orderings inside rcc and QDom respectively (see QTBUG-25078 and QTBUG-25071). A workaround is added to make them succeed: QDom checks for all possible orderings, and rcc initializes the hash seed to 0 if the QT_RCC_TEST environment variable is set. Change-Id: I5ed6b50602fceba731c797aec8dffc9cc1d6a1ce Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/tools/rcc')
-rw-r--r--src/tools/rcc/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp
index 3873e74ee5..ad20b9e3ac 100644
--- a/src/tools/rcc/main.cpp
+++ b/src/tools/rcc/main.cpp
@@ -47,6 +47,8 @@
#include <QFile>
#include <QFileInfo>
#include <QTextStream>
+#include <QAtomicInt>
+#include <QtGlobal>
QT_BEGIN_NAMESPACE
@@ -254,9 +256,16 @@ int runRcc(int argc, char *argv[])
return library.output(out, errorDevice) ? 0 : 1;
}
+Q_CORE_EXPORT extern QBasicAtomicInt qt_qhash_seed; // from qhash.cpp
+
QT_END_NAMESPACE
int main(int argc, char *argv[])
{
+ // rcc uses a QHash to store files in the resource system.
+ // we must force a certain hash order when testing or tst_rcc will fail, see QTBUG-25078
+ if (!qgetenv("QT_RCC_TEST").isEmpty() && !qt_qhash_seed.testAndSetRelaxed(-1, 0))
+ qFatal("Cannot force QHash seed for testing as requested");
+
return QT_PREPEND_NAMESPACE(runRcc)(argc, argv);
}