Index: client/samples/control.soft_reboot |
diff --git a/client/samples/control.soft_reboot b/client/samples/control.soft_reboot |
new file mode 100644 |
index 0000000000000000000000000000000000000000..30f34033bc8726ae117cd0516ffcc976ee55b9e1 |
--- /dev/null |
+++ b/client/samples/control.soft_reboot |
@@ -0,0 +1,29 @@ |
+AUTHOR = "Autotest Team <autotest@test.kernel.org>" |
+TIME = 'MEDIUM' |
+NAME = "Sample - Machine reboot" |
+TEST_TYPE = "client" |
+TEST_CLASS = "Kernel" |
+ |
+DOC = """ |
+This test will reboot the machine ITERATIONS number of times. Note that if you |
+use this, you'll need to use the step engine for any tests that occur after |
+this one. This means that this may not play well when run from the autotest |
+front end. |
+""" |
+ |
+ITERATIONS = 5 |
+ |
+tries = job.get_state('soft_reboot_tries', 0) + 1 |
+job.set_state("soft_reboot_tries", tries) |
+ |
+if tries < ITERATIONS: |
+ import sys |
+ this_functions_name = sys._getframe().f_code.co_name |
+ if this_functions_name != "?": |
+ # If we're not in a function (i.e. we get "?") then we're |
+ # not using the step engine and thus no next step is |
+ # necessary |
+ job.next_step_prepend(this_functions_name) |
+ |
+if tries <= ITERATIONS: |
+ job.reboot() |