Closed Bug 706433 Opened 13 years ago Closed 13 years ago

Add JS shell compile flag for more determinism (differential testing/fuzzing)

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: decoder, Assigned: decoder)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch Patch (obsolete) — Splinter Review
In differential testing we usually compare the output of two shells running with different options (e.g. TI vs. Interp) and there are quite a few functions that behave differently under those options or even completely non-deterministic. While we can remove or wrap most of those functions at runtime, some obstacles remain.

The attached patch does two things: It makes gc() return an empty string (Jesse mentioned on IRC that wrapping gc() could cause problems) and it makes js_ReportOverRecursed print out a notice on stderr when it is called. The reason for that notice is to recognize when a test hits the recursion limit so we can ignore it, as the recursion limits across different options is not consistent.

Both modifications are not enabled unless the --enable-more-deterministic flag is passed at compile time.
Attachment #577920 - Flags: review?(jorendorff)
Comment on attachment 577920 [details] [diff] [review]
Patch

Review of attachment 577920 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the nit below.

::: js/src/shell/js.cpp
@@ +1212,5 @@
>  
>      char buf[256];
> +#ifdef JS_MORE_DETERMINISTIC
> +    JS_snprintf(buf, sizeof(buf), "");
> +#else

Just buf[0] = '\0'; here please.
Attachment #577920 - Flags: review?(jorendorff) → review+
Attached patch Updated patchSplinter Review
Updated patch to fix the nit. Jason, can you check this in?
Attachment #577920 - Attachment is obsolete: true
Comment on attachment 578429 [details] [diff] [review]
Updated patch

r+ taken from first patch.
Attachment #578429 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/f0159088a7c3
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
Blocks: 751700
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: