• Home
  • Raw
  • Download

Lines Matching +full:command +full:- +full:and +full:- +full:control

1 #!/usr/bin/python3 -u
2 # Copyright 2007-2008 Martin J. Bligh <mbligh@google.com>, Google Inc.
6 Run a control file through the server side engine
61 # Control segment to stage server-side package.
65 # Command line to start servod in a moblab.
70 _CONTROL_FILE_FROM_CONTROL_NAME = 'control.from_control_name'
75 logging.error("Received SIGALARM. Ignoring and continuing on.")
80 """Get a list of companion devices from command line arg -ch.
82 @param parser: Parser for the command line arguments.
84 @return: A list of companion devices from command line arg -ch.
101 """Get a list of DUT server addresses from command line arg --dut_servers.
103 @param parser: Parser for the command line arguments.
105 @return: A list of DUT server addresses from command line arg
106 --dut_servers.
125 """Get a list of machine names from command line arg -m or a file.
127 @param parser: Parser for the command line arguments.
129 @return: A list of machine names from command line arg -m or the
130 machines file specified in the command line arg -M.
157 """Stage server-side package.
159 This function calls a control segment to stage server-side package based on
160 the job and autoserv command line option. The detail implementation could
163 The script returns None if no server-side package is available. However,
165 server-side package) not found.
167 @param parser: Command line arguments parser passed in the autoserv process.
173 @return: url to the autotest server-side package. None in case of errors.
204 """Run the server job with server-side packaging.
214 @param parser: Command line parser that contains the options.
215 @param ssp_url: url of the staged server-side package.
220 'Failed to stage server-side package')
221 raise error.AutoservError('Failed to stage server-side package')
225 control = (parser.args[0] if len(parser.args) > 0 and parser.args[0] != ''
230 results, control=control,
241 args.remove('--require-ssp')
242 # --parent_job_id is only useful in autoserv running in host, not in
245 if '--parent_job_id' in args:
246 index = args.index('--parent_job_id')
247 args.remove('--parent_job_id')
248 # Remove the actual parent job id in command line arg.
251 # A dictionary of paths to replace in the command line. Key is the path to
254 # Replace the control file path with the one in container.
255 if control:
257 lxc.CONTROL_TEMP_PATH, os.path.basename(control))
258 paths_to_replace[control] = container_control_filename
265 # Apply --use-existing-results, results directory is aready created and
267 if not '--use-existing-results' in args:
268 args.append('--use-existing-results')
271 if not '--pidfile-label' in args:
272 args.extend(['--pidfile-label', 'container_autoserv'])
275 logging.info('Run command in container: %s', cmd_line)
299 For tests running with server-side packaging, the results folder has the
311 utils.run('sudo -n chown -R %s "%s"' % (os.getuid(), results))
312 utils.run('sudo -n chgrp -R %s "%s"' % (os.getgid(), results))
343 cmd_line = utils.run('ps -fp %s' % pid).stdout
344 if ('--board %s' % board in cmd_line and
345 '--port %s' % servo_port in cmd_line):
346 logging.debug('Servod is already running with given board and port.'
364 """Find the control file corresponding to the given control name, on disk.
366 @param control_name: NAME attribute of the control file to fetch.
367 @return: Path to the control file.
375 'Failed to find any control files with NAME %s' % control_name)
377 logging.error('Found more than one control file with NAME %s: %s',
380 'Found more than one control file with NAME %s' % control_name)
385 """Stage the control file to execute from local autotest checkout.
387 @param control_name: Name of the control file to stage.
388 @param results_dir: Results directory to stage the control file into.
389 @return: Absolute path to the staged control file.
402 @param parser: Parser for the command line arguments.
403 @param ssp_url: Url to server-side package.
404 @param use_ssp: Set to True to run with server-side packaging.
432 if use_ssp and results:
467 # faulthandler is only needed to debug in the Lab and is not avaliable to
468 # be imported in the chroot as part of VMTest, so Try-Except it.
517 # can't be both a client and a server side test
518 if client and server:
519 parser.parser.error("Can not specify a test as both server and client!")
521 if provision and client:
522 parser.parser.error("Cannot specify provisioning and client!")
529 # When use_ssp is True, autoserv will be re-executed inside a
530 # container preserving the --control-name argument. Control file
532 control = None
535 control = _stage_control_file(parser.options.control_name,
539 control = parser.options.control_name
543 control = parser.args[0]
546 parser.parser.error("Missing argument: control file")
547 control = None
550 # ssh_verbosity is an integer between 0 and 3, inclusive
551 ssh_verbosity_flag = '-' + 'v' * ssh_verbosity
556 if group_name and len(machines) < 2:
557 parser.parser.error('-G %r may only be supplied with more than one '
571 'control': control,
630 # crbug.com/1054522 -- ts_mon setup is broken inside the SSP container
640 if auto_start_servod and len(machines) == 1:
652 if auto_start_servod and len(machines) == 1:
665 # (SSP) and crashed before correcting folder permission,
671 # permission to run sudo command.
727 """Read the value of REQUIRE_SSP from test control file.
729 This reads the control file from the prod checkout of autotest and uses that
733 [1] Any change in REQUIRE_SSP directive in a test requires a prod-push to go
735 [2] This function may find that the control file does not exist but the SSP
746 sys.stderr.write("autoserv: Could not determine control file path,"
752 control = control_data.parse_control(path)
753 # There must be explicit directive in the control file to disable SSP.
754 if not control or control.require_ssp is None:
756 return control.require_ssp
781 results = 'results.' + time.strftime('%Y-%m-%d-%H.%M.%S')
784 for filename in ('control.srv', 'status.log', '.autoserv_execute'):
787 if not parser.options.use_existing_results and resultdir_exists:
799 # This is currently only used for skylab (i.e., when --control-name is
808 if log_dir and not os.path.exists(log_dir):
822 logging.debug('autoserv command was: %s', ' '.join(sys.argv))
835 if (parser.options.use_existing_results and not resultdir_exists and
840 if parser.options.write_pidfile and results:
874 # an 'abort' and return 1.