Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: build/android/pylib/gtest/gtest_test_instance.py

Issue 2752493002: [android] Add support for passing command-line flags directly. (Closed)
Patch Set: Ensure command_line_flags is always present in the Namespace. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/instrumentation_test_instance.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import HTMLParser 5 import HTMLParser
6 import logging 6 import logging
7 import os 7 import os
8 import re 8 import re
9 import tempfile 9 import tempfile
10 import threading 10 import threading
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 self._app_data_files = args.app_data_files 327 self._app_data_files = args.app_data_files
328 if args.app_data_file_dir: 328 if args.app_data_file_dir:
329 self._app_data_file_dir = args.app_data_file_dir 329 self._app_data_file_dir = args.app_data_file_dir
330 else: 330 else:
331 self._app_data_file_dir = tempfile.mkdtemp() 331 self._app_data_file_dir = tempfile.mkdtemp()
332 logging.critical('Saving app files to %s', self._app_data_file_dir) 332 logging.critical('Saving app files to %s', self._app_data_file_dir)
333 else: 333 else:
334 self._app_data_files = None 334 self._app_data_files = None
335 self._app_data_file_dir = None 335 self._app_data_file_dir = None
336 336
337 self._test_arguments = args.test_arguments 337 self._flags = None
338 self._initializeCommandLineFlags(args)
338 339
339 # TODO(jbudorick): Remove this once it's deployed. 340 # TODO(jbudorick): Remove this once it's deployed.
340 self._enable_xml_result_parsing = args.enable_xml_result_parsing 341 self._enable_xml_result_parsing = args.enable_xml_result_parsing
341 342
343 def _initializeCommandLineFlags(self, args):
344 self._flags = []
345 if args.command_line_flags:
346 self._flags.extend(args.command_line_flags)
347 if args.device_flags_file:
348 with open(args.device_flags_file) as f:
349 stripped_lines = (l.strip() for l in f)
350 self._flags.extend(flag for flag in stripped_lines if flag)
351 if args.run_disabled:
352 self._flags.append('--gtest_also_run_disabled_tests')
353 if args.test_arguments:
354 self._flags.extend(args.test_arguments.split())
355
342 @property 356 @property
343 def activity(self): 357 def activity(self):
344 return self._apk_helper and self._apk_helper.GetActivityName() 358 return self._apk_helper and self._apk_helper.GetActivityName()
345 359
346 @property 360 @property
347 def apk(self): 361 def apk(self):
348 return self._apk_helper and self._apk_helper.path 362 return self._apk_helper and self._apk_helper.path
349 363
350 @property 364 @property
351 def apk_helper(self): 365 def apk_helper(self):
(...skipping 21 matching lines...) Expand all
373 387
374 @property 388 @property
375 def extract_test_list_from_filter(self): 389 def extract_test_list_from_filter(self):
376 return self._extract_test_list_from_filter 390 return self._extract_test_list_from_filter
377 391
378 @property 392 @property
379 def extras(self): 393 def extras(self):
380 return self._extras 394 return self._extras
381 395
382 @property 396 @property
383 def gtest_also_run_disabled_tests(self): 397 def flags(self):
384 return self._run_disabled 398 return self._flags
385 399
386 @property 400 @property
387 def gtest_filter(self): 401 def gtest_filter(self):
388 return self._gtest_filter 402 return self._gtest_filter
389 403
390 @property 404 @property
391 def package(self): 405 def package(self):
392 return self._apk_helper and self._apk_helper.GetPackageName() 406 return self._apk_helper and self._apk_helper.GetPackageName()
393 407
394 @property 408 @property
(...skipping 14 matching lines...) Expand all
409 423
410 @property 424 @property
411 def suite(self): 425 def suite(self):
412 return self._suite 426 return self._suite
413 427
414 @property 428 @property
415 def test_apk_incremental_install_script(self): 429 def test_apk_incremental_install_script(self):
416 return self._test_apk_incremental_install_script 430 return self._test_apk_incremental_install_script
417 431
418 @property 432 @property
419 def test_arguments(self):
420 return self._test_arguments
421
422 @property
423 def total_external_shards(self): 433 def total_external_shards(self):
424 return self._total_external_shards 434 return self._total_external_shards
425 435
426 #override 436 #override
427 def TestType(self): 437 def TestType(self):
428 return 'gtest' 438 return 'gtest'
429 439
430 #override 440 #override
431 def SetUp(self): 441 def SetUp(self):
432 """Map data dependencies via isolate.""" 442 """Map data dependencies via isolate."""
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 '%s' % l for l in (line.strip() for line in disabled_tests_file) 505 '%s' % l for l in (line.strip() for line in disabled_tests_file)
496 if l and not l.startswith('#')] 506 if l and not l.startswith('#')]
497 507
498 return '*-%s' % ':'.join(disabled_filter_items) 508 return '*-%s' % ':'.join(disabled_filter_items)
499 509
500 #override 510 #override
501 def TearDown(self): 511 def TearDown(self):
502 """Do nothing.""" 512 """Do nothing."""
503 pass 513 pass
504 514
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/instrumentation_test_instance.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698