blob: aff727d0882381d4052cdb7b87f559a1a74136fb [file] [log] [blame]
import time
import utils
print "Testing a simple ls command with no timeout"
result = utils.run('ls -d /etc')
output = result.stdout.rstrip()
if output == '/etc':
print "Passed"
else:
raise "Failed"
print
print "Testing system_output"
output = utils.run("ls -d /etc").stdout.strip()
if output == '/etc':
print "Passed"
else:
raise "Failed"
print
print "Testing sleep 2 with timeout of 5"
start = time.time()
result = utils.run('sleep 2', timeout=5)
print "time: %f" % (time.time() - start)
if result.exit_status == 0:
print "Passed"
else:
raise "Failed"
print
print "Testing sleep 10 with timeout of 5"
start = time.time()
result = utils.run('sleep 10', timeout=5)
t = time.time() - start
print "time: %f" % t
if t < 10:
print "Passed"
else:
raise "Failed"