Ejemplo n.º 1
0
  def setUpClass(cls):
    os.environ['SKIP_FW_QUERY'] = "1"
    os.environ['FINGERPRINT'] = "TOYOTA COROLLA TSS2 2019"
    set_params_enabled()

    initial_segments = set(Path(ROOT).iterdir())

    # start manager and run openpilot for a minute
    try:
      manager.build()
      manager.manager_prepare()
      manager_path = os.path.join(BASEDIR, "selfdrive/manager.py")
      proc = subprocess.Popen(["python", manager_path])

      sm = messaging.SubMaster(['carState'])
      with Timeout(150, "controls didn't start"):
        while sm.rcv_frame['carState'] < 0:
          sm.update(1000)

      # make sure we get at least two full segments
      cls.segments = []
      with Timeout(300, "timed out waiting for logs"):
        while len(cls.segments) < 3:
          new_paths = set(Path(ROOT).iterdir()) - initial_segments
          segs = [p for p in new_paths if "--" in str(p)]
          cls.segments = sorted(segs, key=lambda s: int(str(s).rsplit('--')[-1]))
          time.sleep(5)

    finally:
      proc.terminate()
      if proc.wait(60) is None:
        proc.kill()

    cls.lr = list(LogReader(os.path.join(str(cls.segments[1]), "rlog.bz2")))
Ejemplo n.º 2
0
    def test_clean_exit(self):
        manager.manager_prepare()
        for p in ALL_PROCESSES:
            manager.start_managed_process(p)

        time.sleep(10)

        for p in reversed(ALL_PROCESSES):
            exit_code = manager.kill_managed_process(p, retry=False)
            if not EON and (p == 'ui' or p == 'loggerd'):
                # TODO: make Qt UI exit gracefully and fix OMX encoder exiting
                continue

            # TODO: interrupted blocking read exits with 1 in cereal. use a more unique return code
            exit_codes = [0, 1]
            if p in manager.kill_processes:
                exit_codes = [-signal.SIGKILL]
            assert exit_code in exit_codes, f"{p} died with {exit_code}"
Ejemplo n.º 3
0
def test_manager_prepare():
  set_params_enabled()
  manager_init()
  manager_prepare()
Ejemplo n.º 4
0
def test_manager_prepare():
    manager_init()
    manager_prepare()
Ejemplo n.º 5
0
def test_manager_prepare():
    global DID_INIT
    manager_init()
    manager_prepare()
    DID_INIT = True