[gjs: 6/10] CI: Skip refcount tests in extra_gc mode
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 6/10] CI: Skip refcount tests in extra_gc mode
- Date: Sat, 13 Mar 2021 20:23:11 +0000 (UTC)
commit 2a03cf91da53956d43c1ec87a93370039055851e
Author: Philip Chimento <philip chimento gmail com>
Date: Fri Mar 12 16:16:59 2021 -0800
CI: Skip refcount tests in extra_gc mode
extra_gc mode causes an extra GC after every allocation. This causes the
refcount tests to fail because the JS reference to the object is dropped
since nothing is holding on to it from user code. However, we cannot force
this extra GC to happen from user code, since it occurs in the middle of
C++ marshalling. Therefore, we have to skip these tests in extra_gc mode.
installed-tests/js/testGIMarshalling.js | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/installed-tests/js/testGIMarshalling.js b/installed-tests/js/testGIMarshalling.js
index a669f279..4d780412 100644
--- a/installed-tests/js/testGIMarshalling.js
+++ b/installed-tests/js/testGIMarshalling.js
@@ -1331,13 +1331,21 @@ describe('Virtual function', function () {
expect(refcount).toEqual(expectedRefcount);
});
}
+ // Running in extra-gc mode can drop the JS reference, since it is not
+ // actually stored anywhere reachable from user code. However, we cannot
+ // force the extra GC under normal conditions because it occurs in the
+ // middle of C++ code.
+ const skipExtraGC = {};
+ const zeal = GLib.getenv('JS_GC_ZEAL');
+ if (zeal && zeal.startsWith('2,'))
+ skipExtraGC.skip = 'Skip during extra-gc.';
// 1 reference = the object is owned only by JS.
// 2 references = the object is owned by JS and the vfunc caller.
testVfuncRefcount('return', 'none', 1);
- testVfuncRefcount('return', 'full', 2);
+ testVfuncRefcount('return', 'full', 2, skipExtraGC);
testVfuncRefcount('out', 'none', 1);
- testVfuncRefcount('out', 'full', 2);
- testVfuncRefcount('in', 'none', 2, {}, GIMarshallingTests.Object);
+ testVfuncRefcount('out', 'full', 2, skipExtraGC);
+ testVfuncRefcount('in', 'none', 2, skipExtraGC, GIMarshallingTests.Object);
testVfuncRefcount('in', 'full', 1, {
skip: 'https://gitlab.gnome.org/GNOME/gjs/issues/275',
}, GIMarshallingTests.Object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]