From 92243bc346aa3b99bb0a9ad356ef5cdb190bfbca Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 17 Dec 2012 18:27:20 +0100 Subject: tst_QDBusXmlParser: more reliable solution for setting the seed As recommended by Giuseppe, don't rely on the env var, but use the internal but exported seed atomic int. This way, the compiler will detect breakages, rather than runtime. Change-Id: Iec2bc88c53532d3463d2dc5c73631fc9bc34747b Reviewed-by: Thiago Macieira --- tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp b/tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp index 6d58fdf6d0..ef7b020d89 100644 --- a/tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp +++ b/tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp @@ -72,10 +72,16 @@ private slots: void properties(); }; +QT_BEGIN_NAMESPACE +// Avoid QHash randomization so that the order of the XML attributes is stable +extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed; // from qhash.cpp +QT_END_NAMESPACE + void tst_QDBusXmlParser::initTestCase() { - // Avoid QHash randomization so that the order of the XML attributes is stable - qputenv("QT_HASH_SEED", "123"); + // If the seed not initialized yet (-1), set it to 0 + // otherwise abort, so we don't get unexplained test failures later. + QVERIFY(qt_qhash_seed.testAndSetRelaxed(-1, 0)); } void tst_QDBusXmlParser::parsing_data() -- cgit v1.2.3