mbligh | 570e93e | 2006-11-26 05:15:56 +0000 | [diff] [blame] | 1 | #!/usr/bin/python |
mbligh | 0ccc1b0 | 2008-04-11 15:40:38 +0000 | [diff] [blame] | 2 | import common |
mbligh | fbfb77d | 2007-02-15 18:54:03 +0000 | [diff] [blame] | 3 | |
jadmanski | a859f26 | 2008-05-19 22:48:25 +0000 | [diff] [blame] | 4 | import sys, os, time, getpass |
mbligh | 570e93e | 2006-11-26 05:15:56 +0000 | [diff] [blame] | 5 | from subprocess import * |
| 6 | |
mbligh | 0ccc1b0 | 2008-04-11 15:40:38 +0000 | [diff] [blame] | 7 | import autotest_lib.client.bin.autotest_utils |
| 8 | utils = autotest_lib.client.bin.autotest_utils |
| 9 | |
mbligh | 570e93e | 2006-11-26 05:15:56 +0000 | [diff] [blame] | 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 |
| 16 | os.dup2(2,3) |
| 17 | # Join our stderr in with our stdout |
| 18 | os.dup2(1,2) |
| 19 | |
mbligh | 0ccc1b0 | 2008-04-11 15:40:38 +0000 | [diff] [blame] | 20 | # If we're using cpusets, run inside the root one by default |
jadmanski | a859f26 | 2008-05-19 22:48:25 +0000 | [diff] [blame] | 21 | if os.path.exists("/dev/cpuset/tasks") and getpass.getuser() == "root": |
mbligh | 0ccc1b0 | 2008-04-11 15:40:38 +0000 | [diff] [blame] | 22 | utils.write_one_line("/dev/cpuset/tasks", str(os.getpid())) |
| 23 | |
mbligh | 570e93e | 2006-11-26 05:15:56 +0000 | [diff] [blame] | 24 | autodir = os.path.dirname(sys.argv[0]) |
| 25 | autotest = os.path.join(autodir, 'autotest') |
| 26 | cmd = ' '.join([autotest, '-H simple'] + sys.argv[1:]) |
mbligh | faf0cd4 | 2007-11-19 16:00:24 +0000 | [diff] [blame] | 27 | exit_code = call(cmd, shell=True, stderr=STDOUT, close_fds=False) |
| 28 | sys.exit(exit_code) # pass on the exit status from autotest |