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

Issue 220353003: Replace recipes_test.py with a new parallel expectation-based test runner. (Closed)

Created:
6 years, 8 months ago by iannucci
Modified:
6 years, 8 months ago
CC:
chromium-reviews, kjellander-cc_chromium.org, cmp-cc_chromium.org, ilevy-cc_chromium.org, stip+watch_chromium.org
Visibility:
Public.

Description

Replace recipes_test.py with a new parallel expectation-based test runner. It has Features(tm): * It's not slow now (2x faster on my macbook air. Parallelizes up to num_cores correctly) * list/train/test/debug all tests * All commands allow you to glob test names * Debugger breaks at GenSteps() and api.step() * Coverage summary only shows uncovered lines in report by default. * Supports YAML expectations (not enabled with this commit) * Shows real context diff when the test expectation doesn't match. * Sort-of-compatible output with unittest * Ctrl-C works. * Produces identical expectations to the current test * It's not flakey R=agable@chromium.org, stip@chromium.org, vadimsh@chromium.org, dpranke@chromium.org BUG=353884 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=261284

Patch Set 1 #

Total comments: 62

Patch Set 2 : all but docstrings #

Patch Set 3 : docstrings #

Total comments: 2

Patch Set 4 : refactor #

Total comments: 18

Patch Set 5 : whitespace #

Patch Set 6 : tweak shebang and clear up test_env imoprt #

Total comments: 4

Patch Set 7 : address comments #

Total comments: 11

Patch Set 8 : comments and fix race #

Total comments: 2

Patch Set 9 : fix oops and demote coverage version to allow cq to pass. 3.7.1 isn't needed anyway #

Patch Set 10 : fix old pylint #

Patch Set 11 : add renamed file... #

Patch Set 12 : *sigh* more pylint #

Patch Set 13 : fix coverage race #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1035 lines, -241 lines) Patch
M scripts/slave/README.recipes.md View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -5 lines 0 comments Download
A + scripts/slave/unittests/expect_tests/__init__.py View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -6 lines 0 comments Download
A scripts/slave/unittests/expect_tests/cover.py View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +89 lines, -0 lines 0 comments Download
A scripts/slave/unittests/expect_tests/handle_debug.py View 1 2 3 4 5 6 7 8 9 1 chunk +37 lines, -0 lines 0 comments Download
A scripts/slave/unittests/expect_tests/handle_list.py View 1 2 3 4 5 6 7 8 9 1 chunk +18 lines, -0 lines 0 comments Download
A scripts/slave/unittests/expect_tests/handle_test.py View 1 2 3 4 5 6 7 8 9 1 chunk +107 lines, -0 lines 0 comments Download
A scripts/slave/unittests/expect_tests/handle_train.py View 1 2 3 4 5 6 7 8 9 1 chunk +135 lines, -0 lines 0 comments Download
A scripts/slave/unittests/expect_tests/main.py View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +127 lines, -0 lines 0 comments Download
A scripts/slave/unittests/expect_tests/pipeline.py View 1 2 3 4 5 6 7 8 9 1 chunk +175 lines, -0 lines 0 comments Download
A scripts/slave/unittests/expect_tests/serialize.py View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +100 lines, -0 lines 0 comments Download
A scripts/slave/unittests/expect_tests/type_definitions.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +183 lines, -0 lines 0 comments Download
M scripts/slave/unittests/recipe_configs_test.py View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
A scripts/slave/unittests/recipe_simulation_test.py View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +58 lines, -0 lines 0 comments Download
D scripts/slave/unittests/recipes_test.py View 1 chunk +0 lines, -229 lines 0 comments Download

Messages

