diff options
author | David Faure <faure+bluesystems@kde.org> | 2012-12-17 18:27:20 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-20 21:16:53 +0100 |
commit | 92243bc346aa3b99bb0a9ad356ef5cdb190bfbca (patch) | |
tree | 6ea59c3b217c24f81e5de11fa8cac707f448dde9 /tests/auto/dbus | |
parent | a42a1db6e1deade3ce9bdd1efaef1077dd0f2aeb (diff) |
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 <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/dbus')
-rw-r--r-- | tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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() |