cros_fuzz: Improve handling of UBSAN, reproduce and cleanup
Allow logging of UBSAN errors. Prevent "reproduce" command from
excepting when it successfully reproduces a crash. Make
"cleanup" work on a partially deleted build.
Also do some minor refactoring. Improve comments, naming and use
single quotes more consistently.
TEST=Run reproduce commands
BUG=chromium:897942
Change-Id: I9964d556edb7b4604def1572086187944ee3e15e
Reviewed-on: https://chromium-review.googlesource.com/1327828
Commit-Ready: Jonathan Metzman <metzman@chromium.org>
Tested-by: Jonathan Metzman <metzman@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
diff --git a/scripts/cros_fuzz_unittest.py b/scripts/cros_fuzz_unittest.py
index 73b5e2d..ed1681d 100644
--- a/scripts/cros_fuzz_unittest.py
+++ b/scripts/cros_fuzz_unittest.py
@@ -150,21 +150,21 @@
def setUp(self):
_SetPathToSysroot()
self.expected_command = None
- self.expected_env = None
+ self.expected_extra_env = None
self.PatchObject(
cros_fuzz,
'RunSysrootCommand',
side_effect=self.MockedRunSysrootCommand)
- def MockedRunSysrootCommand(
- self, command, env=None, **kwargs): # pylint: disable=unused-argument
+ def MockedRunSysrootCommand(self, command, extra_env=None,
+ **kwargs): # pylint: disable=unused-argument
"""The mocked version of RunSysrootCommand.
- Asserts |command| and |env| are what is expected.
+ Asserts |command| and |extra_env| are what is expected.
"""
self.assertEqual(self.expected_command, command)
- self.assertEqual(self.expected_env, env)
+ self.assertEqual(self.expected_extra_env, extra_env)
class RunFuzzerTest(RunSysrootCommandMockTestCase):
@@ -177,7 +177,11 @@
self.expected_command = [
cros_fuzz.GetFuzzerSysrootPath(FUZZ_TARGET).sysroot,
]
- self.expected_env = {'ASAN_OPTIONS': 'log_path=stderr'}
+ self.expected_extra_env = {
+ 'ASAN_OPTIONS': 'log_path=stderr',
+ 'MSAN_OPTIONS': 'log_path=stderr',
+ 'UBSAN_OPTIONS': 'log_path=stderr',
+ }
def _Helper(self):
"""Calls RunFuzzer."""