diff --git a/tests/sleeptenmin.py b/tests/sleeptenmin.py index c297e27f2425dc27eaeb2ebf06e298603ef3dccf..a666af7f4b223990cad4b6297ac3b2c43e12a6e4 100755 --- a/tests/sleeptenmin.py +++ b/tests/sleeptenmin.py @@ -15,6 +15,7 @@ # Author: Lucas Meneghel Rodrigues +import os import time from avocado import job @@ -26,15 +27,23 @@ class sleeptenmin(test.Test): """ Sleeps for 10 minutes """ - default_params = {'sleep_length': 600} + default_params = {'sleep_length': 600, + 'sleep_cycles': 1, + 'sleep_method': 'builtin'} def action(self): """ Sleep for length seconds. """ - self.log.debug("Sleeping for %.2f seconds", self.params.sleep_length) - time.sleep(self.params.sleep_length) - + cycles = int(self.params.sleep_cycles) + length = int(self.params.sleep_length) + + for cycle in xrange(0, cycles): + self.log.debug("Sleeping for %.2f seconds", length) + if self.params.sleep_method == 'builtin': + time.sleep(length) + elif self.params.sleep_method == 'shell': + os.system("sleep %s" % length) if __name__ == "__main__": job.main() diff --git a/tests/sleeptenmin.py.data/sleeptenmin.mplx b/tests/sleeptenmin.py.data/sleeptenmin.mplx new file mode 100644 index 0000000000000000000000000000000000000000..09d14aaa19b2847115d1cefa1f7e193db8022d14 --- /dev/null +++ b/tests/sleeptenmin.py.data/sleeptenmin.mplx @@ -0,0 +1,20 @@ +variants: + - sleeptenmin: + variants: + - builtin: + sleep_method = builtin + - shell: + sleep_method = shell + variants: + - one_cycle: + sleep_cycles = 1 + sleep_length = 600 + - six_cycles: + sleep_cycles = 6 + sleep_length = 100 + - one_hundred_cycles: + sleep_cycles = 100 + sleep_length = 6 + - six_hundred_cycles: + sleep_cycles = 600 + sleep_length = 1