diff options
| -rw-r--r-- | tools/dexfuzz/src/dexfuzz/DexFuzz.java | 9 | ||||
| -rw-r--r-- | tools/dexfuzz/src/dexfuzz/Options.java | 4 | ||||
| -rwxr-xr-x | tools/jfuzz/run_dex_fuzz_test.py | 11 | ||||
| -rwxr-xr-x | tools/jfuzz/run_jfuzz_test.py | 16 | ||||
| -rwxr-xr-x | tools/jfuzz/run_jfuzz_test_nightly.py | 10 |
5 files changed, 37 insertions, 13 deletions
diff --git a/tools/dexfuzz/src/dexfuzz/DexFuzz.java b/tools/dexfuzz/src/dexfuzz/DexFuzz.java index 18db4c1f1a..3b2875482e 100644 --- a/tools/dexfuzz/src/dexfuzz/DexFuzz.java +++ b/tools/dexfuzz/src/dexfuzz/DexFuzz.java @@ -61,11 +61,14 @@ public class DexFuzz { multipleListener.addListener(statusListener); if (Options.repeat > 1 && Options.execute) { - // Add the live updating listener, but only if we're not printing out lots of logs. - if (!Log.likelyToLog()) { + // If executing repeatedly, take care of reporting progress to the user. + if (Options.quiet) { + // Nothing if quiet is requested. + } else if (!Log.likelyToLog()) { + // Add the live updating listener if we're not printing out lots of logs. multipleListener.addListener(new UpdatingConsoleListener()); } else { - // If we are dumping out lots of logs, then use the ConsoleLogger instead. + // If we are dumping out lots of logs, then use the console logger instead. multipleListener.addListener(new ConsoleLoggerListener()); } // Add the file logging listener. diff --git a/tools/dexfuzz/src/dexfuzz/Options.java b/tools/dexfuzz/src/dexfuzz/Options.java index af8a05cdbc..d1d81723eb 100644 --- a/tools/dexfuzz/src/dexfuzz/Options.java +++ b/tools/dexfuzz/src/dexfuzz/Options.java @@ -80,6 +80,7 @@ public class Options { public static boolean dumpMutations; public static boolean loadMutations; public static boolean runBisectionSearch; + public static boolean quiet; /** * Print out usage information about dexfuzz, and then exit. @@ -144,6 +145,7 @@ public class Options { Log.always(" --unique-db=<file> : Use <file> store results about unique programs"); Log.always(" (Default: unique_progs.db)"); Log.always(" --bisection-search : Run bisection search for divergences"); + Log.always(" --quiet : Disables progress log"); Log.always(""); System.exit(0); } @@ -203,6 +205,8 @@ public class Options { maxMethods = 1; } else if (flag.equals("bisection-search")) { runBisectionSearch = true; + } else if (flag.equals("quiet")) { + quiet = true; } else if (flag.equals("help")) { usage(); } else { diff --git a/tools/jfuzz/run_dex_fuzz_test.py b/tools/jfuzz/run_dex_fuzz_test.py index 34a92f6ea8..c1d2e4fba6 100755 --- a/tools/jfuzz/run_dex_fuzz_test.py +++ b/tools/jfuzz/run_dex_fuzz_test.py @@ -91,7 +91,7 @@ class DexFuzzTester(object): def Run(self): """Feeds JFuzz programs into DexFuzz testing.""" print() - print('**\n**** JFuzz Testing\n**') + print('**\n**** J/DexFuzz Testing\n**') print() print('#Tests :', self._num_tests) print('Device :', self._device) @@ -111,9 +111,11 @@ class DexFuzzTester(object): for i in range(1, self._num_inputs + 1): jack_args = ['-cp', GetJackClassPath(), '--output-dex', '.', 'Test.java'] if RunCommand(['jfuzz'], out='Test.java', err=None) != RetCode.SUCCESS: + print('Unexpected error while running JFuzz') raise FatalError('Unexpected error while running JFuzz') if RunCommand(['jack'] + jack_args, out=None, err='jackerr.txt', timeout=30) != RetCode.SUCCESS: + print('Unexpected error while running Jack') raise FatalError('Unexpected error while running Jack') shutil.move('Test.java', '../Test' + str(i) + '.java') shutil.move('classes.dex', 'classes' + str(i) + '.dex') @@ -126,8 +128,11 @@ class DexFuzzTester(object): '--execute', '--execute-class=Test', '--repeat=' + str(self._num_tests), - '--dump-output', '--dump-verify', - '--interpreter', '--optimizing', + '--quiet', + '--dump-output', + '--dump-verify', + '--interpreter', + '--optimizing', '--bisection-search'] if self._device is not None: dexfuzz_args += ['--device=' + self._device, '--allarm'] diff --git a/tools/jfuzz/run_jfuzz_test.py b/tools/jfuzz/run_jfuzz_test.py index b5f856f3b7..7e72aa1d92 100755 --- a/tools/jfuzz/run_jfuzz_test.py +++ b/tools/jfuzz/run_jfuzz_test.py @@ -470,12 +470,20 @@ class JFuzzTester(object): self._num_not_compiled += 1 else: self._num_not_run += 1 - elif self._true_divergence_only and RetCode.TIMEOUT in (retc1, retc2): - # When only true divergences are requested, any divergence in return - # code where one is a time out is treated as a regular time out. - self._num_timed_out += 1 else: # Divergence in return code. + if self._true_divergence_only: + # When only true divergences are requested, any divergence in return + # code where one is a time out is treated as a regular time out. + if RetCode.TIMEOUT in (retc1, retc2): + self._num_timed_out += 1 + return + # When only true divergences are requested, a runtime crash in just + # the RI is treated as if not run at all. + if retc1 == RetCode.ERROR and retc2 == RetCode.SUCCESS: + if self._runner1.GetBisectionSearchArgs() is None: + self._num_not_run += 1 + return self.ReportDivergence(retc1, retc2, is_output_divergence=False) def GetCurrentDivergenceDir(self): diff --git a/tools/jfuzz/run_jfuzz_test_nightly.py b/tools/jfuzz/run_jfuzz_test_nightly.py index a9f8365c8f..e6c216d1f7 100755 --- a/tools/jfuzz/run_jfuzz_test_nightly.py +++ b/tools/jfuzz/run_jfuzz_test_nightly.py @@ -26,8 +26,9 @@ from glob import glob from tempfile import mkdtemp from tempfile import TemporaryFile -# run_jfuzz_test.py success string. +# run_jfuzz_test.py success/failure strings. SUCCESS_STRING = 'success (no divergences)' +FAILURE_STRING = 'FAILURE (divergences)' # Constant returned by string find() method when search fails. NOT_FOUND = -1 @@ -43,7 +44,10 @@ def main(argv): (args, unknown_args) = parser.parse_known_args() # Run processes. cmd = cmd + unknown_args - print('\n**** Running ****\n\n', cmd, '\n') + print() + print('**\n**** Nightly JFuzz Testing\n**') + print() + print('**** Running ****\n\n', cmd, '\n') output_files = [TemporaryFile('wb+') for _ in range(args.num_proc)] processes = [] for i, output_file in enumerate(output_files): @@ -69,7 +73,7 @@ def main(argv): if directory_match: output_dirs.append(directory_match.group(1)) if output_str.find(SUCCESS_STRING) == NOT_FOUND: - print('Tester', i, output_str) + print('Tester', i, FAILURE_STRING) else: print('Tester', i, SUCCESS_STRING) # Gather divergences. |