Skip to content

Commit

Permalink
catch all exceptions in testing script
Browse files Browse the repository at this point in the history
  • Loading branch information
pd0wm committed Apr 24, 2020
1 parent 6148f26 commit 2ecf054
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions selfdrive/test/eon_testing_slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import re
import time
import json
import base64
import requests
import subprocess
from common.timeout import Timeout
Expand Down Expand Up @@ -40,35 +39,33 @@ def heartbeat():
}

while True:

with open(os.path.join(work_dir, "selfdrive", "common", "version.h")) as _versionf:
version = _versionf.read().split('"')[1]

# subprocess.check_output(["/system/bin/screencap", "-p", "/tmp/screen.png"], cwd=work_dir, env=env)
# screenshot = base64.b64encode(open('/tmp/screen.png').read())
tmux = ""

try:
tmux = os.popen('tail -n 100 /tmp/tmux_out').read()
except:
pass

params = Params()
msg = {
'version': version,
'dongle_id': params.get("DongleId").rstrip().decode('utf8'),
'remote': subprocess.check_output(["git", "config", "--get", "remote.origin.url"], cwd=work_dir).decode('utf8').rstrip(),
'revision': subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=work_dir).decode('utf8').rstrip(),
'serial': subprocess.check_output(["getprop", "ro.boot.serialno"]).decode('utf8').rstrip(),
# 'screenshot': screenshot,
'tmux': tmux,
}

try:
with open(os.path.join(work_dir, "selfdrive", "common", "version.h")) as _versionf:
version = _versionf.read().split('"')[1]

# subprocess.check_output(["/system/bin/screencap", "-p", "/tmp/screen.png"], cwd=work_dir, env=env)
# screenshot = base64.b64encode(open('/tmp/screen.png').read())
tmux = ""

try:
tmux = os.popen('tail -n 100 /tmp/tmux_out').read()
except:
pass

params = Params()
msg = {
'version': version,
'dongle_id': params.get("DongleId").rstrip().decode('utf8'),
'remote': subprocess.check_output(["git", "config", "--get", "remote.origin.url"], cwd=work_dir).decode('utf8').rstrip(),
'revision': subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=work_dir).decode('utf8').rstrip(),
'serial': subprocess.check_output(["getprop", "ro.boot.serialno"]).decode('utf8').rstrip(),
# 'screenshot': screenshot,
'tmux': tmux,
}
with Timeout(10):
requests.post('http://%s/eon/heartbeat/' % MASTER_HOST, json=msg, timeout=5.0)
except:
print("Unable to reach master")
except Exception as e:
print("Unable to send heartbeat", e)

time.sleep(5)

Expand Down

0 comments on commit 2ecf054

Please sign in to comment.