Closed Bug 1516913 Opened 10 months ago Closed 10 months ago

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


(Testing :: Mozbase, defect)

Not set


(firefox66 fixed)

Tracking Status
firefox66 --- fixed


(Reporter: bc, Assigned: bc)




(1 file)

:nbp noticed in bug 1511618 comment 9 that there was an inconsistency in how 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] <>

[2] <>
You can see an example of rc= not at the end of stdout in a test run using the debugging prints:


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)
Pushed by
[mozdevice] _get_exitcode should handle the case in where the exitcode marker is not at EOF, r=jmaher.
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.