Esempio n. 1
0
 def __init__(self, build_path, build_ids_path, ports_to_forward,
              target_device, results_directory):
     try:
         self._amber_repo = None
         self._target = None
         target_args = {
             'output_dir': build_path,
             'target_cpu': 'x64',
             'system_log_file': None,
             'cpu_cores': CPU_CORES,
             'require_kvm': True,
             'emu_type': target_device,
             'ram_size_mb': 8192
         }
         if target_device == 'qemu':
             self._target = qemu_target.QemuTarget(**target_args)
         else:
             target_args.update({
                 'enable_graphics': False,
                 'hardware_gpu': False
             })
             self._target = aemu_target.AemuTarget(**target_args)
         self._target.Start()
         self._setup_target(build_path, build_ids_path, ports_to_forward,
                            results_directory)
     except:
         self.cleanup()
         raise
Esempio n. 2
0
 def __init__(self, build_path, ports_to_forward):
     try:
         self._target = None
         self._target = qemu_target.QemuTarget(
             build_path, 'x64', require_kvm=True, ram_size_mb=8192)
         self._target.Start()
         self._setup_target(build_path, ports_to_forward)
     except:
         self.cleanup()
         raise
Esempio n. 3
0
    def setup_test_run(self):
        super(FuchsiaPort, self).setup_test_run()
        try:
            target_args = {
                'out_dir': self._build_path(),
                'system_log_file': None,
                'fuchsia_out_dir': self.get_option('fuchsia_out_dir')
            }
            if self._target_device == 'device':
                additional_args = {
                    'target_cpu': self.get_option('fuchsia_target_cpu'),
                    'ssh_config': self.get_option('fuchsia_ssh_config'),
                    'os_check': 'ignore',
                    'host': self.get_option('fuchsia_host'),
                    'port': self.get_option('fuchsia_port'),
                    'node_name': self.get_option('fuchsia_node_name')
                }
                target_args.update(additional_args)
                target = device_target.DeviceTarget(**target_args)
            else:
                additional_args = {
                    'target_cpu': 'x64',
                    'cpu_cores': CPU_CORES,
                    'require_kvm': True,
                    'ram_size_mb': 8192
                }
                if self._target_device == 'qemu':
                    target_args.update(additional_args)
                    target = qemu_target.QemuTarget(**target_args)
                else:
                    additional_args.update({
                        'enable_graphics': False,
                        'hardware_gpu': False
                    })
                    target_args.update(additional_args)
                    target = aemu_target.AemuTarget(**target_args)
            self._target_host = _TargetHost(self._build_path(),
                                            self.get_build_ids_path(),
                                            self.SERVER_PORTS, target,
                                            self.results_directory())

            if self.get_option('zircon_logging'):
                self._zircon_logger = SubprocessOutputLogger(
                    self._target_host.run_command(['dlog', '-f']), 'Zircon')

            # Save fuchsia_target in _options, so it can be shared with other
            # workers.
            self._options.fuchsia_target = self._target_host

        except fuchsia_target.FuchsiaTargetException as e:
            _log.error('Failed to start qemu: %s.', str(e))
            return exit_codes.NO_DEVICES_EXIT_STATUS
Esempio n. 4
0
 def __init__(self, build_path, ports_to_forward, target_device):
     try:
         self._target = None
         target_args = {
             'output_dir': build_path,
             'target_cpu': 'x64',
             'system_log_file': None,
             'cpu_cores': CPU_CORES,
             'require_kvm': True,
             'emu_type': target_device,
             'ram_size_mb': 8192
         }
         if target_device == 'qemu':
             self._target = qemu_target.QemuTarget(**target_args)
         else:
             self._target = aemu_target.AemuTarget(**target_args)
         self._target.Start()
         self._setup_target(build_path, ports_to_forward)
     except:
         self.cleanup()
         raise
Esempio n. 5
0
import qemu_target
import shutil
import subprocess
import tempfile
import time
import unittest

TEST_PAYLOAD = "Let's get this payload across the finish line!"

tmpdir = tempfile.mkdtemp()

# Register the target with the context manager so that it always gets
# torn down on process exit. Otherwise there might be lingering QEMU instances
# if Python crashes or is interrupted.
with qemu_target.QemuTarget(tmpdir, 'x64') as target:

    class TestQemuTarget(unittest.TestCase):
        @classmethod
        def setUpClass(cls):
            target.Start()

        @classmethod
        def tearDownClass(cls):
            target.Shutdown()
            shutil.rmtree(tmpdir)

        def testCopyBidirectional(self):
            tmp_path = tmpdir + "/payload"
            with open(tmp_path, "w") as tmpfile:
                tmpfile.write(TEST_PAYLOAD)