How to use the mobly.utils.start_standing_subprocess function in mobly

To help you get started, we’ve selected a few mobly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / mobly / mobly / controllers / sniffer_lib / local / local_base.py View on Github external
"Trying to start a sniff while another is still running!")
        capture_dir = os.path.join(self._logger.log_path,
                                   "Sniffer-{}".format(self._interface))
        os.makedirs(capture_dir, exist_ok=True)
        self._capture_file_path = os.path.join(
            capture_dir,
            "capture_{}.pcap".format(logger.get_log_file_timestamp()))

        self._pre_capture_config(override_configs)
        _, self._temp_capture_file_path = tempfile.mkstemp(suffix=".pcap")

        cmd = self._get_command_line(additional_args=additional_args,
                                     duration=duration,
                                     packet_count=packet_count)

        self._process = utils.start_standing_subprocess(cmd)
        return sniffer.ActiveCaptureContext(self, duration)
github google / mobly / mobly / controllers / iperf_server.py View on Github external
Args:
            extra_args: A string representing extra arguments to start iperf
                server with.
            tag: Appended to log file name to identify logs from different
                iperf runs.
        """
        if self.started:
            return
        utils.create_dir(self.log_path)
        if tag:
            tag = tag + ','
        out_file_name = "IPerfServer,{},{}{}.log".format(
            self.port, tag, len(self.log_files))
        full_out_path = os.path.join(self.log_path, out_file_name)
        cmd = '%s %s > %s' % (self.iperf_str, extra_args, full_out_path)
        self.iperf_process = utils.start_standing_subprocess(cmd, shell=True)
        self.log_files.append(full_out_path)
        self.started = True
github google / mobly / mobly / controllers / android_device_lib / services / logcat.py View on Github external
def _start(self):
        """The actual logic of starting logcat."""
        self._enable_logpersist()
        if self._config.output_file_path:
            self._close_logcat_file()
            self.adb_logcat_file_path = self._config.output_file_path
        if not self.adb_logcat_file_path:
            f_name = self._ad.generate_filename(self.OUTPUT_FILE_TYPE,
                                                extension_name='txt')
            logcat_file_path = os.path.join(self._ad.log_path, f_name)
            self.adb_logcat_file_path = logcat_file_path
        utils.create_dir(os.path.dirname(self.adb_logcat_file_path))
        cmd = '"%s" -s %s logcat -v threadtime -T 1 %s >> "%s"' % (
            adb.ADB, self._ad.serial, self._config.logcat_params,
            self.adb_logcat_file_path)
        process = utils.start_standing_subprocess(cmd, shell=True)
        self._adb_logcat_process = process
github google / mobly / mobly / controllers / android_device_lib / snippet_client.py View on Github external
def _do_start_app(self, launch_cmd):
        adb_cmd = [adb.ADB]
        if self._adb.serial:
            adb_cmd += ['-s', self._adb.serial]
        adb_cmd += ['shell', launch_cmd]
        return utils.start_standing_subprocess(adb_cmd, shell=False)