Skip to content

Commit

Permalink
Fuchsia: use "dm reboot" after executing binaries on hardware.
Browse files Browse the repository at this point in the history
The current code runs "dm poweroff" which now switches off the device.
It adds unnecessary friction for repeated runs, so this CL changes it
to "dm reboot" instead.


Bug: 749242
Change-Id: Ic65e5b222560ede892e2193977c303d097de7a2b
Reviewed-on: https://chromium-review.googlesource.com/734333
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510977}
  • Loading branch information
Kevin Marshall authored and Commit Bot committed Oct 24, 2017
1 parent e6fd8de commit 15bcbbf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build/fuchsia/exe_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main():
args.output_directory,
ReadRuntimeDeps(args.runtime_deps_path, args.output_directory),
args.exe_name, child_args, args.dry_run, args.bootdata,
summary_output=None, power_off=False, target_cpu=args.target_cpu,
summary_output=None, shutdown_machine=False, target_cpu=args.target_cpu,
use_device=args.device)
if not bootfs:
return 2
Expand Down
14 changes: 10 additions & 4 deletions build/fuchsia/runner_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def __init__(self, bootfs_name, symbols_mapping, target_cpu):


def BuildBootfs(output_directory, runtime_deps, bin_name, child_args, dry_run,
bootdata, summary_output, power_off, target_cpu, use_device):
bootdata, summary_output, shutdown_machine, target_cpu,
use_device):
# |runtime_deps| already contains (target, source) pairs for the runtime deps,
# so we can initialize |file_mapping| from it directly.
file_mapping = dict(runtime_deps)
Expand Down Expand Up @@ -233,13 +234,18 @@ def BuildBootfs(output_directory, runtime_deps, bin_name, child_args, dry_run,
autorun_file.write('\n')
autorun_file.write('echo \"%s\"\n' % ALL_DONE_MESSAGE)

if power_off:
if shutdown_machine:
autorun_file.write('echo Sleeping and shutting down...\n')

# A delay is required to give the guest OS or remote device a chance to
# flush its output before it terminates.
autorun_file.write('msleep %d\n' % (8000 if use_device else 3000))
autorun_file.write('dm poweroff\n')
if use_device:
autorun_file.write('msleep 8000\n')
autorun_file.write('dm reboot\n')
else:
autorun_file.write('msleep 3000\n')
autorun_file.write('dm poweroff\n')


autorun_file.flush()
os.chmod(autorun_file.name, 0750)
Expand Down
3 changes: 2 additions & 1 deletion build/fuchsia/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def main():
args.output_directory, runtime_deps, args.exe_name, child_args,
args.dry_run, bootdata=args.bootdata,
summary_output=args.test_launcher_summary_output,
power_off=True, target_cpu=args.target_cpu, use_device=args.device)
shutdown_machine=True, target_cpu=args.target_cpu,
use_device=args.device)
if not bootfs:
return 2

Expand Down

0 comments on commit 15bcbbf

Please sign in to comment.