• Home
  • Raw
  • Download

Lines Matching refs:self

82   def description(self):  argument
86 def id(self): argument
90 def output_file(self): argument
91 return self.id + '_out.txt'
94 def GetBisectionSearchArgs(self): argument
103 def CompileAndRunTest(self): argument
121 def __init__(self, dexer, debug_info): argument
128 self._dexer = dexer
129 self._debug_info = debug_info
130 self._jack_args = ['-cp', GetJackClassPath(), '--output-dex', '.',
133 def CompileOnHost(self): argument
134 if self._dexer == 'dx' or self._dexer == 'd8':
135 dbg = '-g' if self._debug_info else '-g:none'
138 dx = 'dx' if self._dexer == 'dx' else 'd8-compat-dx'
143 elif self._dexer == 'jack':
144 retc = RunCommand(['jack'] + self._jack_args,
147 raise FatalError('Unknown dexer: ' + self._dexer)
154 def __init__(self, debug_info): argument
160 self._debug_info = debug_info
163 def description(self): argument
167 def id(self): argument
170 def CompileAndRunTest(self): argument
171 dbg = '-g' if self._debug_info else '-g:none'
174 retc = RunCommand(['java', 'Test'], self.output_file, err=None)
179 def GetBisectionSearchArgs(self): argument
186 def __init__(self, dexer, debug_info, extra_args=None): argument
195 self._art_cmd = ['/bin/bash', 'art', '-cp', 'classes.dex']
197 self._art_cmd += extra_args
198 self._art_cmd.append('Test')
200 def CompileAndRunTest(self): argument
201 if self.CompileOnHost() == RetCode.SUCCESS:
202 retc = RunCommand(self._art_cmd, self.output_file, 'arterr.txt')
211 def __init__(self, dexer, debug_info): argument
221 def description(self): argument
225 def id(self): argument
228 def GetBisectionSearchArgs(self): argument
235 def __init__(self, dexer, debug_info): argument
245 def description(self): argument
249 def id(self): argument
252 def GetBisectionSearchArgs(self): argument
254 self._art_cmd[0:2] + ['{ARGS}'] + self._art_cmd[2:])
261 def __init__(self, dexer, debug_info, device, extra_args=None): argument
271 self._test_env = DeviceTestEnv('jfuzz_', specific_device=device)
272 self._dalvik_cmd = ['dalvikvm']
274 self._dalvik_cmd += extra_args
275 self._device = device
276 self._device_classpath = None
278 def CompileAndRunTest(self): argument
279 if self.CompileOnHost() == RetCode.SUCCESS:
280 self._device_classpath = self._test_env.PushClasspath('classes.dex')
281 cmd = self._dalvik_cmd + ['-cp', self._device_classpath, 'Test']
282 (output, retc) = self._test_env.RunCommand(
284 with open(self.output_file, 'w') as run_out:
290 def GetBisectionSearchArgs(self): argument
292 self._dalvik_cmd + ['-cp',self._device_classpath, 'Test'])
294 if self._device:
295 cmd += ['--device-serial', self._device]
304 def __init__(self, dexer, debug_info, device): argument
315 def description(self): argument
319 def id(self): argument
322 def GetBisectionSearchArgs(self): argument
329 def __init__(self, dexer, debug_info, device): argument
340 def description(self): argument
344 def id(self): argument
347 def GetBisectionSearchArgs(self): argument
349 self._dalvik_cmd + ['-cp', self._device_classpath, 'Test'])
351 if self._device:
352 cmd += ['--device-serial', self._device]
366 def __init__(self, num_tests, device, mode1, mode2, jfuzz_args, argument
381 self._num_tests = num_tests
382 self._device = device
383 self._runner1 = GetExecutionModeRunner(dexer, debug_info, device, mode1)
384 self._runner2 = GetExecutionModeRunner(dexer, debug_info, device, mode2)
385 self._jfuzz_args = jfuzz_args
386 self._report_script = report_script
387 self._true_divergence_only = true_divergence_only
388 self._dexer = dexer
389 self._debug_info = debug_info
390 self._save_dir = None
391 self._results_dir = None
392 self._jfuzz_dir = None
394 self._test = 0
395 self._num_success = 0
396 self._num_not_compiled = 0
397 self._num_not_run = 0
398 self._num_timed_out = 0
399 self._num_divergences = 0
401 def __enter__(self): argument
407 self._save_dir = os.getcwd()
408 self._results_dir = mkdtemp(dir='/tmp/')
409 self._jfuzz_dir = mkdtemp(dir=self._results_dir)
410 if self._results_dir is None or self._jfuzz_dir is None:
412 os.chdir(self._jfuzz_dir)
413 return self
415 def __exit__(self, etype, evalue, etraceback): argument
417 os.chdir(self._save_dir)
418 shutil.rmtree(self._jfuzz_dir)
419 if self._num_divergences == 0:
420 shutil.rmtree(self._results_dir)
422 def Run(self): argument
427 print('#Tests :', self._num_tests)
428 print('Device :', self._device)
429 print('Directory :', self._results_dir)
430 print('Exec-mode1:', self._runner1.description)
431 print('Exec-mode2:', self._runner2.description)
432 print('Dexer :', self._dexer)
433 print('Debug-info:', self._debug_info)
435 self.ShowStats()
436 for self._test in range(1, self._num_tests + 1):
437 self.RunJFuzzTest()
438 self.ShowStats()
439 if self._num_divergences == 0:
444 def ShowStats(self): argument
446 print('\rTests:', self._test,
447 'Success:', self._num_success,
448 'Not-compiled:', self._num_not_compiled,
449 'Not-run:', self._num_not_run,
450 'Timed-out:', self._num_timed_out,
451 'Divergences:', self._num_divergences,
455 def RunJFuzzTest(self): argument
457 self.ConstructTest()
458 retc1 = self._runner1.CompileAndRunTest()
459 retc2 = self._runner2.CompileAndRunTest()
460 self.CheckForDivergence(retc1, retc2)
461 self.CleanupTest()
463 def ConstructTest(self): argument
469 if (RunCommand(['jfuzz'] + self._jfuzz_args, out='Test.java', err=None)
473 def CheckForDivergence(self, retc1, retc2): argument
484 runner1_out = self._runner1.output_file
485 runner2_out = self._runner2.output_file
488 self.ReportDivergence(retc1, retc2, is_output_divergence=True)
491 self._num_success += 1
493 self._num_timed_out += 1
495 self._num_not_compiled += 1
497 self._num_not_run += 1
500 if self._true_divergence_only:
504 self._num_timed_out += 1
509 if self._runner1.GetBisectionSearchArgs() is None:
510 self._num_not_run += 1
512 self.ReportDivergence(retc1, retc2, is_output_divergence=False)
514 def GetCurrentDivergenceDir(self): argument
515 return self._results_dir + '/divergence' + str(self._num_divergences)
517 def ReportDivergence(self, retc1, retc2, is_output_divergence): argument
519 self._num_divergences += 1
520 print('\n' + str(self._num_divergences), end='')
527 ddir = self.GetCurrentDivergenceDir()
533 self.MaybeBisectDivergence(retc1, retc2, is_output_divergence)
535 if self._report_script:
536 self.RunReportScript(retc1, retc2, is_output_divergence)
538 def RunReportScript(self, retc1, retc2, is_output_divergence): argument
542 self._runner1.description, self._runner2.description)
553 ' --num_tests=1 --dexer=' + self._dexer +
554 (' --debug_info ' if self._debug_info else ' ') +
560 ['diff', self._runner1.output_file, self._runner2.output_file],
566 script_cmd = [self._report_script, title, comment]
567 ddir = self.GetCurrentDivergenceDir()
575 def RunBisectionSearch(self, args, expected_retcode, expected_output, argument
577 ddir = self.GetCurrentDivergenceDir()
592 def MaybeBisectDivergence(self, retc1, retc2, is_output_divergence): argument
593 bisection_args1 = self._runner1.GetBisectionSearchArgs()
594 bisection_args2 = self._runner2.GetBisectionSearchArgs()
596 maybe_output1 = self._runner1.output_file
597 maybe_output2 = self._runner2.output_file
601 self.RunBisectionSearch(bisection_args1, retc2, maybe_output2,
602 self._runner1.id)
604 self.RunBisectionSearch(bisection_args2, retc1, maybe_output1,
605 self._runner2.id)
607 def CleanupTest(self): argument
609 for file_name in os.listdir(self._jfuzz_dir):
610 file_path = os.path.join(self._jfuzz_dir, file_name)