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

Side by Side Diff: frontend/planner/support.py

Issue 1595019: Merge remote branch 'origin/upstream' into tempbranch (Closed)
Patch Set: Created 10 years, 8 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 unified diff | Download patch
« no previous file with comments | « frontend/planner/rpc_utils_unittest.py ('k') | frontend/tko/models.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 import common
2 from autotest_lib.frontend.afe import model_attributes as afe_model_attributes
3
4 class TestPlanController(object):
5 """
6 Allows a TestPlanSupport to manage the test plan.
7
8 Contains the variables that the TestPlanSupport methods can manipulate, as
9 well as methods for controlling the flow of the test plan.
10 """
11 def __init__(self, machine, test_alias, *args, **kwargs):
12 super(TestPlanController, self).__init__(*args, **kwargs)
13 self.machine = machine
14 self.test_alias = test_alias
15
16 self._skip = False
17 self._fail = None
18 self._unblock = False
19
20 self._reboot_before = afe_model_attributes.RebootBefore.IF_DIRTY
21 self._reboot_after = afe_model_attributes.RebootAfter.ALWAYS
22 self._run_verify = True
23
24
25 def skip_test(self):
26 """
27 Call this in execute_before() to skip the current test.
28 """
29 self._skip = True
30
31
32 def fail_test(self, reason, attributes={}):
33 """
34 Fails the test with the reason and optional attributes provided.
35
36 Call this in execute_before() to force the test to fail, setting the
37 reason to the provided reason. You may optionally specify some test
38 attributes to set as well, as a dictionary.
39 """
40 self._fail = (reason, attributes)
41
42
43 def unblock(self):
44 """
45 Call this in execute_after() to keep the host unblocked.
46
47 Hosts will block by default if a test fails. If this has been called,
48 the host will be unblocked and will continue in the plan.
49
50 You do not need to call this method for the test plan to continue if the
51 test succeeded. Calling this method from a successful run has no effect.
52 """
53 self._unblock = True
54
55
56 def set_reboot_before(self, reboot_before):
57 """
58 Sets the upcoming job's "Reboot Before" option.
59
60 Must be a value from the RebootBefore frontend model attributes.
61 Defaults to IF_DIRTY.
62 """
63 assert reboot_before in afe_model_attributes.RebootBefore.values
64 self._reboot_before = reboot_before
65
66
67 def set_reboot_after(self, reboot_after):
68 """
69 Sets the upcoming job's "Reboot After" option.
70
71 Must be a value from the RebootAfter frontend model attributes.
72 Defaults to ALWAYS.
73 """
74 assert reboot_after in afe_model_attributes.RebootAfter.values
75 self._reboot_after = reboot_after
76
77
78 def set_run_verify(self, run_verify):
79 """
80 Sets whether or not the job should run the "Verify" stage.
81
82 Defaults to True.
83 """
84 self._run_verify = run_verify
OLDNEW
« no previous file with comments | « frontend/planner/rpc_utils_unittest.py ('k') | frontend/tko/models.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698