Merge lp:~fginther/phablet-tools/fix-ptr-python3-import-check into lp:phablet-tools

Proposed by Francis Ginther
Status: Merged
Approved by: Francis Ginther
Approved revision: 282
Merged at revision: 289
Proposed branch: lp:~fginther/phablet-tools/fix-ptr-python3-import-check
Merge into: lp:phablet-tools
Diff against target: 17 lines (+6/-2)
1 file modified
phablet-test-run (+6/-2)
To merge this branch: bzr merge lp:~fginther/phablet-tools/fix-ptr-python3-import-check
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+222391@code.launchpad.net

Commit message

phablet-test-run: check the return code when attempting to import tests with python3 instead of just looking for text output. Log messages generated on import will cause the import check to fail when it should not.

Description of the change

In phablet-test-run, check the return code when attempting to import tests with python3 instead of just looking for text output. Log messages generated on import will cause the import check to fail when it should not.

This was tested with the following:
 - mediaplayer_app (installed from mediaplayer-app-autopilot)
   This falls back to python 2.
 - calendar_app (installed via phablet-click-test-setup)
   This uses python 3.
 - address_book_app (installed from the packages used by https://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1149)
   This uses python 3 with this fix (w/o this fix it incorrectly uses python 2)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Dimitri John Ledkov (xnox) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'phablet-test-run'
2--- phablet-test-run 2014-05-14 13:05:18 +0000
3+++ phablet-test-run 2014-06-06 18:05:17 +0000
4@@ -120,8 +120,12 @@
5
6 # First let's try python3, without python2 path
7 defaultpy="/usr/bin/python3"
8- import_error=$(adb shell "cd /home/phablet/autopilot; $defaultpy -c 'import $TESTSUITE'")
9- if [ -n "$import_error" ]; then
10+ # adb shell always returns 0, so we have to do some hackery to get the
11+ # actual RC from the test
12+ import_error=$(adb shell "cd /home/phablet/autopilot; $defaultpy -c 'import $TESTSUITE'; echo ADB_RC=\$?")
13+ echo $import_error | get_returncode
14+ import_rc=$?
15+ if [ "$import_rc" -ne 0 ]; then
16 defaultpy="PYTHONPATH=/home/phablet/autopilot/legacy-py2:/home/phablet/autopilot /usr/bin/python"
17 fi
18

Subscribers

People subscribed via source and target branches