Skip to content

Commit

Permalink
fuchsia: Print out tun/tap config instructions when not detected
Browse files Browse the repository at this point in the history
Bug: 734230
Change-Id: I721e6db444b685f56d4cc884995cba3cbddf84ba
Reviewed-on: https://chromium-review.googlesource.com/663844
Commit-Queue: Scott Graham <[email protected]>
Reviewed-by: Sergey Ulanov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#501420}
  • Loading branch information
sgraham authored and Commit Bot committed Sep 12, 2017
1 parent afeb6eb commit 4c7bfdc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions build/fuchsia/runner_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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',
Expand Down

0 comments on commit 4c7bfdc

Please sign in to comment.