| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 failed_test_names = _FailedTestNames(result) | 335 failed_test_names = _FailedTestNames(result) |
| 336 | 336 |
| 337 full_results['num_failures_by_type'] = { | 337 full_results['num_failures_by_type'] = { |
| 338 'FAIL': len(failed_test_names), | 338 'FAIL': len(failed_test_names), |
| 339 'PASS': len(all_test_names) - len(failed_test_names), | 339 'PASS': len(all_test_names) - len(failed_test_names), |
| 340 } | 340 } |
| 341 | 341 |
| 342 full_results['tests'] = {} | 342 full_results['tests'] = {} |
| 343 | 343 |
| 344 for test_name in all_test_names: | 344 for test_name in all_test_names: |
| 345 value = { | 345 value = {} |
| 346 'expected': 'PASS', | 346 value['expected'] = 'PASS' |
| 347 'actual': 'FAIL' if (test_name in failed_test_names) else 'PASS', | 347 if test_name in failed_test_names: |
| 348 } | 348 value['actual'] = 'FAIL' |
| 349 value['is_unexpected'] = True |
| 350 else: |
| 351 value['actual'] = 'PASS' |
| 349 _AddPathToTrie(full_results['tests'], test_name, value) | 352 _AddPathToTrie(full_results['tests'], test_name, value) |
| 350 | 353 |
| 351 return full_results | 354 return full_results |
| 352 | 355 |
| 353 | 356 |
| 354 def _AllTestNames(suite): | 357 def _AllTestNames(suite): |
| 355 test_names = [] | 358 test_names = [] |
| 356 # _tests is protected pylint: disable=W0212 | 359 # _tests is protected pylint: disable=W0212 |
| 357 for test in suite._tests: | 360 for test in suite._tests: |
| 358 if isinstance(test, unittest.suite.TestSuite): | 361 if isinstance(test, unittest.suite.TestSuite): |
| (...skipping 12 matching lines...) Expand all Loading... |
| 371 trie[path] = value | 374 trie[path] = value |
| 372 return | 375 return |
| 373 directory, rest = path.split(TEST_SEPARATOR, 1) | 376 directory, rest = path.split(TEST_SEPARATOR, 1) |
| 374 if directory not in trie: | 377 if directory not in trie: |
| 375 trie[directory] = {} | 378 trie[directory] = {} |
| 376 _AddPathToTrie(trie[directory], rest, value) | 379 _AddPathToTrie(trie[directory], rest, value) |
| 377 | 380 |
| 378 | 381 |
| 379 if __name__ == '__main__': | 382 if __name__ == '__main__': |
| 380 sys.exit(main()) | 383 sys.exit(main()) |
| OLD | NEW |