autotest_client revision a859f26a0644ff5b41b4731165de5b7b9c5d98fe
1#!/usr/bin/python
2import common
3
4import sys, os, time, getpass
5from subprocess import *
6
7import autotest_lib.client.bin.autotest_utils
8utils = autotest_lib.client.bin.autotest_utils
9
10# 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
20# If we're using cpusets, run inside the root one by default
21if os.path.exists("/dev/cpuset/tasks") and getpass.getuser() == "root":
22	utils.write_one_line("/dev/cpuset/tasks", str(os.getpid()))
23
24autodir = os.path.dirname(sys.argv[0])
25autotest = os.path.join(autodir, 'autotest')
26cmd = ' '.join([autotest, '-H simple'] + sys.argv[1:])
27exit_code = call(cmd, shell=True, stderr=STDOUT, close_fds=False)
28sys.exit(exit_code) # pass on the exit status from autotest
29