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

Unified Diff: scripts/slave/unittests/recipe_simulation_test.py

Issue 355143002: Set coverage path globs on a per-Test basis instead of in main(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: scripts/slave/unittests/recipe_simulation_test.py
diff --git a/scripts/slave/unittests/recipe_simulation_test.py b/scripts/slave/unittests/recipe_simulation_test.py
index 5e82876977e62b3ec41207c82c0ed1bc5cb12f5c..c40422ad58111de87585e5f7242cc47da2fc7185 100755
--- a/scripts/slave/unittests/recipe_simulation_test.py
+++ b/scripts/slave/unittests/recipe_simulation_test.py
@@ -55,10 +55,26 @@ def RunRecipe(test_data):
return expect_tests.Result(ret)
+def test_gen_coverage():
+ return (
+ [os.path.join(x, '*') for x in recipe_util.RECIPE_DIRS()] +
+ [os.path.join(x, '*', 'example.py') for x in recipe_util.MODULE_DIRS()] +
+ [os.path.join(x, '*', 'test_api.py') for x in recipe_util.MODULE_DIRS()]
+ )
+
+@expect_tests.covers(test_gen_coverage)
def GenerateTests():
+ cover_mods = []
+ for mod_dir_base in recipe_util.MODULE_DIRS():
+ if os.path.isdir(mod_dir_base):
+ cover_mods.append(os.path.join(mod_dir_base, '*', '*api.py'))
+
for recipe_path, recipe_name in recipe_loader.loop_over_recipes():
recipe = recipe_loader.load_recipe(recipe_name)
test_api = recipe_loader.create_test_api(recipe.DEPS)
+
+ covers = cover_mods + [recipe_path]
+
for test_data in recipe.GenTests(test_api):
root, name = os.path.split(recipe_path)
name = os.path.splitext(name)[0]
@@ -70,6 +86,7 @@ def GenerateTests():
expect_tests.FuncCall(RunRecipe, test_data),
expect_dir=expect_path,
expect_base=test_data.name,
+ covers=covers,
break_funcs=(recipe.GenSteps,)
)
@@ -84,9 +101,4 @@ if __name__ == '__main__':
logging.warn("Ignoring %s environment variable." % env_var)
os.environ.pop(env_var)
- expect_tests.main('recipe_simulation_test', GenerateTests, (
- [os.path.join(x, '*') for x in recipe_util.RECIPE_DIRS()] +
- [os.path.join(x, '*', '*api.py') for x in recipe_util.MODULE_DIRS()]
- ), (
- [os.path.join(x, '*', '*config.py') for x in recipe_util.MODULE_DIRS()]
- ))
+ expect_tests.main('recipe_simulation_test', GenerateTests)
« scripts/slave/unittests/expect_tests/util.py ('K') | « scripts/slave/unittests/expect_tests/util.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698