summaryrefslogtreecommitdiff
path: root/client/bin/autotest_client
blob: 1e275a4b3a25fd7bb0d6e8b00424bf43bb47a33c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python
import common

import sys, os, time, getpass, subprocess

from autotest_lib.client.common_lib import utils

# We want to set the output (stdout&stderr) of the autotest binary onto our
# stdout channel. We went to get the status stream of autotest back on our
# stderr channel - we set up fd 3 for this, and harness_simple.py can
# open it later.

# Set up file descriptor 3 as a copy of our stderr. This is the status channel
os.dup2(2,3)
# Join our stderr in with our stdout
os.dup2(1,2)

# If we're using cpusets, run inside the root one by default
if os.path.exists("/dev/cpuset/tasks") and getpass.getuser() == "root":
    utils.write_one_line("/dev/cpuset/tasks", str(os.getpid()))

autodir = os.path.dirname(sys.argv[0])
autotest = os.path.join(autodir, 'autotest')
cmd = ' '.join([autotest, '-H simple'] + sys.argv[1:])
exit_code = subprocess.call(cmd, shell=True, stderr=subprocess.STDOUT,
                            close_fds=False)
sys.exit(exit_code) # pass on the exit status from autotest