xref: /aosp_15_r20/external/autotest/client/bin/autotest_client (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1*9c5db199SXin Li#!/usr/bin/python3
2*9c5db199SXin Liimport common
3*9c5db199SXin Li
4*9c5db199SXin Liimport sys, os, time, subprocess
5*9c5db199SXin Li
6*9c5db199SXin Lifrom autotest_lib.client.common_lib import utils
7*9c5db199SXin Li
8*9c5db199SXin Li# We want to set the output (stdout&stderr) of the autotest binary onto our
9*9c5db199SXin Li# stdout channel. We went to get the status stream of autotest back on our
10*9c5db199SXin Li# stderr channel - we set up fd 3 for this, and harness_simple.py can
11*9c5db199SXin Li# open it later.
12*9c5db199SXin Li
13*9c5db199SXin Li# Set up file descriptor 3 as a copy of our stderr. This is the status channel
14*9c5db199SXin Lios.dup2(2,3)
15*9c5db199SXin Li# Join our stderr in with our stdout
16*9c5db199SXin Lios.dup2(1,2)
17*9c5db199SXin Li
18*9c5db199SXin Liautodir = os.path.dirname(sys.argv[0])
19*9c5db199SXin Liautotest = os.path.join(autodir, 'autotest')
20*9c5db199SXin Li
21*9c5db199SXin Liargs = [autotest] + sys.argv[1:]
22*9c5db199SXin Liif '-H' not in args:
23*9c5db199SXin Li    args.insert(1, '-H simple')
24*9c5db199SXin Licmd = ' '.join(args)
25*9c5db199SXin Liexit_code = subprocess.call(cmd, shell=True, stderr=subprocess.STDOUT,
26*9c5db199SXin Li                            close_fds=False)
27*9c5db199SXin Lisys.exit(exit_code) # pass on the exit status from autotest
28