aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsengine
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-10-15 16:00:49 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-16 06:36:47 +0200
commitad7f91c59a87564d2d1d9baad407ba7b07a075a7 (patch)
tree951e50673fe2baee0123832af3909e528242ef4d /tests/auto/qml/qjsengine
parent0c6743749f8bab4bbace3f3c3d1172d1ca959f7c (diff)
Turn on exact garbage collection by default
Keep conservative GC as a fallback for testing Enable all tests again that were skipped due to GC issues. Change-Id: I8e0fa728207bdd39a96d0acf95e27841157d8402 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto/qml/qjsengine')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp27
1 files changed, 5 insertions, 22 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 7dc530b278..39086d75ac 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -64,21 +64,6 @@
Q_DECLARE_METATYPE(QList<int>)
Q_DECLARE_METATYPE(QObjectList)
-// The JavaScriptCore GC marks the C stack. To try to ensure that there is
-// no JSObject* left in stack memory by the compiler, we call this function
-// to zap some bytes of memory before calling collectGarbage().
-static void NO_INLINE zapSomeStack()
-{
- char *buf = (char*)alloca(4096);
- memset(buf, 0, 4096);
-}
-
-static void collectGarbage_helper(QJSEngine &eng)
-{
- zapSomeStack();
- eng.collectGarbage();
-}
-
class tst_QJSEngine : public QObject
{
Q_OBJECT
@@ -452,7 +437,6 @@ void tst_QJSEngine::newQObject()
void tst_QJSEngine::newQObject_ownership()
{
- QSKIP("unreliable test due to our conservative GC");
QJSEngine eng;
{
QPointer<QObject> ptr = new QObject();
@@ -460,7 +444,7 @@ void tst_QJSEngine::newQObject_ownership()
{
QJSValue v = eng.newQObject(ptr);
}
- collectGarbage_helper(eng);
+ eng.collectGarbage();
if (ptr)
QGuiApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
QVERIFY(ptr == 0);
@@ -472,7 +456,7 @@ void tst_QJSEngine::newQObject_ownership()
QJSValue v = eng.newQObject(ptr);
}
QObject *before = ptr;
- collectGarbage_helper(eng);
+ eng.collectGarbage();
QVERIFY(ptr == before);
delete ptr;
}
@@ -490,7 +474,7 @@ void tst_QJSEngine::newQObject_ownership()
{
QJSValue v = eng.newQObject(ptr);
}
- collectGarbage_helper(eng);
+ eng.collectGarbage();
// no parent, so it should be like ScriptOwnership
if (ptr)
QGuiApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
@@ -503,7 +487,7 @@ void tst_QJSEngine::newQObject_ownership()
{
QJSValue v = eng.newQObject(child);
}
- collectGarbage_helper(eng);
+ eng.collectGarbage();
// has parent, so it should be like QtOwnership
QVERIFY(child != 0);
delete parent;
@@ -1241,7 +1225,6 @@ void tst_QJSEngine::castWithMultipleInheritance()
void tst_QJSEngine::collectGarbage()
{
- QSKIP("This test is not reliable due to our conservative GC");
QJSEngine eng;
eng.evaluate("a = new Object(); a = new Object(); a = new Object()");
QJSValue a = eng.newObject();
@@ -1250,7 +1233,7 @@ void tst_QJSEngine::collectGarbage()
QPointer<QObject> ptr = new QObject();
QVERIFY(ptr != 0);
(void)eng.newQObject(ptr);
- collectGarbage_helper(eng);
+ eng.collectGarbage();
if (ptr)
QGuiApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
QVERIFY(ptr == 0);