diff options
author | 2022-10-20 15:28:01 +0100 | |
---|---|---|
committer | 2022-10-20 18:05:04 +0000 | |
commit | e772458a32ef55e68d15a08d95df2d97fa6ef22a (patch) | |
tree | 6ac7ae1d1ef682f86c7e08a3035985b1cfb4f472 /tools/buildbot-setup-device.sh | |
parent | cf57dee67a87336a7160546fbfd9ee42b8411756 (diff) |
buildbot-setup-device.sh: minor fix getting date from older devices
The output of the date command on older devices can include CRLF and
this otherwise breaks the time comparisons in this script.
Bug: 224733324
Test: manual
Change-Id: I2e0bccceef95abbb8304184c404fedb05052a5cc
Diffstat (limited to 'tools/buildbot-setup-device.sh')
-rwxr-xr-x | tools/buildbot-setup-device.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/buildbot-setup-device.sh b/tools/buildbot-setup-device.sh index 1cad3e3793..decb24735a 100755 --- a/tools/buildbot-setup-device.sh +++ b/tools/buildbot-setup-device.sh @@ -36,7 +36,11 @@ msginfo "Date on device" adb shell date host_seconds_since_epoch=$(date -u +%s) -device_seconds_since_epoch=$(adb shell date -u +%s) + +# Get the device time in seconds, but filter the output as some +# devices emit CRLF at the end of the command which then breaks the +# time comparisons in this script (Hammerhead, MRA59G 2457013). +device_seconds_since_epoch=$(adb shell date -u +%s | tr -c -d '[:digit:]') abs_time_difference_in_seconds=$(expr $host_seconds_since_epoch - $device_seconds_since_epoch) if [ $abs_time_difference_in_seconds -lt 0 ]; then |