New issue
Advanced search Search tips

Issue 840593 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Feature

Blocked on:
issue 835991



Sign in to add a comment

Tast: Automatically add attributes based on software dependencies

Project Member Reported by derat@chromium.org, May 8 2018

Issue description

The tast command supports receiving boolean expressions of test attributes[1] to select which tests to run. My idea was that this would make it easy to specify test suites, e.g. the CQ would just use "bvt", the Chrome PFQ would use "bvt && chrome" (i.e. BVT tests that are also Chrome-specific), the Android PFQ would use "bvt && arc", and so on.

More recently, I've added support for letting tests declare software dependencies[2]. The current dependencies overlap with some of the current attributes: the "chrome" and "chrome_login" dependencies imply the "chrome" attribute, and the "android" dependency implies the "arc"[3] attribute.

Moreover, the dependencies directly communicate what I was trying to do with the "chrome" and "arc" attributes: If a test depends on Chrome, it should run in the Chrome PFQ. If it depends on Android, it should run in the Android PFQ.

So, I think I should remove the "chrome" and "arc" attributes and instead give each test additional attributes derived from its dependencies: a "chrome" dependency should add a "dep:chrome" attribute, and an "android" dependency should add a "dep:android" attribute. Then the Chrome PFQ would use "bvt && (dep:chrome || dep:chrome_login)" [4] and the Android PFQ would use "bvt && dep:android".

This avoids duplicating information between dependencies and attributes and prevents the two from getting out of sync (e.g. if someone added a "chrome" dependency but forgot to add a "chrome" attribute, we wouldn't run the test on the Chrome PFQ and it might start failing on the Chrome OS CQ).

I'll continue supporting manually specifying attributes for each test, as that's needed for non-dependency-related attributes like "bvt" or "canary".

1. https://chromium.googlesource.com/chromiumos/platform/tast/+/master/docs/test_attributes.md
2.  issue 835991 , https://chromium.googlesource.com/chromiumos/platform/tast/+/master/docs/test_dependencies.md, http://doc/133fqdEFbUZ6g0IhHFtPQOvl2YHFJg1_QBne8p3rTgz8
3. I changed my name about what I should call that one. :-/
4. Attributes containing colons need to be quoted, but I omitted that above.
 

Comment 1 by ihf@chromium.org, May 8 2018

May I correct:
- If a test depends on Chrome it should run in Chrome PFQ and CQ.
- If a test depends on Android it should run in Android PFQ, Chrome PFQ and CQ.
(Because a kernel change affect the higher stack and a Chrome change affects Android etc.)

At least at the moment a test (like tast) has no understanding on which builder it runs. And that is not a bad thing. But I can see a case for tast to know which builder it is on to interface with external scheduling decisions. (If I understand the proposal right you are adding commit flow path dependency with this, not just static/idempotent build dependency).

Comment 2 by derat@chromium.org, May 8 2018

Whoops, sorry. Jet lag, I guess. Yeah, I realized that after posting -- the Chrome PFQ expression would actually be "bvt && (dep:chrome || dep:chrome_login || dep:android)".

I'm not sure I understand the question at the end of the comment. Attribute expressions are the mechanism by which whatever invokes tast tells it which tests to run (i.e. the expressions define test suites). Some tests in the suite may still be skipped if they have unsatisfied software dependencies. Tast doesn't currently do anything about deciding which DUTs tests should be scheduled on, though.

Comment 3 by ihf@chromium.org, May 8 2018

I think I can see now why you insist on "skipping" tests (correct in your more complex scenario, where otherwise failing tests indeed might be skipped instead of run depending on builder name) instead of "passing" them as I suggest (correct only if independent of builder name/function): you are planning to support more powerful scheduling decisions in tast.

Which is a good goal.

My problem is just, who watches tast and ensures it did consider all tests. What I am looking for is some double entry accounting ensuring we can sanity check that nothing is missing (for instance "bvt && (dep:chrome || dep:chrome_login)" was the right formula and computed correctly for lumpy but also for eve). Making sure the number of tests is constant independent of builder/board/model as CTS does is a simple to humans understand version of this check.

How can you add double entry accounting?
How can you ensure the correctness of tast attribute evaluation long term?

This is something autotest struggles with.

Comment 4 by ihf@chromium.org, May 8 2018

Didn't see #2 when I wrote #3.

Can you list/enumerate the tests based on the expressions before running? That might be a version of double entry accounting that I am looking for.

Comment 5 by ihf@chromium.org, May 8 2018

Maybe my concerns in #3 are really overblown? In autotest it is intractable, because different parts of the system can decide to skip tests/jobs in different places and there is no expectation of what should have been executed. Tast in itself is fairly compact, all code local and it could be sufficiently tested by unit tests.

I am struggling with this. Not trying to bike shed.
Project Member

Comment 6 by bugdroid1@chromium.org, May 9 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/tast/+/d8c4c4c8a08dc9c67f6c1afec0d216786d4f3263

commit d8c4c4c8a08dc9c67f6c1afec0d216786d4f3263
Author: Daniel Erat <derat@chromium.org>
Date: Wed May 09 08:11:04 2018

tast: Automatically add "dep:" test attributes.

Make testing.Test automatically add "dep:"-prefixed
attributes to tests specifying their stated software
dependencies. This makes the existing "chrome" and "arc"
attributes unnecessary, as "dep:chrome", "dep:chrome_login",
and "dep:android" can be used instead.

BUG= chromium:840593 
TEST=added unit tests; also manually verified that "dep:"
     attributes work as expected when included in attribute
     boolean expressions used to select tests and that the
     auto-added attributes are listed in results.json

Change-Id: Ica1b0fe1840769ae214fb161417953f1921432ab
Reviewed-on: https://chromium-review.googlesource.com/1048910
Commit-Ready: Dan Erat <derat@chromium.org>
Tested-by: Dan Erat <derat@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>

[modify] https://crrev.com/d8c4c4c8a08dc9c67f6c1afec0d216786d4f3263/src/chromiumos/tast/testing/test.go
[modify] https://crrev.com/d8c4c4c8a08dc9c67f6c1afec0d216786d4f3263/src/chromiumos/tast/testing/test_test.go
[modify] https://crrev.com/d8c4c4c8a08dc9c67f6c1afec0d216786d4f3263/docs/test_dependencies.md
[modify] https://crrev.com/d8c4c4c8a08dc9c67f6c1afec0d216786d4f3263/docs/running_tests.md
[modify] https://crrev.com/d8c4c4c8a08dc9c67f6c1afec0d216786d4f3263/docs/test_attributes.md

Comment 7 by derat@chromium.org, May 13 2018

It would be straightforward to update the "tast" Autotest server test to log the list of tests that are being considered. Would that help? I'm not sure if there's any way to make the list more visible than that.

Comment 8 by derat@chromium.org, May 21 2018

Status: Fixed (was: Started)

Sign in to add a comment