Lots of cleaning

pull/2217/head
Gregor Kikelj 5 years ago
parent ecebc831b4
commit 24863affda
  1. 2
      selfdrive/locationd/test/ubloxd.py
  2. 3
      selfdrive/locationd/ubloxd_main.cc
  3. 35
      selfdrive/manager.py
  4. 3
      selfdrive/test/process_replay/process_replay.py
  5. 9
      selfdrive/test/process_replay/test_processes.py
  6. 5
      tools/lib/tests/test_caching.py
  7. 2
      tools/replay/unlogger.py

@ -272,7 +272,7 @@ def handle_msg(dev, msg, nav_frame_buffer):
except ublox.UBloxError as e:
print(e)
# if dev is not None and dev.dev is not None:
#if dev is not None and dev.dev is not None:
# dev.close()
def main():

@ -12,7 +12,6 @@
#include <math.h>
#include <ctime>
#include <chrono>
#include <iostream>
#include "messaging.hpp"
#include "common/util.h"
@ -42,6 +41,7 @@ int ubloxd_main(poll_ubloxraw_msg_func poll_func, send_gps_event_func send_func)
subscriber->setTimeout(100);
PubMaster pm({"ubloxGnss", "gpsLocationExternal"});
while (!do_exit) {
Message * msg = subscriber->receive();
if (!msg){
@ -53,6 +53,7 @@ int ubloxd_main(poll_ubloxraw_msg_func poll_func, send_gps_event_func send_func)
auto amsg = kj::heapArray<capnp::word>((msg->getSize() / sizeof(capnp::word)) + 1);
memcpy(amsg.begin(), msg->getData(), msg->getSize());
capnp::FlatArrayMessageReader cmsg(amsg);
cereal::Event::Reader event = cmsg.getRoot<cereal::Event>();
auto ubloxRaw = event.getUbloxRaw();

@ -22,7 +22,6 @@ os.environ['BASEDIR'] = BASEDIR
TOTAL_SCONS_NODES = 1005
prebuilt = os.path.exists(os.path.join(BASEDIR, 'prebuilt'))
VALGRIND = os.getenv("VALGRIND") is not None
# Create folders needed for msgq
try:
os.mkdir("/dev/shm")
@ -170,16 +169,16 @@ managed_processes = {
"plannerd": "selfdrive.controls.plannerd",
"radard": "selfdrive.controls.radard",
"dmonitoringd": "selfdrive.monitoring.dmonitoringd",
"ubloxd": ("selfdrive/locationd", ["./ubloxd"]), # 0
"loggerd": ("selfdrive/loggerd", ["./loggerd"]), # 1
"ubloxd": ("selfdrive/locationd", ["./ubloxd"]),
"loggerd": ("selfdrive/loggerd", ["./loggerd"]),
"logmessaged": "selfdrive.logmessaged",
"locationd": "selfdrive.locationd.locationd",
"tombstoned": "selfdrive.tombstoned",
"logcatd": ("selfdrive/logcatd", ["./logcatd"]),
"proclogd": ("selfdrive/proclogd", ["./proclogd"]),
"boardd": ("selfdrive/boardd", ["./boardd"]),
"boardd": ("selfdrive/boardd", ["./boardd"]), # not used directly
"pandad": "selfdrive.pandad",
"ui": ("selfdrive/ui", ["./ui"]), # 2
"ui": ("selfdrive/ui", ["./ui"]),
"calibrationd": "selfdrive.locationd.calibrationd",
"paramsd": "selfdrive.locationd.paramsd",
"camerad": ("selfdrive/camerad", ["./camerad"]),
@ -292,18 +291,6 @@ def nativelauncher(pargs, cwd):
os.chmod(pargs[0], 0o700)
os.execvp(pargs[0], pargs)
def valgrindlauncher(pargs, cwd):
# exec the process
os.chdir(cwd)
# Run valgrind on a process
command = "valgrind --leak-check=full " + pargs[0]
output = os.popen(command)
while True:
s = output.read()
if s == "":
break
# print(s)
def start_managed_process(name):
if name in running or name not in managed_processes:
@ -315,17 +302,9 @@ def start_managed_process(name):
else:
pdir, pargs = proc
cwd = os.path.join(BASEDIR, pdir)
if VALGRIND:
print("\nVALGRIND" * 5)
print(pargs)
print(cwd)
running[name] = Process(name=name, target=valgrindlauncher, args=(pargs, cwd))
else:
cloudlog.info("starting process %s" % name)
print(pargs)
print(cwd)
running[name] = Process(name=name, target=nativelauncher, args=(pargs, cwd))
running[name].start()
cloudlog.info("starting process %s" % name)
running[name] = Process(name=name, target=nativelauncher, args=(pargs, cwd))
running[name].start()
def start_daemon_process(name):
params = Params()

@ -201,7 +201,7 @@ def calibration_rcv_callback(msg, CP, cfg, fsm):
# calibrationd publishes 1 calibrationData every 5 cameraOdometry packets.
# should_recv always true to increment frame
recv_socks = []
frame = fsm.frame + 1 # incrementing hasn't happened yet in SubMaster
frame = fsm.frame + 1 # incrementing hasn't happened yet in SubMaster
if frame == 0 or (msg.which() == 'cameraOdometry' and (frame % 5) == 0):
recv_socks = ["liveCalibration"]
return recv_socks, fsm.frame == 0 or msg.which() == 'cameraOdometry'
@ -288,7 +288,6 @@ CONFIGS = [
]
def replay_process(cfg, lr):
print("Running replay on inputs " + str(cfg) + " " + str(lr))
sub_sockets = [s for _, sub in cfg.pub_sub.items() for s in sub]
pub_sockets = [s for s in cfg.pub_sub.keys() if s != 'can']

@ -18,13 +18,13 @@ segments = [
("GM", "7cc2a8365b4dd8a9|2018-12-02--12-10-44--2"), # GM.ACADIA
("CHRYSLER", "b6849f5cf2c926b1|2020-02-28--07-29-48--13"), # CHRYSLER.PACIFICA
("HYUNDAI", "5b7c365c50084530|2020-04-15--16-13-24--3"), # HYUNDAI.SONATA
# ("CHRYSLER", "b6e1317e1bfbefa6|2020-03-04--13-11-40"), # CHRYSLER.JEEP_CHEROKEE
#("CHRYSLER", "b6e1317e1bfbefa6|2020-03-04--13-11-40"), # CHRYSLER.JEEP_CHEROKEE
("SUBARU", "7873afaf022d36e2|2019-07-03--18-46-44--0"), # SUBARU.IMPREZA
("VOLKSWAGEN", "76b83eb0245de90e|2020-03-05--19-16-05--3"), # VW.GOLF
("NISSAN", "fbbfa6af821552b9|2020-03-03--08-09-43--0"), # NISSAN.XTRAIL
# Enable when port is tested and dascamOnly is no longer set
# ("MAZDA", "32a319f057902bb3|2020-04-27--15-18-58--2"), # MAZDA.CX5
#("MAZDA", "32a319f057902bb3|2020-04-27--15-18-58--2"), # MAZDA.CX5
]
# ford doesn't need to be tested until a full port is done
@ -105,7 +105,6 @@ def format_diff(results, ref_commit):
return diff1, diff2, failed
if __name__ == "__main__":
# os.environ["VALGRIND"] = "1"
parser = argparse.ArgumentParser(description="Regression test to identify changes in a process's output")
@ -141,8 +140,9 @@ if __name__ == "__main__":
tested_cars = set(c.lower() for c, _ in segments)
untested = (set(interface_names) - set(excluded_interfaces)) - tested_cars
assert len(untested) == 0, "Cars missing routes: %s" % (str(untested))
results: Any = {}
for car_brand, segment in segments: # Runs all tests, can focus on inside of the loop :)
for car_brand, segment in segments:
if (cars_whitelisted and car_brand.upper() not in args.whitelist_cars) or \
(not cars_whitelisted and car_brand.upper() in args.blacklist_cars):
continue
@ -152,7 +152,6 @@ if __name__ == "__main__":
results[segment] = {}
rlog_fn = get_segment(segment)
print(rlog_fn)
lr = LogReader(rlog_fn)
for cfg in CONFIGS:

@ -38,6 +38,8 @@ class TestFileDownload(unittest.TestCase):
# Make sure we don't force cache
os.environ["FILEREADER_CACHE"] = "0"
small_file_url = "https://raw.githubusercontent.com/commaai/openpilot/master/SAFETY.md"
# If you want large file to be larger than a chunk
# large_file_url = "https://commadataci.blob.core.windows.net/openpilotci/0375fdf7b1ce594d/2019-06-13--08-32-25/3/fcamera.hevc"
# Load full small file
self.compare_loads(small_file_url)
@ -53,10 +55,7 @@ class TestFileDownload(unittest.TestCase):
self.compare_loads(small_file_url, 100 * i, 100)
def test_large_file(self):
# If you want large file to be larger than a chunk
# large_file_url = "https://commadataci.blob.core.windows.net/openpilotci/0375fdf7b1ce594d/2019-06-13--08-32-25/3/fcamera.hevc"
large_file_url = "https://commadataci.blob.core.windows.net/openpilotci/0375fdf7b1ce594d/2019-06-13--08-32-25/3/qlog.bz2"
# Load the end 100 bytes of both files
file_large = URLFile(large_file_url)
length = file_large.get_length()

@ -90,7 +90,7 @@ class UnloggerWorker(object):
# this assumes the encodeIdx always comes before the frame
self._frame_id_lookup[
msg.encodeIdx.frameId] = msg.encodeIdx.segmentNum, msg.encodeIdx.segmentId
# print "encode", msg.encodeIdx.frameId, len(self._readahead), route_time
#print "encode", msg.encodeIdx.frameId, len(self._readahead), route_time
self._readahead.appendleft((typ, msg, route_time, cookie))
def _send_logs(self, data_socket):

Loading…
Cancel
Save