From a78cf618524ccf0cb5fb569f667f6e0bb6435a64 Mon Sep 17 00:00:00 2001 From: Al Muthanna Athamina Date: Thu, 19 Aug 2021 09:42:20 +0200 Subject: [PATCH] Add D8 flag --no-fail that ignores exceptions on exit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Camillo Bruni Reviewed-by: Georg Neis Reviewed-by: Michael Achenbach Cr-Commit-Position: refs/heads/main@{#76376} --- src/d8/d8.cc | 6 +++++- src/d8/d8.h | 1 + test/mjsunit/verify-no-fail.js | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 test/mjsunit/verify-no-fail.js diff --git a/src/d8/d8.cc b/src/d8/d8.cc index 2f74b9754e..24dfe5b843 100644 --- a/src/d8/d8.cc +++ b/src/d8/d8.cc @@ -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) { diff --git a/src/d8/d8.h b/src/d8/d8.h index 9d3cc4f6d2..e3af73be7b 100644 --- a/src/d8/d8.h +++ b/src/d8/d8.h @@ -385,6 +385,7 @@ class ShellOptions { DisallowReassignment interactive_shell = {"shell", false}; bool test_shell = false; DisallowReassignment expected_to_throw = {"throws", false}; + DisallowReassignment no_fail = {"no-fail", false}; DisallowReassignment ignore_unhandled_promises = { "ignore-unhandled-promises", false}; DisallowReassignment mock_arraybuffer_allocator = { diff --git a/test/mjsunit/verify-no-fail.js b/test/mjsunit/verify-no-fail.js new file mode 100644 index 0000000000..030940304f --- /dev/null +++ b/test/mjsunit/verify-no-fail.js @@ -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);