blob: b673c99ac3a8454eb255df172d1dd4dc812d628e [file] [log] [blame]
mbligh570e93e2006-11-26 05:15:56 +00001#!/usr/bin/python
mbligh0ccc1b02008-04-11 15:40:38 +00002import common
mblighfbfb77d2007-02-15 18:54:03 +00003
jadmanskia859f262008-05-19 22:48:25 +00004import sys, os, time, getpass
mbligh570e93e2006-11-26 05:15:56 +00005from subprocess import *
6
mbligh0ccc1b02008-04-11 15:40:38 +00007import autotest_lib.client.bin.autotest_utils
8utils = autotest_lib.client.bin.autotest_utils
9
mbligh570e93e2006-11-26 05:15:56 +000010# We want to set the output (stdout&stderr) of the autotest binary onto our
11# stdout channel. We went to get the status stream of autotest back on our
12# stderr channel - we set up fd 3 for this, and harness_simple.py can
13# open it later.
14
15# Set up file descriptor 3 as a copy of our stderr. This is the status channel
16os.dup2(2,3)
17# Join our stderr in with our stdout
18os.dup2(1,2)
19
mbligh0ccc1b02008-04-11 15:40:38 +000020# If we're using cpusets, run inside the root one by default
jadmanskia859f262008-05-19 22:48:25 +000021if os.path.exists("/dev/cpuset/tasks") and getpass.getuser() == "root":
mbligh0ccc1b02008-04-11 15:40:38 +000022 utils.write_one_line("/dev/cpuset/tasks", str(os.getpid()))
23
mbligh570e93e2006-11-26 05:15:56 +000024autodir = os.path.dirname(sys.argv[0])
25autotest = os.path.join(autodir, 'autotest')
26cmd = ' '.join([autotest, '-H simple'] + sys.argv[1:])
mblighfaf0cd42007-11-19 16:00:24 +000027exit_code = call(cmd, shell=True, stderr=STDOUT, close_fds=False)
28sys.exit(exit_code) # pass on the exit status from autotest