| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """This script tests the installer with test cases specified in the config file. | 5 """This script tests the installer with test cases specified in the config file. |
| 6 | 6 |
| 7 For each test case, it checks that the machine states after the execution of | 7 For each test case, it checks that the machine states after the execution of |
| 8 each command match the expected machine states. For more details, take a look at | 8 each command match the expected machine states. For more details, take a look at |
| 9 the design documentation at http://goo.gl/Q0rGM6 | 9 the design documentation at http://goo.gl/Q0rGM6 |
| 10 """ | 10 """ |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 help='Name(s) of tests to run.') | 337 help='Name(s) of tests to run.') |
| 338 args = parser.parse_args() | 338 args = parser.parse_args() |
| 339 if not args.config: | 339 if not args.config: |
| 340 parser.error('missing mandatory --config FILENAME argument') | 340 parser.error('missing mandatory --config FILENAME argument') |
| 341 | 341 |
| 342 mini_installer_path = os.path.join(args.build_dir, args.target, | 342 mini_installer_path = os.path.join(args.build_dir, args.target, |
| 343 'mini_installer.exe') | 343 'mini_installer.exe') |
| 344 assert os.path.exists(mini_installer_path), ('Could not find file %s' % | 344 assert os.path.exists(mini_installer_path), ('Could not find file %s' % |
| 345 mini_installer_path) | 345 mini_installer_path) |
| 346 | 346 |
| 347 next_version_mini_installer_path = os.path.join( |
| 348 args.build_dir, args.target, 'next_version_mini_installer.exe') |
| 349 assert os.path.exists(next_version_mini_installer_path), ( |
| 350 'Could not find file %s' % next_version_mini_installer_path) |
| 351 |
| 347 suite = unittest.TestSuite() | 352 suite = unittest.TestSuite() |
| 348 | 353 |
| 349 # Set the env var used by mini_installer.exe to decide to not show UI. | 354 # Set the env var used by mini_installer.exe to decide to not show UI. |
| 350 os.environ['MINI_INSTALLER_TEST'] = '1' | 355 os.environ['MINI_INSTALLER_TEST'] = '1' |
| 351 | 356 |
| 352 variable_expander = VariableExpander(mini_installer_path) | 357 variable_expander = VariableExpander(mini_installer_path, |
| 358 next_version_mini_installer_path) |
| 353 config = ParseConfigFile(args.config, variable_expander) | 359 config = ParseConfigFile(args.config, variable_expander) |
| 354 | 360 |
| 355 RunCleanCommand(args.force_clean, variable_expander) | 361 RunCleanCommand(args.force_clean, variable_expander) |
| 356 for test in config.tests: | 362 for test in config.tests: |
| 357 # If tests were specified via |tests|, their names are formatted like so: | 363 # If tests were specified via |tests|, their names are formatted like so: |
| 358 test_name = '%s/%s/%s' % (InstallerTest.__module__, | 364 test_name = '%s/%s/%s' % (InstallerTest.__module__, |
| 359 InstallerTest.__name__, | 365 InstallerTest.__name__, |
| 360 test['name']) | 366 test['name']) |
| 361 if not args.test or test_name in args.test: | 367 if not args.test or test_name in args.test: |
| 362 suite.addTest(InstallerTest(test['name'], test['traversal'], config, | 368 suite.addTest(InstallerTest(test['name'], test['traversal'], config, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 trie[path] = value | 439 trie[path] = value |
| 434 return | 440 return |
| 435 directory, rest = path.split(TEST_SEPARATOR, 1) | 441 directory, rest = path.split(TEST_SEPARATOR, 1) |
| 436 if directory not in trie: | 442 if directory not in trie: |
| 437 trie[directory] = {} | 443 trie[directory] = {} |
| 438 _AddPathToTrie(trie[directory], rest, value) | 444 _AddPathToTrie(trie[directory], rest, value) |
| 439 | 445 |
| 440 | 446 |
| 441 if __name__ == '__main__': | 447 if __name__ == '__main__': |
| 442 sys.exit(main()) | 448 sys.exit(main()) |
| OLD | NEW |