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>
This commit is contained in:
David Faure 2012-12-17 18:27:20 +01:00 committed by The Qt Project
parent a42a1db6e1
commit 92243bc346

View File

@ -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()