Closed Bug 1516913 Opened 6 years ago Closed 6 years ago

[mozdevice] _get_exitcode should handle the case in where the exitcode marker is not at EOF

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(firefox66 fixed)

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: bc, Assigned: bc)

References

Details

Attachments

(1 file)

:nbp noticed in bug 1511618 comment 9 that there was an inconsistency in how adb.py was detecting the exitcode of executed shell commands on the device. As you may recall, shell [1] appends echo rc=$? to the end of shell commands. _get_exitcode [2] the uses this sentinel to detect the exitcode of the shell command by matching the pattern rc=([0-9]+) at the end of stdout. This is necessary since adb shell does not provide us with that information. I added some "printf" style debugging statements and found that the rc=\d sentinal was not always found at the end of the stdout from executing a shell command. This causes intermittent failures in the jit-tests or any tests which expect a command to return a non-zero exit code. [1] <https://searchfox.org/mozilla-central/source/testing/mozbase/mozdevice/mozdevice/adb.py#1311> [2] <https://searchfox.org/mozilla-central/source/testing/mozbase/mozdevice/mozdevice/adb.py#856>
Attached patch adb-command-returncode.patch (deleted) — Splinter Review
You can see an example of rc= not at the end of stdout in a test run using the debugging prints: <https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=219138344&repo=try&lineNumber=11230> This patch adds a fall back in the event that _get_exitcode does not find rc=([0-9]+) at the end of stdout to search the entirety of stdout for the pattern. Since there is a higher likelihood of finding an inappropriate match to the simple pattern rc=([0-9]+) somewhere, I've changed the sentinel to adb_returncode=([0-9]+) which should prevent accidental matches.
Attachment #9033712 - Flags: review?(jmaher)
Attachment #9033712 - Flags: review?(jmaher) → review+
Pushed by bclary@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/8d7092d3884f [mozdevice] _get_exitcode should handle the case in where the exitcode marker is not at EOF, r=jmaher.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: