• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1AUTHOR = "Autotest Team <autotest@test.kernel.org>"
2TIME = 'MEDIUM'
3NAME = "Sample - Machine reboot"
4TEST_TYPE = "client"
5TEST_CLASS = "Kernel"
6
7DOC = """
8This test will reboot the machine ITERATIONS number of times.  Note that if you
9use this, you'll need to use the step engine for any tests that occur after
10this one.  This means that this may not play well when run from the autotest
11front end.
12"""
13
14ITERATIONS = 5
15
16tries = job.get_state('soft_reboot_tries', 0) + 1
17job.set_state("soft_reboot_tries", tries)
18
19if tries < ITERATIONS:
20    import sys
21    this_functions_name = sys._getframe().f_code.co_name
22    if this_functions_name != "?":
23        # If we're not in a function (i.e. we get "?") then we're
24        # not using the step engine and thus no next step is
25        # necessary
26        job.next_step_prepend(this_functions_name)
27
28if tries <= ITERATIONS:
29    job.reboot()
30