Commit 67e8c110 authored by Ben Pastene's avatar Ben Pastene Committed by Commit Bot

Add KVM-related checks to chromeos vm test runner.

Mostly for humans. The bots should all have kvm installed and available.

Also use logging instead of print.

Bug: 828607
Change-Id: Ifee1ead435932d6d2752c0a418cd38618a66228e
Reviewed-on: https://chromium-review.googlesource.com/1026569Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553350}
parent 33985cf8
...@@ -81,7 +81,15 @@ def main(): ...@@ -81,7 +81,15 @@ def main():
args, unknown_args = parser.parse_known_args() args, unknown_args = parser.parse_known_args()
if unknown_args: if unknown_args:
print >> sys.stderr, 'Ignoring unknown args: %s' % unknown_args logging.warning('Ignoring unknown args: %s' % unknown_args)
if not os.path.exists('/dev/kvm'):
logging.error('/dev/kvm is missing. Is KVM installed on this machine?')
return 1
elif not os.access('/dev/kvm', os.W_OK):
logging.warning(
'/dev/kvm is not writable as current user. Perhaps you should be root?')
return 1
args.cros_cache = os.path.abspath(os.path.join( args.cros_cache = os.path.abspath(os.path.join(
args.path_to_outdir, args.cros_cache)) args.path_to_outdir, args.cros_cache))
...@@ -122,8 +130,8 @@ def main(): ...@@ -122,8 +130,8 @@ def main():
';', 'exit $test_code', ';', 'exit $test_code',
]) ])
print 'Running the following command:' logging.info('Running the following command:')
print ' '.join(cros_run_vm_test_cmd) logging.info(' '.join(cros_run_vm_test_cmd))
vm_proc = subprocess.Popen( vm_proc = subprocess.Popen(
cros_run_vm_test_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) cros_run_vm_test_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
......
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