Commit 4c7bfdce authored by Scott Graham's avatar Scott Graham Committed by Commit Bot

fuchsia: Print out tun/tap config instructions when not detected

Bug: 734230
Change-Id: I721e6db444b685f56d4cc884995cba3cbddf84ba
Reviewed-on: https://chromium-review.googlesource.com/663844
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501420}
parent afeb6eb5
......@@ -342,6 +342,26 @@ def _SymbolizeBacktrace(backtrace, file_mapping):
return map(lambda entry: symbolized[entry['frame_id']], backtrace)
def _EnsureTunTap(dry_run):
"""Make sure the tun/tap device is configured. This cannot be done
automatically because it requires sudo, unfortunately, so we just print out
instructions.
"""
with open(os.devnull, 'w') as nul:
p = subprocess.Popen(
['tunctl', '-b', '-u', os.environ.get('USER'), '-t', 'qemu'],
stdout=subprocess.PIPE, stderr=nul)
output = p.communicate()[0].strip()
if output != 'qemu':
print 'Configuration of tun/tap device required:'
if not os.path.isfile('/usr/sbin/tunctl'):
print 'sudo apt-get install uml-utilities'
print 'sudo tunctl -u $USER -t qemu'
print 'sudo ifconfig qemu up'
return False
return True
def RunFuchsia(bootfs_data, use_device, dry_run, test_launcher_summary_output):
kernel_path = os.path.join(SDK_ROOT, 'kernel', 'magenta.bin')
......@@ -353,6 +373,9 @@ def RunFuchsia(bootfs_data, use_device, dry_run, test_launcher_summary_output):
bootfs_data.bootfs]
return _RunAndCheck(dry_run, bootserver_command)
if not _EnsureTunTap(dry_run):
return 1
qemu_path = os.path.join(SDK_ROOT, 'qemu', 'bin', 'qemu-system-x86_64')
qemu_command = [qemu_path,
'-m', '2048',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment