Ejemplo n.º 1
0
        def run():
            for cmd in comp.tc_dropper_reset(nodes["comp5"].links["comp1"]['ifname']):
                print nodes["comp5"].name, "should be comp5"
                nodes["comp5"].run_cmd(cmd)
            for cmd in comp.tc_dropper_reset(nodes["comp1"].links["comp5"]['ifname']):
                nodes["comp1"].run_cmd(cmd)
                print nodes["comp1"].name, "should be comp1"
            # It's safer to restart each time actually...
            comp.run_cmd_on_server(nodes, 'pkill picoquicdemo')
            comp.run_cmd_on_server(nodes, ["sh", "-c", "'cd ~/picoquic; nohup ./picoquicdemo {} {} -p 4443 2>&1 > /tmp/log_server.log'".format(server_logs, plugins)], daemon=True)
            server_ip = SERVER_IP
            # Empty the buffers and let the server start quietly
            time.sleep(0.2)

            client_cmd = 'timeout 120 ~/picoquic/picoquicdemo -4 -G {} {} -l /dev/null {} 4443 2>&1 > /tmp/log_client.log'.format(size, plugins, server_ip)
            err = comp.run_cmd_on_client(nodes, client_cmd)

            if err != 0:
                print("client returned err %d" % err)
                return 0

            # Get the file to access it
            comp.scp_file_from_client(nodes, '/tmp/log_client.log', 'log_client.log')
            log_client = open('log_client.log')
            lines = log_client.readlines()
            elapsed_ms_str = lines[-2].split()[0]
            if (elapsed_ms_str.startswith('-') or "Client exit with code = 0" not in lines[-1]):
                print lines[-1]
                print "Error for this run..."
                # Relaunch the server
                return 0

            print "elapsed: %s milliseconds for %s" % (elapsed_ms_str, test_name)
            return float(elapsed_ms_str)
Ejemplo n.º 2
0
        def run():
            # It's safer to restart each time actually...
            server.run_cmd('pkill picoquicdemo')
            # Get rid of the variability of processes
            server.run_cmd([
                "sh", "-c",
                "'cd ~/picoquic; nohup nice --20 ./picoquicdemo -a 1 {} {} -p 4443 2>&1 > /tmp/log_server.log'"
                .format(server_logs, plugins)
            ],
                           daemon=True)
            server_ip = '42.0.0.1'

            # Empty the buffers and let the server start quietly
            time.sleep(0.2)

            # Get rid of the variability of processes
            client_cmd = 'timeout 60 nice --20 ~/picoquic/picoquicdemo -a 1 -4 -G {} {} -l /dev/null {} 4443 2>&1 > /tmp/log_client.log'.format(
                size, plugins, server_ip)
            err = client.run_cmd(client_cmd)

            if err != 0:
                print("client returned err %d" % err)
                return 0

            # Get the file to access it
            client.scp_file_from_node('/tmp/log_client.log', 'log_client.log')
            server.scp_file_from_node('/tmp/log_server.log', 'log_server.log')
            log_client = open('log_client.log')
            lines = log_client.readlines()
            elapsed_ms_str = lines[-2].split()[0]
            if elapsed_ms_str.startswith('-') or len([
                    1 for line in lines if
                    "Received file /doc-{}.html, after {} bytes, closing stream 4"
                    .format(size, size) in line
            ]) == 0:
                print lines
                print "Error for this run..."
                # Relaunch the server
                return 0

            elf_us = 0
            plugin_us = 0
            total_plugin_us = 0
            for line in lines:
                if "ELF_load" in line:
                    elf_us += int(line.split()[-1])
                elif "Plugin_load" in line:
                    plugin_us += int(line.split()[-1])
                elif "Plugin_insert_plugins_from_fnames" in line:
                    total_plugin_us += int(line.split()[-1])

            print "elapsed: %s milliseconds for %s, elf_us %d, plugin_us %d total_plugin_us %d" % (
                elapsed_ms_str, test_name, elf_us, plugin_us, total_plugin_us)
            return float(elapsed_ms_str), elf_us, plugin_us, total_plugin_us
Ejemplo n.º 3
0
        def run():
            start_time = time.time()
            additional_curl_params = ''
            if test_name == 'sp_vpn':
                additional_curl_params = '--interface {}'.format('128.0.0.2')
            err = comp.run_cmd_on_client(nodes, 'curl {}:8080/random_{} -s --connect-timeout 5 --output /dev/null -w "%{{time_total}}" {} > /tmp/curl.log'.format(
                '128.0.0.1' if test_name == 'sp_vpn' else server_ip, size, additional_curl_params)
            )

            elapsed_ms = (time.time() - start_time) * 1000

            if err != 0:
                print("client returned err %d" % err)
                return 0

                # Get the file to access it
            comp.scp_file_from_client(nodes, '/tmp/curl.log', 'curl.log')
            with open('curl.log') as f:
                lines = f.readlines()
            elapsed_ms = float(lines[-1]) * 1000
            print "elapsed: %f milliseconds for %s" % (elapsed_ms, test_name)
            return elapsed_ms