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/1026569
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#553350}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 67e8c110257594c18d66cbeff3a45321c7081f7e
This commit is contained in:
Ben Pastene 2018-04-24 23:18:16 +00:00 коммит произвёл Commit Bot
Родитель df13be3ea5
Коммит b848556d5e
1 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -81,7 +81,15 @@ def main():
args, unknown_args = parser.parse_known_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.path_to_outdir, args.cros_cache))
@ -122,8 +130,8 @@ def main():
';', 'exit $test_code',
])
print 'Running the following command:'
print ' '.join(cros_run_vm_test_cmd)
logging.info('Running the following command:')
logging.info(' '.join(cros_run_vm_test_cmd))
vm_proc = subprocess.Popen(
cros_run_vm_test_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)