devmode-test: check more python versions
We had a bug where /usr/local/bin/python worked but /usr/bin/python
failed. Expand the sanity check to include all the known prefixes.
BUG=chromium:1000719
TEST=`./devinstall_test.py betty ./chromiumos_test_image.bin` passes
Change-Id: I3222b9e49477456473a02d382b8d95e31e584ecf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crostestutils/+/1838655
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/devmode-test/devinstall_test.py b/devmode-test/devinstall_test.py
index 8a9637f..1409273 100755
--- a/devmode-test/devinstall_test.py
+++ b/devmode-test/devinstall_test.py
@@ -143,9 +143,13 @@
'"/usr/bin/dev_install --yes --binhost=%s"' % self.binhost])
logging.info('Verifying that all python versions work on the image.')
- for prog in ('python', 'python2', 'python3'):
- self.device.RunCommand(['sudo', '-u', 'chronos', '--', prog,
- '-c', '"print(\'hello world\')"'])
+ # Symlinks can be tricky, and running python from one place might work
+ # while it fails from another. Test all the prefixes (and $PATH).
+ for prefix in ('/usr/bin', '/usr/local/bin', '/usr/local/usr/bin', ''):
+ for prog in ('python', 'python2', 'python3'):
+ self.device.RunCommand(['sudo', '-u', 'chronos', '--',
+ os.path.join(prefix, prog),
+ '-c', '"print(\'hello world\')"'])
except (cros_build_lib.RunCommandError,
remote_access.SSHConnectionError) as e:
self.devserver.PrintLog()