OLD | NEW |
1 # Copyright 2014-2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2014-2015 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 """Provides simulator test coverage for individual recipes.""" | 5 """Provides simulator test coverage for individual recipes.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import re | 8 import re |
9 import os | 9 import os |
10 import sys | 10 import sys |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 yield expect_tests.Test( | 67 yield expect_tests.Test( |
68 '%s.%s' % (recipe_name, test_data.name), | 68 '%s.%s' % (recipe_name, test_data.name), |
69 expect_tests.FuncCall(RunRecipe, test_data), | 69 expect_tests.FuncCall(RunRecipe, test_data), |
70 expect_dir=expect_path, | 70 expect_dir=expect_path, |
71 expect_base=test_data.name, | 71 expect_base=test_data.name, |
72 covers=covers, | 72 covers=covers, |
73 break_funcs=(recipe.RunSteps,) | 73 break_funcs=(recipe.RunSteps,) |
74 ) | 74 ) |
75 | 75 |
76 | 76 |
77 def main(package_deps, args=None): | 77 def main(universe, args=None): |
78 """Runs simulation tests on a given repo of recipes. | 78 """Runs simulation tests on a given repo of recipes. |
79 | 79 |
80 Args: | 80 Args: |
81 package_deps: a PackageDeps object to operate on | 81 universe: a RecipeUniverse object to operate on |
82 args: command line arguments to expect_tests | 82 args: command line arguments to expect_tests |
83 Returns: | 83 Returns: |
84 Doesn't -- exits with a status code | 84 Doesn't -- exits with a status code |
85 """ | 85 """ |
86 from . import loader | 86 from . import loader |
87 from . import package | 87 from . import package |
88 | 88 |
89 # annotated_run has different behavior when these environment variables | 89 # annotated_run has different behavior when these environment variables |
90 # are set, so unset to make simulation tests environment-invariant. | 90 # are set, so unset to make simulation tests environment-invariant. |
91 for env_var in ['TESTING_MASTER_HOST', | 91 for env_var in ['TESTING_MASTER_HOST', |
92 'TESTING_MASTER', | 92 'TESTING_MASTER', |
93 'TESTING_SLAVENAME']: | 93 'TESTING_SLAVENAME']: |
94 if env_var in os.environ: | 94 if env_var in os.environ: |
95 logging.warn("Ignoring %s environment variable." % env_var) | 95 logging.warn("Ignoring %s environment variable." % env_var) |
96 os.environ.pop(env_var) | 96 os.environ.pop(env_var) |
97 | 97 |
98 global _UNIVERSE | 98 global _UNIVERSE |
99 _UNIVERSE = loader.RecipeUniverse(package_deps) | 99 _UNIVERSE = universe |
100 | 100 |
101 expect_tests.main('recipe_simulation_test', GenerateTests, | 101 expect_tests.main('recipe_simulation_test', GenerateTests, |
102 cover_omit=cover_omit(), args=args) | 102 cover_omit=cover_omit(), args=args) |
OLD | NEW |