Add D8 flag --no-fail that ignores exceptions on exit.

The NumFuzz fuzzers need to make use of this flag to ignore
Mjsunit exceptions and other exceptions. The flag ignores
the exit code 1.

R=​clemensb@chromium.org
R=cbruni@chromium.org

Bug: v8:11826
Change-Id: Ic0878078edec7292e43cdb18dd6fb32f7bbad12c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3103310
Commit-Queue: Almothana Athamneh <almuthanna@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76376}
This commit is contained in:
Al Muthanna Athamina 2021-08-19 09:42:20 +02:00 committed by V8 LUCI CQ
parent f2da7ce0de
commit a78cf61852
3 changed files with 13 additions and 1 deletions

View File

@ -4265,6 +4265,9 @@ bool Shell::SetOptions(int argc, char* argv[]) {
} else if (strcmp(argv[i], "--throws") == 0) {
options.expected_to_throw = true;
argv[i] = nullptr;
} else if (strcmp(argv[i], "--no-fail") == 0) {
options.no_fail = true;
argv[i] = nullptr;
} else if (strncmp(argv[i], "--icu-data-file=", 16) == 0) {
options.icu_data_file = argv[i] + 16;
argv[i] = nullptr;
@ -4514,7 +4517,8 @@ int Shell::RunMain(Isolate* isolate, bool last_run) {
Shell::unhandled_promise_rejections_.store(0);
}
// In order to finish successfully, success must be != expected_to_throw.
return success == Shell::options.expected_to_throw ? 1 : 0;
if (Shell::options.no_fail) return 0;
return (success == Shell::options.expected_to_throw ? 1 : 0);
}
void Shell::CollectGarbage(Isolate* isolate) {

View File

@ -385,6 +385,7 @@ class ShellOptions {
DisallowReassignment<bool> interactive_shell = {"shell", false};
bool test_shell = false;
DisallowReassignment<bool> expected_to_throw = {"throws", false};
DisallowReassignment<bool> no_fail = {"no-fail", false};
DisallowReassignment<bool> ignore_unhandled_promises = {
"ignore-unhandled-promises", false};
DisallowReassignment<bool> mock_arraybuffer_allocator = {

View File

@ -0,0 +1,7 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --no-fail
assertTrue(false);