Esempio n. 1
0
def start_server(codechecker_cfg, event):
    """Start the CodeChecker server."""
    def start_server_proc(event, server_cmd, checking_env):
        """Target function for starting the CodeChecker server."""
        proc = subprocess.Popen(server_cmd, env=checking_env)

        # Blocking termination until event is set.
        event.wait()

        # If proc is still running, stop it.
        if proc.poll() is None:
            proc.terminate()

    # The server is started in the same folder as the "master" one.
    server_cmd = codechecker.serv_cmd(env.get_workspace(None),
                                      str(codechecker_cfg['viewer_port']),
                                      env.get_postgresql_cfg())

    server_proc = multiprocessing.Process(name='server',
                                          target=start_server_proc,
                                          args=(event, server_cmd,
                                                codechecker_cfg['check_env']))

    server_proc.start()

    # Wait for server to start and connect to database.
    time.sleep(5)
Esempio n. 2
0
def _start_server(codechecker_cfg, test_config, auth=False):
    """Start the CodeChecker server."""
    def start_server_proc(event, server_cmd, checking_env):
        """Target function for starting the CodeChecker server."""

        proc = subprocess.Popen(server_cmd, env=checking_env)

        # Blocking termination until event is set.
        event.wait()

        # If proc is still running, stop it.
        if proc.poll() is None:
            proc.terminate()

    server_cmd = codechecker.serv_cmd(codechecker_cfg, test_config)

    server_proc = multiprocessing.Process(name='server',
                                          target=start_server_proc,
                                          args=(__STOP_SERVER, server_cmd,
                                                codechecker_cfg['check_env']))

    server_proc.start()

    # Wait for server to start and connect to database.
    time.sleep(20)