Total messages: 42 (0 generated)
iannucci
6 years, 8 months ago (2014-04-01 01:39:43 UTC) #1
iannucci
https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/recipe_simulation_test.py File scripts/slave/unittests/recipe_simulation_test.py (right): https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/recipe_simulation_test.py#newcode55 scripts/slave/unittests/recipe_simulation_test.py:55: [os.path.join(x, '*', '*api.py') for x in recipe_util.MODULE_DIRS()] Note that ...
6 years, 8 months ago (2014-04-01 01:43:53 UTC) #2
iannucci
https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/expect_tests.py File scripts/slave/unittests/expect_tests.py (right): https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/expect_tests.py#newcode645 scripts/slave/unittests/expect_tests.py:645: f.func_code.co_name)) Need to do this lookup right away since ...
6 years, 8 months ago (2014-04-01 01:47:08 UTC) #3
Vadim Sh.
https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/expect_tests.py File scripts/slave/unittests/expect_tests.py (right): https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/expect_tests.py#newcode51 scripts/slave/unittests/expect_tests.py:51: elif isinstance(obj, list): + tuple? https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/expect_tests.py#newcode58 scripts/slave/unittests/expect_tests.py:58: import json ...
6 years, 8 months ago (2014-04-01 03:00:25 UTC) #4
iannucci
will add missing docstrings @ home https://chromiumcodereview.appspot.com/220353003/diff/1/scripts/slave/unittests/expect_tests.py File scripts/slave/unittests/expect_tests.py (right): https://chromiumcodereview.appspot.com/220353003/diff/1/scripts/slave/unittests/expect_tests.py#newcode51 scripts/slave/unittests/expect_tests.py:51: elif isinstance(obj, list): ...
6 years, 8 months ago (2014-04-01 03:45:14 UTC) #5
iannucci
docstrings done ptal https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/expect_tests.py File scripts/slave/unittests/expect_tests.py (right): https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/expect_tests.py#newcode634 scripts/slave/unittests/expect_tests.py:634: def __new__(cls, name, func, args=(), kwargs=None, ...
6 years, 8 months ago (2014-04-01 06:22:08 UTC) #6
Vadim Sh.
https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/expect_tests.py File scripts/slave/unittests/expect_tests.py (right): https://codereview.chromium.org/220353003/diff/1/scripts/slave/unittests/expect_tests.py#newcode69 scripts/slave/unittests/expect_tests.py:69: lambda stream: yaml.load(stream, _YAMLSafeLoader), On 2014/04/01 03:45:14, iannucci wrote: ...
6 years, 8 months ago (2014-04-01 18:27:49 UTC) #7
Dirk Pranke
I think I'm missing a lot of the big picture here. I'm kinda surprised by ...
6 years, 8 months ago (2014-04-01 18:47:19 UTC) #8
iannucci
On 2014/04/01 18:47:19, Dirk Pranke wrote: > I think I'm missing a lot of the ...
6 years, 8 months ago (2014-04-01 19:43:58 UTC) #9
iannucci
PTAL (refactored lotsmany)
6 years, 8 months ago (2014-04-02 21:57:31 UTC) #10
Vadim Sh.
https://chromiumcodereview.appspot.com/220353003/diff/80001/scripts/slave/unittests/expect_tests/cover.py File scripts/slave/unittests/expect_tests/cover.py (right): https://chromiumcodereview.appspot.com/220353003/diff/80001/scripts/slave/unittests/expect_tests/cover.py#newcode69 scripts/slave/unittests/expect_tests/cover.py:69: def create_subprocess_context(self): @contextlib.contextmanager def create_subprocess_context(self): if not self.enabled: yield ...
6 years, 8 months ago (2014-04-02 22:37:58 UTC) #11
iannucci
addressed https://chromiumcodereview.appspot.com/220353003/diff/80001/scripts/slave/unittests/expect_tests/cover.py File scripts/slave/unittests/expect_tests/cover.py (right): https://chromiumcodereview.appspot.com/220353003/diff/80001/scripts/slave/unittests/expect_tests/cover.py#newcode69 scripts/slave/unittests/expect_tests/cover.py:69: def create_subprocess_context(self): On 2014/04/02 22:37:59, Vadim Sh. wrote: ...
6 years, 8 months ago (2014-04-03 00:03:48 UTC) #12
agable
Non-exhaustive comments, mostly nits. https://chromiumcodereview.appspot.com/220353003/diff/120001/scripts/slave/unittests/expect_tests/cover.py File scripts/slave/unittests/expect_tests/cover.py (right): https://chromiumcodereview.appspot.com/220353003/diff/120001/scripts/slave/unittests/expect_tests/cover.py#newcode19 scripts/slave/unittests/expect_tests/cover.py:19: #not hasattr(coverage.collector, 'CTracer') or Remove ...
6 years, 8 months ago (2014-04-03 00:38:00 UTC) #13
Vadim Sh.
https://codereview.chromium.org/220353003/diff/140001/scripts/slave/unittests/expect_tests/pipeline.py File scripts/slave/unittests/expect_tests/pipeline.py (right): https://codereview.chromium.org/220353003/diff/140001/scripts/slave/unittests/expect_tests/pipeline.py#newcode14 scripts/slave/unittests/expect_tests/pipeline.py:14: def GenLoopProcess(gen, test_queue, result_queue, opts, kill_switch, cover_ctx): gen_loop_process, same ...
6 years, 8 months ago (2014-04-03 01:00:30 UTC) #14
iannucci
ptal https://chromiumcodereview.appspot.com/220353003/diff/140001/scripts/slave/unittests/expect_tests/pipeline.py File scripts/slave/unittests/expect_tests/pipeline.py (right): https://chromiumcodereview.appspot.com/220353003/diff/140001/scripts/slave/unittests/expect_tests/pipeline.py#newcode14 scripts/slave/unittests/expect_tests/pipeline.py:14: def GenLoopProcess(gen, test_queue, result_queue, opts, kill_switch, cover_ctx): On ...
6 years, 8 months ago (2014-04-03 02:30:58 UTC) #15
Vadim Sh.
lgtm Does it gets called by PRESUBMIT.py? https://chromiumcodereview.appspot.com/220353003/diff/160001/scripts/slave/README.recipes.md File scripts/slave/README.recipes.md (right): https://chromiumcodereview.appspot.com/220353003/diff/160001/scripts/slave/README.recipes.md#newcode615 scripts/slave/README.recipes.md:615: To test ...
6 years, 8 months ago (2014-04-03 02:42:08 UTC) #16
iannucci
The CQ bit was checked by iannucci@chromium.org
6 years, 8 months ago (2014-04-03 04:31:35 UTC) #17
iannucci
https://chromiumcodereview.appspot.com/220353003/diff/160001/scripts/slave/README.recipes.md File scripts/slave/README.recipes.md (right): https://chromiumcodereview.appspot.com/220353003/diff/160001/scripts/slave/README.recipes.md#newcode615 scripts/slave/README.recipes.md:615: To test all the recipes/apis, use `slave/unittests/recipes_test.py`. To set ...
6 years, 8 months ago (2014-04-03 04:31:40 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/iannucci@chromium.org/220353003/180001
6 years, 8 months ago (2014-04-03 04:31:42 UTC) #19
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-03 04:32:35 UTC) #20
commit-bot: I haz the power
Presubmit check for 220353003-180001 failed and returned exit status 1. Running presubmit commit checks ...
6 years, 8 months ago (2014-04-03 04:32:35 UTC) #21
iannucci
The CQ bit was checked by iannucci@chromium.org
6 years, 8 months ago (2014-04-03 05:04:07 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/iannucci@chromium.org/220353003/200001
6 years, 8 months ago (2014-04-03 05:04:12 UTC) #23
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-03 05:05:03 UTC) #24
commit-bot: I haz the power
Presubmit check for 220353003-200001 failed and returned exit status 1. Running presubmit commit checks ...
6 years, 8 months ago (2014-04-03 05:05:03 UTC) #25
iannucci
The CQ bit was checked by iannucci@chromium.org
6 years, 8 months ago (2014-04-03 05:05:49 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/iannucci@chromium.org/220353003/120002
6 years, 8 months ago (2014-04-03 05:05:55 UTC) #27
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-03 05:07:01 UTC) #28
commit-bot: I haz the power
Presubmit check for 220353003-120002 failed and returned exit status 1. Running presubmit commit checks ...
6 years, 8 months ago (2014-04-03 05:07:01 UTC) #29
iannucci
Curious... when I run `git cl presubmit` on cq.golo for the build repo with this ...
6 years, 8 months ago (2014-04-03 05:19:21 UTC) #30
iannucci
On 2014/04/03 05:19:21, iannucci wrote: > Curious... when I run `git cl presubmit` on cq.golo ...
6 years, 8 months ago (2014-04-03 05:21:47 UTC) #31
iannucci
Ah... I think recipe_configs_test is racing with this test, and the coverage file sets are ...
6 years, 8 months ago (2014-04-03 05:35:59 UTC) #32
iannucci
The CQ bit was checked by iannucci@chromium.org
6 years, 8 months ago (2014-04-03 05:46:27 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/iannucci@chromium.org/220353003/240001
6 years, 8 months ago (2014-04-03 05:46:31 UTC) #34
commit-bot: I haz the power
Change committed as 261284
6 years, 8 months ago (2014-04-03 05:47:54 UTC) #35
Kevin Graney
Hey I just noticed this CL, and when I run the new script I'm getting ...
6 years, 8 months ago (2014-04-04 13:27:02 UTC) #36
agable
On 2014/04/04 13:27:02, Kevin Graney wrote: > Hey I just noticed this CL, and when ...
6 years, 8 months ago (2014-04-04 16:07:49 UTC) #37
Dirk Pranke
On 2014/04/04 16:07:49, agable wrote: > The correct solution is 'sudo pip install coverage'. Requiring ...
6 years, 8 months ago (2014-04-04 16:18:03 UTC) #38
agable
On 2014/04/04 16:18:03, Dirk Pranke wrote: > On 2014/04/04 16:07:49, agable wrote: > > The ...
6 years, 8 months ago (2014-04-04 16:44:36 UTC) #39
Dirk Pranke
On 2014/04/04 16:44:36, agable wrote: > On 2014/04/04 16:18:03, Dirk Pranke wrote: > > On ...
6 years, 8 months ago (2014-04-04 16:51:43 UTC) #40
iannucci
On 2014/04/04 16:51:43, Dirk Pranke wrote: > On 2014/04/04 16:44:36, agable wrote: > > On ...
6 years, 8 months ago (2014-04-04 17:15:13 UTC) #41
iannucci
6 years, 8 months ago (2014-04-04 18:47:13 UTC) #42
Message was sent while issue was closed.
On 2014/04/04 17:15:13, iannucci wrote:
> On 2014/04/04 16:51:43, Dirk Pranke wrote:
> > On 2014/04/04 16:44:36, agable wrote:
> > > On 2014/04/04 16:18:03, Dirk Pranke wrote:
> > > > On 2014/04/04 16:07:49, agable wrote:
> > > > > The correct solution is 'sudo pip install coverage'.
> > > > 
> > > > Requiring people to manually install packages to get our tests and
> presubmit
> > > > checks to work is bad; we should avoid this if at all possible.
> > > > 
> > > > In particular, we have a version of coverage in depot_tools/third_party.
> We
> > > > should update that if possible and auto-add that to the sys.path for
this.
> > If
> > > we
> > > > can't do that, we need to re-evaluate how this works. Perhaps we need to
> add
> > a
> > > > general install/upgrade script as part of downloading and installing
> > > > depot_tools, or the build repo.
> > > > 
> > > > -- Dirk
> > > 
> > > We can't put it in third_party because the required version of coverage
has
> a
> > > compiled C component. A working version of coverage should be installed by
> the
> > > virtualenv work that other members of the infra team are doing right now.
> > 
> > Okay. I'm clearly not up on what all was buggy in 3.6 that needed the 3.7
> > upgrade -- iannucci linked to some things but I haven't had a chance to read
> > them yet -- but I am troubled by this.
> > 
> > Running the coverage is on by default, right, as is running in parallel?
This
> > means that if you don't have 3.7 installed, you can't run the tests
properly?
> > 
> > If all of this is correct, this patch shouldn't have landed as-is. We
> shouldn't
> > default into a state that might be broken; either the code should
auto-detect
> > the version of coverage and default to serial if it's not new enough, or
> default
> > to serial period, or we should have a way to auto-install the right version
on
> > demand.
> > 
> 
> It does auto detect, but it doesn't auto install. I'll work on that.
> 
> > In addition, requiring a different version than what is in depot_tools is
bad.
> > We shouldn't be introducing version skew across our projects like this
unless
> it
> > is absolutely necessary. This isn't.
> 
> The version in depot_tools is 3.7, but it doesn't have the CTracer.

(CL to fix is posted here: https://codereview.chromium.org/225633007/)

Powered by Google App Engine
This is Rietveld 408576698