Lines Matching refs:self

81   def description(self):  argument
85 def id(self): argument
89 def output_file(self): argument
90 return self.id + '_out.txt'
93 def GetBisectionSearchArgs(self): argument
102 def CompileAndRunTest(self): argument
120 def __init__(self, dexer, debug_info): argument
127 self._dexer = dexer
128 self._debug_info = debug_info
130 def CompileOnHost(self): argument
131 if self._dexer == 'dx' or self._dexer == 'd8':
132 dbg = '-g' if self._debug_info else '-g:none'
135 dx = 'dx' if self._dexer == 'dx' else 'd8-compat-dx'
141 raise FatalError('Unknown dexer: ' + self._dexer)
148 def __init__(self, debug_info): argument
154 self._debug_info = debug_info
157 def description(self): argument
161 def id(self): argument
164 def CompileAndRunTest(self): argument
165 dbg = '-g' if self._debug_info else '-g:none'
168 retc = RunCommand(['java', 'Test'], self.output_file, err=None)
173 def GetBisectionSearchArgs(self): argument
180 def __init__(self, dexer, debug_info, extra_args=None): argument
189 self._art_cmd = ['/bin/bash', 'art', '-cp', 'classes.dex']
191 self._art_cmd += extra_args
192 self._art_cmd.append('Test')
194 def CompileAndRunTest(self): argument
195 if self.CompileOnHost() == RetCode.SUCCESS:
196 retc = RunCommand(self._art_cmd, self.output_file, 'arterr.txt')
205 def __init__(self, dexer, debug_info): argument
215 def description(self): argument
219 def id(self): argument
222 def GetBisectionSearchArgs(self): argument
229 def __init__(self, dexer, debug_info): argument
239 def description(self): argument
243 def id(self): argument
246 def GetBisectionSearchArgs(self): argument
248 self._art_cmd[0:2] + ['{ARGS}'] + self._art_cmd[2:])
255 def __init__(self, dexer, debug_info, device, extra_args=None): argument
265 self._test_env = DeviceTestEnv('jfuzz_', specific_device=device)
266 self._dalvik_cmd = ['dalvikvm']
268 self._dalvik_cmd += extra_args
269 self._device = device
270 self._device_classpath = None
272 def CompileAndRunTest(self): argument
273 if self.CompileOnHost() == RetCode.SUCCESS:
274 self._device_classpath = self._test_env.PushClasspath('classes.dex')
275 cmd = self._dalvik_cmd + ['-cp', self._device_classpath, 'Test']
276 (output, retc) = self._test_env.RunCommand(
278 with open(self.output_file, 'w') as run_out:
284 def GetBisectionSearchArgs(self): argument
286 self._dalvik_cmd + ['-cp',self._device_classpath, 'Test'])
288 if self._device:
289 cmd += ['--device-serial', self._device]
298 def __init__(self, dexer, debug_info, device): argument
309 def description(self): argument
313 def id(self): argument
316 def GetBisectionSearchArgs(self): argument
323 def __init__(self, dexer, debug_info, device): argument
334 def description(self): argument
338 def id(self): argument
341 def GetBisectionSearchArgs(self): argument
343 self._dalvik_cmd + ['-cp', self._device_classpath, 'Test'])
345 if self._device:
346 cmd += ['--device-serial', self._device]
360 def __init__(self, num_tests, device, mode1, mode2, jfuzz_args, argument
375 self._num_tests = num_tests
376 self._device = device
377 self._runner1 = GetExecutionModeRunner(dexer, debug_info, device, mode1)
378 self._runner2 = GetExecutionModeRunner(dexer, debug_info, device, mode2)
379 self._jfuzz_args = jfuzz_args
380 self._report_script = report_script
381 self._true_divergence_only = true_divergence_only
382 self._dexer = dexer
383 self._debug_info = debug_info
384 self._save_dir = None
385 self._results_dir = None
386 self._jfuzz_dir = None
388 self._test = 0
389 self._num_success = 0
390 self._num_not_compiled = 0
391 self._num_not_run = 0
392 self._num_timed_out = 0
393 self._num_divergences = 0
395 def __enter__(self): argument
401 self._save_dir = os.getcwd()
402 self._results_dir = mkdtemp(dir='/tmp/')
403 self._jfuzz_dir = mkdtemp(dir=self._results_dir)
404 if self._results_dir is None or self._jfuzz_dir is None:
406 os.chdir(self._jfuzz_dir)
407 return self
409 def __exit__(self, etype, evalue, etraceback): argument
411 os.chdir(self._save_dir)
412 shutil.rmtree(self._jfuzz_dir)
413 if self._num_divergences == 0:
414 shutil.rmtree(self._results_dir)
416 def Run(self): argument
421 print('#Tests :', self._num_tests)
422 print('Device :', self._device)
423 print('Directory :', self._results_dir)
424 print('Exec-mode1:', self._runner1.description)
425 print('Exec-mode2:', self._runner2.description)
426 print('Dexer :', self._dexer)
427 print('Debug-info:', self._debug_info)
429 self.ShowStats()
430 for self._test in range(1, self._num_tests + 1):
431 self.RunJFuzzTest()
432 self.ShowStats()
433 if self._num_divergences == 0:
438 def ShowStats(self): argument
440 print('\rTests:', self._test,
441 'Success:', self._num_success,
442 'Not-compiled:', self._num_not_compiled,
443 'Not-run:', self._num_not_run,
444 'Timed-out:', self._num_timed_out,
445 'Divergences:', self._num_divergences,
449 def RunJFuzzTest(self): argument
451 self.ConstructTest()
452 retc1 = self._runner1.CompileAndRunTest()
453 retc2 = self._runner2.CompileAndRunTest()
454 self.CheckForDivergence(retc1, retc2)
455 self.CleanupTest()
457 def ConstructTest(self): argument
463 if (RunCommand(['jfuzz'] + self._jfuzz_args, out='Test.java', err=None)
467 def CheckForDivergence(self, retc1, retc2): argument
478 runner1_out = self._runner1.output_file
479 runner2_out = self._runner2.output_file
482 self.ReportDivergence(retc1, retc2, is_output_divergence=True)
485 self._num_success += 1
487 self._num_timed_out += 1
489 self._num_not_compiled += 1
491 self._num_not_run += 1
494 if self._true_divergence_only:
498 self._num_timed_out += 1
503 if self._runner1.GetBisectionSearchArgs() is None:
504 self._num_not_run += 1
506 self.ReportDivergence(retc1, retc2, is_output_divergence=False)
508 def GetCurrentDivergenceDir(self): argument
509 return self._results_dir + '/divergence' + str(self._num_divergences)
511 def ReportDivergence(self, retc1, retc2, is_output_divergence): argument
513 self._num_divergences += 1
514 print('\n' + str(self._num_divergences), end='')
521 ddir = self.GetCurrentDivergenceDir()
527 self.MaybeBisectDivergence(retc1, retc2, is_output_divergence)
529 if self._report_script:
530 self.RunReportScript(retc1, retc2, is_output_divergence)
532 def RunReportScript(self, retc1, retc2, is_output_divergence): argument
536 self._runner1.description, self._runner2.description)
547 ' --num_tests=1 --dexer=' + self._dexer +
548 (' --debug_info ' if self._debug_info else ' ') +
554 ['diff', self._runner1.output_file, self._runner2.output_file],
560 script_cmd = [self._report_script, title, comment]
561 ddir = self.GetCurrentDivergenceDir()
569 def RunBisectionSearch(self, args, expected_retcode, expected_output, argument
571 ddir = self.GetCurrentDivergenceDir()
586 def MaybeBisectDivergence(self, retc1, retc2, is_output_divergence): argument
587 bisection_args1 = self._runner1.GetBisectionSearchArgs()
588 bisection_args2 = self._runner2.GetBisectionSearchArgs()
590 maybe_output1 = self._runner1.output_file
591 maybe_output2 = self._runner2.output_file
595 self.RunBisectionSearch(bisection_args1, retc2, maybe_output2,
596 self._runner1.id)
598 self.RunBisectionSearch(bisection_args2, retc1, maybe_output1,
599 self._runner2.id)
601 def CleanupTest(self): argument
603 for file_name in os.listdir(self._jfuzz_dir):
604 file_path = os.path.join(self._jfuzz_dir, file_name)