| OLD | NEW |
| 1 # Copyright 2017 The LUCI Authors. All rights reserved. | 1 # Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 from __future__ import print_function | 5 from __future__ import print_function |
| 6 | 6 |
| 7 import bdb | 7 import bdb |
| 8 import cStringIO | 8 import cStringIO |
| 9 import contextlib | 9 import contextlib |
| 10 import copy | 10 import copy |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 '--filter', action='append', type=normalize_filter, | 915 '--filter', action='append', type=normalize_filter, |
| 916 help=glob_helpstr) | 916 help=glob_helpstr) |
| 917 | 917 |
| 918 def postprocess_func(_parser, args): | 918 def postprocess_func(_parser, args): |
| 919 # Auto-enable bootstrap for test command invocations (necessary to get | 919 # Auto-enable bootstrap for test command invocations (necessary to get |
| 920 # recent enough version of coverage package), unless explicitly disabled. | 920 # recent enough version of coverage package), unless explicitly disabled. |
| 921 if args.use_bootstrap is None: | 921 if args.use_bootstrap is None: |
| 922 args.use_bootstrap = True | 922 args.use_bootstrap = True |
| 923 | 923 |
| 924 test_p.set_defaults( | 924 test_p.set_defaults( |
| 925 command='test', func=main, | 925 func=main, postprocess_func=postprocess_func, |
| 926 postprocess_func=postprocess_func, | |
| 927 ) | 926 ) |
| 928 | 927 |
| 929 | 928 |
| 930 def main(package_deps, args): | 929 def main(package_deps, args): |
| 931 """Runs simulation tests on a given repo of recipes. | 930 """Runs simulation tests on a given repo of recipes. |
| 932 | 931 |
| 933 Args: | 932 Args: |
| 934 package_deps (PackageDeps) | 933 package_deps (PackageDeps) |
| 935 args: the parsed args (see add_subparser). | 934 args: the parsed args (see add_subparser). |
| 936 Returns: | 935 Returns: |
| 937 Exit code | 936 Exit code |
| 938 """ | 937 """ |
| 939 universe = loader.RecipeUniverse(package_deps, args.package) | 938 universe = loader.RecipeUniverse(package_deps, args.package) |
| 940 universe_view = loader.UniverseView(universe, package_deps.root_package) | 939 universe_view = loader.UniverseView(universe, package_deps.root_package) |
| 941 engine_flags=args.operational_args.engine_flags | 940 engine_flags=args.operational_args.engine_flags |
| 942 | 941 |
| 943 # Prevent flakiness caused by stale pyc files. | 942 # Prevent flakiness caused by stale pyc files. |
| 944 package.cleanup_pyc(package_deps.root_package.recipes_dir) | 943 package.cleanup_pyc(package_deps.root_package.recipes_dir) |
| 945 | 944 |
| 946 global _UNIVERSE_VIEW | 945 global _UNIVERSE_VIEW |
| 947 _UNIVERSE_VIEW = universe_view | 946 _UNIVERSE_VIEW = universe_view |
| 948 global _ENGINE_FLAGS | 947 global _ENGINE_FLAGS |
| 949 _ENGINE_FLAGS = engine_flags | 948 _ENGINE_FLAGS = engine_flags |
| 950 | 949 |
| 951 return args.subfunc(args) | 950 return args.subfunc(args) |
| OLD | NEW |