Lines Matching refs:self
61 def setUpClass(self): argument
77 self.getUserParams(
81 self.getUserParam(
85 self.data_file_path)
87 self.binary_test_source = self.getUserParam(
90 self.working_directory = {}
91 if hasattr(self, keys.ConfigKeys.IKEY_BINARY_TEST_WORKING_DIRECTORY):
92 self.binary_test_working_directory = map(
93 str, self.binary_test_working_directory)
94 for token in self.binary_test_working_directory:
97 if self.TAG_DELIMITER in token:
98 tag, path = token.split(self.TAG_DELIMITER)
99 self.working_directory[tag] = path
101 self.envp = {}
102 if hasattr(self, keys.ConfigKeys.IKEY_BINARY_TEST_ENVP):
103 self.binary_test_envp = map(str, self.binary_test_envp)
104 for token in self.binary_test_envp:
107 split = token.find(self.TAG_DELIMITER)
110 split + len(self.TAG_DELIMITER):]
111 if tag in self.envp:
112 self.envp[tag] += ' %s' % path
114 self.envp[tag] = path
116 self.args = {}
117 if hasattr(self, keys.ConfigKeys.IKEY_BINARY_TEST_ARGS):
118 self.binary_test_args = map(str, self.binary_test_args)
119 for token in self.binary_test_args:
122 split = token.find(self.TAG_DELIMITER)
125 split + len(self.TAG_DELIMITER):]
126 if tag in self.args:
127 self.args[tag] += ' %s' % arg
129 self.args[tag] = arg
131 if hasattr(self, keys.ConfigKeys.IKEY_PRECONDITION_FILE_PATH_PREFIX):
132 self.file_path_prefix = {
133 self.DEFAULT_TAG_32: [],
134 self.DEFAULT_TAG_64: [],
136 self.precondition_file_path_prefix = map(
137 str, self.precondition_file_path_prefix)
138 for token in self.precondition_file_path_prefix:
141 if self.TAG_DELIMITER in token:
142 tag, path = token.split(self.TAG_DELIMITER)
144 self.file_path_prefix[self.DEFAULT_TAG_32].append(path)
145 self.file_path_prefix[self.DEFAULT_TAG_64].append(path)
146 elif tag in self.file_path_prefix:
147 self.file_path_prefix[tag].append(path)
153 self.ld_library_path = {
154 self.DEFAULT_TAG_32: self.DEFAULT_LD_LIBRARY_PATH_32,
155 self.DEFAULT_TAG_64: self.DEFAULT_LD_LIBRARY_PATH_64,
157 if hasattr(self, keys.ConfigKeys.IKEY_BINARY_TEST_LD_LIBRARY_PATH):
158 self.binary_test_ld_library_path = map(
159 str, self.binary_test_ld_library_path)
160 for token in self.binary_test_ld_library_path:
163 if self.TAG_DELIMITER in token:
164 tag, path = token.split(self.TAG_DELIMITER)
165 if tag in self.ld_library_path:
166 self.ld_library_path[tag] = '{}:{}'.format(
167 path, self.ld_library_path[tag])
169 self.ld_library_path[tag] = path
171 self.profiling_library_path = {
172 self.DEFAULT_TAG_32: self.DEFAULT_PROFILING_LIBRARY_PATH_32,
173 self.DEFAULT_TAG_64: self.DEFAULT_PROFILING_LIBRARY_PATH_64,
175 if hasattr(self,
177 self.binary_test_profiling_library_path = map(
178 str, self.binary_test_profiling_library_path)
179 for token in self.binary_test_profiling_library_path:
182 if self.TAG_DELIMITER in token:
183 tag, path = token.split(self.TAG_DELIMITER)
184 self.profiling_library_path[tag] = path
186 self._dut = self.android_devices[0]
187 self.shell = self._dut.shell
189 if self.coverage.enabled and self.coverage.global_coverage:
190 self.coverage.InitializeDeviceCoverage(self._dut)
191 for tag in [self.DEFAULT_TAG_32, self.DEFAULT_TAG_64]:
192 if tag in self.envp:
193 self.envp[tag] = '%s %s'.format(
194 self.envp[tag], coverage_utils.COVERAGE_TEST_ENV)
196 self.envp[tag] = coverage_utils.COVERAGE_TEST_ENV
198 self.testcases = []
200 self, self._dut, self.shell):
203 self.skipAllTests('precondition sysprop not met')
205 self.tags = set()
206 self.CreateTestCases()
209 for test_case in self.testcases))
210 cmd_results = self.shell.Execute(cmd)
215 def CreateTestCases(self): argument
217 source_list = list(map(self.ParseTestSource, self.binary_test_source))
239 if (tag.endswith(const.SUFFIX_32BIT) and self.abi_bitness == '64'
241 self.abi_bitness == '32'):
245 self.abi_bitness)
259 self._dut.adb.push('{src} {dst}'.format(src=src, dst=dst))
260 self.shell.Execute('ls %s' % dst)
262 if not hasattr(self, 'testcases'):
263 self.testcases = []
269 self.tags.add(tag)
272 testcase = self.CreateTestCase(dst, tag)
277 self.testcases.extend(testcase)
279 self.testcases.append(testcase)
281 if not self.testcases:
284 def PutTag(self, name, tag): argument
296 def ExpandListItemTags(self, input_list): argument
314 if self.TAG_DELIMITER in item:
315 tag, name = item.split(self.TAG_DELIMITER)
316 result.append(self.PutTag(name, tag))
317 for tag in self.tags:
318 result.append(self.PutTag(item, tag))
321 def tearDownClass(self): argument
324 if self.coverage.enabled and self.coverage.global_coverage:
325 if not self.isSkipAllTests():
326 self.coverage.SetCoverageData(dut=self._dut, isGlobal=True)
328 if self.profiling.enabled:
329 self.profiling.DisableVTSProfiling(self.shell)
336 self.ParseTestSource(src) for src in self.binary_test_source
341 cmd_results = self.shell.Execute(cmd, no_except=True)
347 dir_set.add(self.ParseTestSource('')[1])
351 cmd_results = self.shell.Execute(cmd, no_except=True)
355 if not self.isSkipAllTests() and self.profiling.enabled:
356 self.profiling.ProcessAndUploadTraceData()
360 def ParseTestSource(self, source): argument
375 if self.TAG_DELIMITER in source:
376 tag, path = source.split(self.TAG_DELIMITER)
380 if self.PUSH_DELIMITER in path:
381 src, dst = path.split(self.PUSH_DELIMITER)
384 src = os.path.join(self.data_file_path, src)
393 parent = self.working_directory[
394 tag] if tag in self.working_directory else self._GetDefaultBinaryPushDstPath(
403 def _GetDefaultBinaryPushDstPath(self, src, tag): argument
425 parent_path = self.DEVICE_TMP_DIR
428 parent_path, 'vts_binary_test_%s' % self.__class__.__name__, tag)
430 def CreateTestCase(self, path, tag=''): argument
440 working_directory = self.working_directory[
441 tag] if tag in self.working_directory else None
442 envp = self.envp[tag] if tag in self.envp else ''
443 args = self.args[tag] if tag in self.args else ''
444 ld_library_path = self.ld_library_path[
445 tag] if tag in self.ld_library_path else None
446 profiling_library_path = self.profiling_library_path[
447 tag] if tag in self.profiling_library_path else None
454 self.PutTag,
461 def VerifyTestResult(self, test_case, command_results): argument
474 def RunTestCase(self, test_case): argument
480 if self.profiling.enabled:
481 self.profiling.EnableVTSProfiling(self.shell,
486 command_results = self.shell.Execute(cmd)
488 self.VerifyTestResult(test_case, command_results)
490 if self.profiling.enabled:
491 self.profiling.ProcessTraceDataForTestCase(self._dut)
492 self.profiling.DisableVTSProfiling(self.shell)
494 def generateAllTests(self): argument
496 self.runGeneratedTests(
497 test_func=self.RunTestCase, settings=self.testcases, name_func=str)