After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 742797 - Errors thrown when tracking coverage can cause tests to hang
Errors thrown when tracking coverage can cause tests to hang
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
1.43.x
Other Mac OS
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2015-01-12 08:38 UTC by Sam Spilsbury
Modified: 2015-01-18 21:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't allow exceptions from debugger to propagate (5.60 KB, patch)
2015-01-12 08:41 UTC, Sam Spilsbury
none Details | Review
coverage: Don't allow exceptions to propagate in debugger compartment (5.16 KB, patch)
2015-01-14 11:30 UTC, Sam Spilsbury
needs-work Details | Review
Don't propagate exceptions raised in debuggee (with style fixes) (5.17 KB, patch)
2015-01-18 14:38 UTC, Sam Spilsbury
committed Details | Review
Fix other found jshint errors (2.74 KB, patch)
2015-01-18 14:39 UTC, Sam Spilsbury
committed Details | Review

Description Sam Spilsbury 2015-01-12 08:38:08 UTC
A common pattern in some test cases is to start a main loop. The debugger object which keeps track of which lines are executing for the purposes of coverage counting may throw an exception. If it does, then the exception will be thrown in both compartments and the main loop will never exit. This causes tests to hang.

Instead, we should handle the exception gracefully - e.g., log the error and refuse to count coverage for that file.
Comment 1 Sam Spilsbury 2015-01-12 08:41:37 UTC
Created attachment 294327 [details] [review]
Don't allow exceptions from debugger to propagate
Comment 2 Sam Spilsbury 2015-01-14 11:30:41 UTC
Created attachment 294511 [details] [review]
coverage: Don't allow exceptions to propagate in debugger compartment

Slightly revised, fixed a warning about an implicit return undefined.
Comment 3 Jasper St. Pierre (not reading bugmail) 2015-01-17 00:47:34 UTC
Review of attachment 294511 [details] [review]:

::: modules/coverage.js
@@ +653,3 @@
+
+    this.deleteStatistics = function(filename) {
+        coveredFiles[filename] = undefined

Missing semi.

@@ +654,3 @@
+    this.deleteStatistics = function(filename) {
+        coveredFiles[filename] = undefined
+    }

Missing semi.

@@ +710,3 @@
+            frame.onStep = undefined
+            frame._branchTracker = undefined
+            deleteStatistics(frame.script.url)

Lots of semis missing in all of this.

@@ +758,3 @@
+                 * statistics for this file */
+                _logExceptionAndReset(e, name, line);
+                return undefined;

No need for this.

@@ +761,3 @@
+            }
+
+            return undefined;

... or this, it's implicit.
Comment 4 Sam Spilsbury 2015-01-18 14:38:28 UTC
Created attachment 294789 [details] [review]
Don't propagate exceptions raised in debuggee (with style fixes)

Implemented style fixes as suggested. Thanks for pointing those out, I think I've been spoiled by Python lately.
Comment 5 Sam Spilsbury 2015-01-18 14:39:42 UTC
Created attachment 294790 [details] [review]
Fix other found jshint errors

Decided to run the file through jshint to see if there's any other similar mistakes (knowing me). Found a few that are probably just worth nipping in the bud now.