Lines Matching refs:self
43 def __init__(self, num_tests, num_inputs, device, dexer, debug_info): argument
53 self._num_tests = num_tests
54 self._num_inputs = num_inputs
55 self._device = device
56 self._save_dir = None
57 self._results_dir = None
58 self._dexfuzz_dir = None
59 self._inputs_dir = None
60 self._dexfuzz_env = None
61 self._dexer = dexer
62 self._debug_info = debug_info
64 def __enter__(self): argument
70 self._save_dir = os.getcwd()
71 self._results_dir = mkdtemp(dir='/tmp/')
72 self._dexfuzz_dir = mkdtemp(dir=self._results_dir)
73 self._inputs_dir = mkdtemp(dir=self._dexfuzz_dir)
74 if self._results_dir is None or self._dexfuzz_dir is None or \
75 self._inputs_dir is None:
77 self._dexfuzz_env = os.environ.copy()
78 self._dexfuzz_env['ANDROID_DATA'] = self._dexfuzz_dir
80 self._dexfuzz_env['PATH'] = (top + '/art/tools/bisection_search:' +
81 self._dexfuzz_env['PATH'])
83 self._dexfuzz_env['ANDROID_ROOT'] = android_root
84 self._dexfuzz_env['LD_LIBRARY_PATH'] = android_root + '/lib'
85 os.chdir(self._dexfuzz_dir)
88 return self
90 def __exit__(self, etype, evalue, etraceback): argument
92 os.chdir(self._save_dir)
95 def Run(self): argument
100 print('#Tests :', self._num_tests)
101 print('Device :', self._device)
102 print('Directory :', self._results_dir)
104 self.GenerateJFuzzPrograms()
105 self.RunDexFuzz()
107 def CompileOnHost(self): argument
113 if self._dexer == 'dx' or self._dexer == 'd8':
114 dbg = '-g' if self._debug_info else '-g:none'
120 dx = 'dx' if self._dexer == 'dx' else 'd8-compat-dx'
131 raise FatalError('Unknown dexer: ' + self._dexer)
133 def GenerateJFuzzPrograms(self): argument
139 os.chdir(self._inputs_dir)
140 for i in range(1, self._num_inputs + 1):
144 self.CompileOnHost()
148 def RunDexFuzz(self): argument
150 os.chdir(self._dexfuzz_dir)
151 dexfuzz_args = ['--inputs=' + self._inputs_dir,
154 '--repeat=' + str(self._num_tests),
161 if self._device is not None:
162 dexfuzz_args += ['--device=' + self._device, '--allarm']
167 call(cmd, env=self._dexfuzz_env)