xpra icon
Bug tracker and wiki

Ticket #795: test_measure_perf.patch

File test_measure_perf.patch, 30.0 KB (added by Nick Centanni, 5 years ago)

Patch to modify test_measure_perf.py to support a separate config class.

  • test_measure_perf.py

     
    2626        raise Exception("command '%s' returned error code %s, out=%s, err=%s" % (cmd, code, out, err))
    2727    return out
    2828
     29def get_config(config_name):
     30    try:
     31        mod = __import__(config_name)
     32    except (ImportError, SyntaxError) as e:
     33        sys.stderr.write("Error loading module %s (%s)\n" % (config_name, e))
     34        return None
     35    return mod.Config()
    2936
    30 #You will probably need to change those:
    31 IP = "127.0.0.1"            #this is your IP
    32 PORT = 10000                #the port to test on
    33 DISPLAY_NO = 10             #the test DISPLAY no to use
     37if (len(sys.argv) > 1):
     38    config_name = sys.argv[1]
     39else:
     40    config_name = 'perf_config_default'
     41config = get_config(config_name)
     42if (config==None):
     43    raise Exception("Could not load config file")
     44
    3445XORG_CONFIG="%s/xorg.conf" % HOME
    35 XORG_LOG = "%s/Xorg.%s.log" % (HOME, DISPLAY_NO)
    36 START_SERVER = True         #if False, you are responsible for starting it
    37                             #and the data will not be available
    38 
    39 SETTLE_TIME = 3             #how long to wait before we start measuring
    40 MEASURE_TIME = 120          #run for N seconds
    41 COLLECT_STATS_TIME = 10     #collect statistics every N seconds
    42 SERVER_SETTLE_TIME = 3      #how long we wait for the server to start
    43 DEFAULT_TEST_COMMAND_SETTLE_TIME = 1    #how long we wait after starting the test command
    44                             #this is the default value, some tests may override this below
    45 
    46 TEST_XPRA = True
    47 TEST_VNC = False            #WARNING: VNC not tested recently, probably needs updating
    48 USE_IPTABLES = False        #this requires iptables to be setup so we can use it for accounting
    49 USE_VIRTUALGL = True        #allows us to run GL games and benchmarks using the GPU
    50 PREVENT_SLEEP = True
     46XORG_LOG = "%s/Xorg.%s.log" % (HOME, config.DISPLAY_NO)
    5147PREVENT_SLEEP_COMMAND = ["xdotool", "keydown", "Shift_L", "keyup", "Shift_L"]
    5248
    53 LIMIT_TESTS = 2
    54 LIMIT_TESTS = 99999         #to limit the total number of tests being run
    55 MAX_ERRORS = 100            #allow this many tests to cause errors before aborting
    56 
    57 #some commands (games especially) may need longer to startup:
    58 TEST_COMMAND_SETTLE_TIME = {}
    59 
    60 NO_SHAPING = (0, 0, 0)
    61 TRICKLE_SHAPING_OPTIONS = [NO_SHAPING]
    62 TRICKLE_SHAPING_OPTIONS = [NO_SHAPING, (1024, 1024, 20)]
    63 TRICKLE_SHAPING_OPTIONS = [(1024, 1024, 20), (128, 32, 40), (0, 0, 0)]
    64 TRICKLE_SHAPING_OPTIONS = [NO_SHAPING, (1024, 256, 20), (1024, 256, 300), (128, 32, 100), (32, 8, 200)]
    65 TRICKLE_SHAPING_OPTIONS = [NO_SHAPING, (1024, 256, 20), (256, 64, 50), (128, 32, 100), (32, 8, 200)]
    66 TRICKLE_SHAPING_OPTIONS = [NO_SHAPING]
    67 
    6849#tools we use:
    6950IPTABLES_CMD = ["sudo", "/usr/sbin/iptables"]
    7051TRICKLE_BIN = "/usr/bin/trickle"
     
    7354XORG_BIN = "/usr/bin/Xorg"
    7455VGLRUN_BIN = "/usr/bin/vglrun"
    7556
    76 #the glx tests:
    77 GLX_SPHERES = ["/usr/bin/glxspheres"]
    78 GLX_GEARS = ["/usr/bin/glxgears", "-geometry", "1240x900"]
    79 GLX_TESTS = [GLX_SPHERES, GLX_GEARS]
    80 
    81 #the plain X11 tests:
    82 X11_PERF = ["/usr/bin/x11perf", "-resize", "-all"]
    83 XTERM_TEST = ["/usr/bin/xterm", "-geometry", "160x60", "-e", "while true; do dmesg; done"]
    84 FAKE_CONSOLE_USER_TEST = ["/usr/bin/xterm", "-geometry", "160x60", "-e", "PYTHONPATH=`pwd` ./tests/xpra/simulate_console_user.py"]
    85 GTKPERF_TEST = "bash -c 'while true; do gtkperf -a; done'"
    86 X11_TESTS = [X11_PERF, FAKE_CONSOLE_USER_TEST, GTKPERF_TEST]
    87 X11_TESTS = [X11_PERF, XTERM_TEST, FAKE_CONSOLE_USER_TEST, GTKPERF_TEST]
    88 
    89 #the screensaver tests:
    90 XSCREENSAVERS_PATH = "/usr/libexec/xscreensaver"
    91 def screensaver(x):
    92     for d in [os.path.join(sys.prefix, "bin"), XSCREENSAVERS_PATH, "/usr/bin", "/usr/local/bin"]:
    93         f = os.path.join(d, x)
    94         if os.path.exists(f) and os.path.isfile(f):
    95             return f
    96     return  None
    97 ALL_SCREENSAVER_TESTS = [screensaver(x) for x in
    98                             ["rss-glx-lattice", "rss-glx-plasma", "deluxe", "eruption", "memscroller", "moebiusgears", "polytopes"]
    99                          ]
    100 SOME_SCREENSAVER_TESTS = [screensaver(x) for x in
    101                             ["memscroller", "eruption", "xmatrix"]
    102                           ]
    103 SOME_SCREENSAVER_TESTS = [screensaver(x) for x in
    104                             ["memscroller", "moebiusgears", "polytopes", "rss-glx-lattice"]
    105                           ]
    106 
    107 #games tests:
    108 #for more info, see here: http://dri.freedesktop.org/wiki/Benchmarking
    109 NEXUIZ_TEST = ["/usr/bin/nexuiz-glx", "-benchmark", "demos/demo1", "-nosound"]
    110 XONOTIC_TEST = ["/opt/Xonotic/xonotic-linux64-glx", "-basedir", "/opt/Xonotic", "-benchmark", "demos/the-big-keybench"]
    111 TEST_COMMAND_SETTLE_TIME[NEXUIZ_TEST[0]] = 10
    112 TEST_COMMAND_SETTLE_TIME[XONOTIC_TEST[0]] = 20
    113 GAMES_TESTS = [NEXUIZ_TEST, XONOTIC_TEST]
    114 
    115 #sound and video tests:
    116 VIDEO_TESTS = []
    117 SOUND_TESTS = []
    118 VLC_BIN = "/usr/bin/vlc"
    119 MPLAYER_BIN = "/usr/bin/mplayer"
    120 
    121 MPLAYER_SOUND_LOOP_TEST = "while true; do %s ./test.mp3; done" % MPLAYER_BIN
    122 VLC_SOUND_TEST = (VLC_BIN, "-L", "--audio-visual=visual", "./test.mp3")
    123 if not os.path.exists("test.mp3"):
    124     print("test.mp3 not found, the corresponding sound mplayer sound and vlc video tests are disabled")
    125 else:
    126     SOUND_TESTS.append(MPLAYER_SOUND_LOOP_TEST)
    127     VIDEO_TESTS.append(VLC_SOUND_TEST)
    128 
    129 #video tests
    130 VLC_VIDEO_TEST = (VLC_BIN, "-L", "./test.avi")
    131 MPLAYER_VIDEO_TEST = "while true; do %s test.avi; done" % MPLAYER_BIN
    132 if not os.path.exists("test.avi"):
    133     print("test.avi not found, vlc and mplayer video tests are disabled")
    134 else:
    135     VIDEO_TESTS.append(VLC_VIDEO_TEST)
    136     VIDEO_TESTS.append(MPLAYER_VIDEO_TEST)
    137 
    138 #our selection:
    139 TEST_CANDIDATES = [screensaver("deluxe")]
    140 TEST_CANDIDATES = X11_TESTS + SOME_SCREENSAVER_TESTS + GAMES_TESTS
    141 TEST_CANDIDATES = GLX_TESTS + X11_TESTS + ALL_SCREENSAVER_TESTS + GAMES_TESTS
    142 TEST_CANDIDATES = GLX_TESTS + X11_TESTS + ALL_SCREENSAVER_TESTS + SOUND_TESTS + VIDEO_TESTS + GAMES_TESTS
    143 
    144 
    14557#now we filter all the test commands and only keep the valid ones:
    14658print("Checking for test commands:")
    14759X11_TEST_COMMANDS = []
    148 for x in TEST_CANDIDATES:
     60for x in config.TEST_CANDIDATES:
    14961    if x is None:
    15062        continue
    15163    if type(x) in (list, tuple) and not os.path.exists(x[0]):
     
    15365    else:
    15466        print("* adding test: %s" % str(x))
    15567        X11_TEST_COMMANDS.append(x)
    156 TEST_NAMES = {GTKPERF_TEST: "gtkperf",
    157               MPLAYER_SOUND_LOOP_TEST : "mplayer sound",
    158               VLC_SOUND_TEST : "vlc sound visual",
    159               MPLAYER_VIDEO_TEST : "mplayer video",
    160               VLC_VIDEO_TEST : "vlc video",
     68TEST_NAMES = {config.GTKPERF_TEST: "gtkperf",
     69              config.MPLAYER_SOUND_LOOP_TEST : "mplayer sound",
     70              config.VLC_SOUND_TEST : "vlc sound visual",
     71              config.MPLAYER_VIDEO_TEST : "mplayer video",
     72              config.VLC_VIDEO_TEST : "vlc video",
    16173              }
    16274
    163 
    16475XVNC_BIN = "/usr/bin/Xvnc"
    165 XVNC_SERVER_START_COMMAND = [XVNC_BIN, "--rfbport=%s" % PORT,
     76XVNC_SERVER_START_COMMAND = [XVNC_BIN, "--rfbport=%s" % config.PORT,
    16677                   "+extension", "GLX",
    16778                   "--SecurityTypes=None",
    16879                   "--SendCutText=0", "--AcceptCutText=0", "--AcceptPointerEvents=0", "--AcceptKeyEvents=0",
    16980                   "-screen", "0", "1240x900x24",
    170                    ":%s" % DISPLAY_NO]
     81                   ":%s" % config.DISPLAY_NO]
    17182XVNC_SERVER_STOP_COMMANDS = [["killall Xvnc"]]     #stopped via kill - beware, this will kill *all* Xvnc sessions!
    17283VNCVIEWER_BIN = "/usr/bin/vncviewer"
    173 VNC_ENCODINGS = ["Tight", "ZRLE", "hextile", "raw", "auto"]
     84
     85#VNC_ENCODINGS = ["Tight", "ZRLE", "hextile", "raw", "auto"]
    17486VNC_ENCODINGS = ["auto"]
    175 VNC_ZLIB_OPTIONS = [-1, 3, 6, 9]
     87#VNC_ZLIB_OPTIONS = [-1, 3, 6, 9]
    17688VNC_ZLIB_OPTIONS = [-1, 9]
    177 VNC_COMPRESSION_OPTIONS = [0, 3, 8, 9]
     89#VNC_COMPRESSION_OPTIONS = [0, 3, 8, 9]
    17890VNC_COMPRESSION_OPTIONS = [0, 3]
    179 VNC_JPEG_OPTIONS = [-1, 0, 8]
     91#VNC_JPEG_OPTIONS = [-1, 0, 8]
    18092VNC_JPEG_OPTIONS = [-1, 4]
    18193
    182 
    183 
    18494XPRA_BIN = "/usr/bin/xpra"
    18595XPRA_VERSION_OUTPUT = getoutput([XPRA_BIN, "--version"])
    18696XPRA_VERSION = ""
     
    18999        XPRA_VERSION = x[len("xpra v"):].replace("\n", "").replace("\r", "")
    190100XPRA_VERSION_NO = [int(x) for x in XPRA_VERSION.split(".")]
    191101XPRA_SERVER_STOP_COMMANDS = [
    192                              [XPRA_BIN, "stop", ":%s" % DISPLAY_NO],
    193                              "ps -ef | grep -i [X]org-for-Xpra-:%s | awk '{print $2}' | xargs kill" % DISPLAY_NO
     102                             [XPRA_BIN, "stop", ":%s" % config.DISPLAY_NO],
     103                             "ps -ef | grep -i [X]org-for-Xpra-:%s | awk '{print $2}' | xargs kill" % config.DISPLAY_NO
    194104                             ]
    195 XPRA_INFO_COMMAND = [XPRA_BIN, "info", "tcp:%s:%s" % (IP, PORT)]
    196 XPRA_FORCE_XDUMMY = False
    197 XPRA_QUALITY_OPTIONS = [40, 90]
    198 XPRA_QUALITY_OPTIONS = [80]
    199 XPRA_QUALITY_OPTIONS = [10, 40, 80, 90]
    200 XPRA_COMPRESSORS_OPTIONS = ["lz4", "zlib", "lzo", "zlib,lzo", "all", "none"]
    201 XPRA_COMPRESSORS_OPTIONS = ["all"]
    202 XPRA_COMPRESSION_LEVEL_OPTIONS = [0, 3, 9]
    203 XPRA_COMPRESSION_LEVEL_OPTIONS = [0, 3]
    204 XPRA_COMPRESSION_LEVEL_OPTIONS = [None]
    205 XPRA_PACKET_ENCODERS_OPTIONS = ["rencode", "bencode", "yaml"]
    206 XPRA_PACKET_ENCODERS_OPTIONS = ["rencode"]
    207 XPRA_CONNECT_OPTIONS = [("ssh", None), ("tcp", None), ("unix", None)]
    208 XPRA_CONNECT_OPTIONS = [("tcp", None)]
    209 #if XPRA_VERSION_NO>=[0, 7]:
    210 #    XPRA_CONNECT_OPTIONS.append(("tcp", "AES"))
     105XPRA_INFO_COMMAND = [XPRA_BIN, "info", "tcp:%s:%s" % (config.IP, config.PORT)]
    211106print ("XPRA_VERSION_NO=%s" % XPRA_VERSION_NO)
    212 XPRA_TEST_ENCODINGS = ["png", "x264", "mmap"]
    213 XPRA_TEST_ENCODINGS = ["png", "jpeg", "x264", "vpx", "mmap"]
    214 XPRA_TEST_ENCODINGS = ["png", "rgb24", "jpeg", "x264", "vpx", "mmap"]
     107
    215108STRICT_ENCODINGS = False
    216109if STRICT_ENCODINGS:
    217110    #beware: only enable this flag if the version being tested
     
    223116
    224117#webp leaks - don't test it:
    225118#if XPRA_VERSION_NO>=[0, 7]:
    226 #    XPRA_TEST_ENCODINGS.append("webp")
    227 XPRA_ENCODING_QUALITY_OPTIONS = {"jpeg" : XPRA_QUALITY_OPTIONS,
    228                                  "webp" : XPRA_QUALITY_OPTIONS,
    229                                  "x264" : XPRA_QUALITY_OPTIONS+[-1],
    230                                  }
    231 XPRA_ENCODING_QUALITY_OPTIONS = {"jpeg" : [-1],
    232                                  "x264" : [-1],
    233                                  }
    234 XPRA_ENCODING_SPEED_OPTIONS = {
    235                                "rgb24" : [-1, 0, 100],
    236                                }
    237 XPRA_OPENGL_OPTIONS = {"x264" : [True, False],
    238                        "vpx" : [True, False] }
    239 #only test default opengl setting:
    240 XPRA_OPENGL_OPTIONS = {}
    241 XPRA_MDNS = False
     119#    config.XPRA_TEST_ENCODINGS.append("webp")
    242120
    243 
    244121XPRA_SPEAKER_OPTIONS = [None]
    245122XPRA_MICROPHONE_OPTIONS = [None]
    246 TEST_SOUND = False
    247 if TEST_SOUND:
     123if config.TEST_SOUND:
    248124    from xpra.sound.gstreamer_util import CODEC_ORDER, has_codec
    249125    if XPRA_VERSION_NO>=[0, 9]:
    250126        #0.9 onwards supports all codecs defined:
     
    256132        #none before that
    257133        XPRA_SPEAKER_OPTIONS = [None]
    258134
     135if (config.XPRA_USE_PASSWORD):
     136    password_filename = "./test-password.txt"
     137    import uuid
     138    with open(password_filename, 'wb') as f:
     139        f.write(uuid.uuid4().hex)
    259140
    260 XPRA_USE_PASSWORD = True
    261 password_filename = "./test-password.txt"
    262 import uuid
    263 with open(password_filename, 'wb') as f:
    264     f.write(uuid.uuid4().hex)
    265 
    266 
    267141check = [TRICKLE_BIN]
    268 if TEST_XPRA:
     142if config.TEST_XPRA:
    269143    check.append(XPRA_BIN)
    270 if TEST_VNC:
     144if config.TEST_VNC:
    271145    check.append(XVNC_BIN)
    272146    check.append(VNCVIEWER_BIN)
    273147for x in check:
     
    274148    if not os.path.exists(x):
    275149        raise Exception("cannot run tests: %s is missing!" % x)
    276150
    277 
    278 
    279151HEADERS = ["Test Name", "Remoting Tech", "Server Version", "Client Version", "Custom Params", "SVN Version",
    280152           "Encoding", "Quality", "Speed","OpenGL", "Test Command", "Sample Duration (s)", "Sample Time (epoch)",
    281153           "CPU info", "Platform", "Kernel Version", "Xorg version", "OpenGL", "Client Window Manager", "Screen Size",
     
    296168    for x in ("Min", "Avg", "Max"):
    297169        HEADERS.append(x+" "+h)
    298170
    299 
    300171def is_process_alive(process, grace=0):
    301172    i = 0
    302173    while i<grace:
     
    422293    assert process.wait()==0, "failed to run %s" % str(cmd)
    423294
    424295def zero_iptables():
    425     if not USE_IPTABLES:
     296    if not config.USE_IPTABLES:
    426297        return
    427298    cmds = [IPTABLES_CMD+['-Z', 'INPUT'], IPTABLES_CMD+['-Z', 'OUTPUT']]
    428299    for cmd in cmds:
     
    476347    return line
    477348
    478349def parse_ipt(chain, pattern, setup_info):
    479     if not USE_IPTABLES:
     350    if not config.USE_IPTABLES:
    480351        return  0, 0
    481352    line = getiptables_line(chain, pattern, setup_info)
    482353    parts = line.split()
     
    485356        U = 1024
    486357        m = {"K":U, "M":U**2, "G":U**3}.get(part[-1], 1)
    487358        num = "".join([x for x in part if x in "0123456789"])
    488         return int(num)*m/MEASURE_TIME
     359        return int(num)*m/config.MEASURE_TIME
    489360    return parse_num(parts[0]), parse_num(parts[1])
    490361
    491362def get_iptables_INPUT_count():
    492     setup = "iptables -I INPUT -p tcp --dport %s -j ACCEPT" % PORT
    493     return  parse_ipt("INPUT", "tcp dpt:%s" % PORT, setup)
     363    setup = "iptables -I INPUT -p tcp --dport %s -j ACCEPT" % config.PORT
     364    return  parse_ipt("INPUT", "tcp dpt:%s" % config.PORT, setup)
    494365
    495366def get_iptables_OUTPUT_count():
    496     setup = "iptables -I OUTPUT -p tcp --sport %s -j ACCEPT" % PORT
    497     return  parse_ipt("OUTPUT", "tcp spt:%s" % PORT, setup)
     367    setup = "iptables -I OUTPUT -p tcp --sport %s -j ACCEPT" % config.PORT
     368    return  parse_ipt("OUTPUT", "tcp spt:%s" % config.PORT, setup)
    498369
    499370
    500371def measure_client(server_pid, name, cmd, get_stats_cb):
     
    502373    try:
    503374        client_process = subprocess.Popen(cmd)
    504375        #give it time to settle down:
    505         time.sleep(SETTLE_TIME)
     376        time.sleep(config.SETTLE_TIME)
    506377        code = client_process.poll()
    507378        assert code is None, "client failed to start, return code is %s" % code
    508379        #clear counters
     
    515386        #we start measuring
    516387        t = 0
    517388        all_stats = [initial_stats]
    518         while t<MEASURE_TIME:
    519             time.sleep(COLLECT_STATS_TIME)
    520             t += COLLECT_STATS_TIME
     389        while t<config.MEASURE_TIME:
     390            time.sleep(config.COLLECT_STATS_TIME)
     391            t += config.COLLECT_STATS_TIME
    521392
    522393            code = client_process.poll()
    523394            assert code is None, "client crashed, return code is %s" % code
     
    543414        else:
    544415            server_process_data = []
    545416        print("process_data (client/server): %s / %s" % (client_process_data, server_process_data))
    546         print("input/output on tcp port %s: %s / %s packets, %s / %s KBytes" % (PORT, ni, no, isize, osize))
     417        print("input/output on tcp PORT %s: %s / %s packets, %s / %s KBytes" % (config.PORT, ni, no, isize, osize))
    547418        data = {}
    548419        data.update(iptables_stat)
    549420        data.update(stats)
     
    559430            assert code is not None, "failed to stop client!"
    560431
    561432def with_server(start_server_command, stop_server_commands, in_tests, get_stats_cb):
    562     tests = in_tests[:LIMIT_TESTS]
     433    tests = in_tests[:config.LIMIT_TESTS]
    563434    print("going to run %s tests: %s" % (len(tests), [x[0] for x in tests]))
    564435    print("*******************************************")
    565     print("ETA: %s minutes" % int((SERVER_SETTLE_TIME+DEFAULT_TEST_COMMAND_SETTLE_TIME+SETTLE_TIME+MEASURE_TIME+1)*len(tests)/60))
     436    print("ETA: %s minutes" % int((config.SERVER_SETTLE_TIME+config.DEFAULT_TEST_COMMAND_SETTLE_TIME+config.SETTLE_TIME+config.MEASURE_TIME+1)*len(tests)/60))
    566437    print("*******************************************")
    567438
    568439    server_process = None
     
    572443    #whitelist what we want to keep:
    573444        if k.startswith("XPRA") or k in ("LOGNAME", "XDG_RUNTIME_DIR", "USER", "HOME", "PATH", "LD_LIBRARY_PATH", "XAUTHORITY", "SHELL", "TERM", "USERNAME", "HOSTNAME", "PWD"):
    574445            env[k] = v
    575     env["DISPLAY"] = ":%s" % DISPLAY_NO
     446    env["DISPLAY"] = ":%s" % config.DISPLAY_NO
    576447    errors = 0
    577448    results = []
    578449    count = 0
     
    581452        try:
    582453            print("**************************************************************")
    583454            count += 1
    584             test_command_settle_time = TEST_COMMAND_SETTLE_TIME.get(test_command[0], DEFAULT_TEST_COMMAND_SETTLE_TIME)
    585             eta = int((SERVER_SETTLE_TIME+test_command_settle_time+SETTLE_TIME+MEASURE_TIME+1)*(len(tests)-count)/60)
     455            test_command_settle_time = config.TEST_COMMAND_SETTLE_TIME.get(test_command[0], config.DEFAULT_TEST_COMMAND_SETTLE_TIME)
     456            eta = int((config.SERVER_SETTLE_TIME+test_command_settle_time+config.SETTLE_TIME+config.MEASURE_TIME+1)*(len(tests)-count)/60)
    586457            print("%s/%s: %s            ETA=%s minutes" % (count, len(tests), name, eta))
    587458            test_command_process = None
    588459            try:
    589460                clean_sys_state()
    590461                #start the server:
    591                 if START_SERVER:
     462                if config.START_SERVER:
    592463                    print("starting server: %s" % str(start_server_command))
    593464                    server_process = subprocess.Popen(start_server_command, stdin=None)
    594465                    #give it time to settle down:
    595                     t = SERVER_SETTLE_TIME
     466                    t = config.SERVER_SETTLE_TIME
    596467                    if count==1:
    597468                        #first run, give it enough time to cleanup the socket
    598469                        t += 5
     
    605476
    606477                try:
    607478                    #start the test command:
    608                     if USE_VIRTUALGL:
     479                    if config.USE_VIRTUALGL:
    609480                        if type(test_command)==str:
    610481                            cmd = VGLRUN_BIN + " -- "+ test_command
    611482                        elif type(test_command) in (list, tuple):
     
    619490                    shell = type(cmd)==str
    620491                    test_command_process = subprocess.Popen(cmd, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, shell=shell)
    621492
    622                     if PREVENT_SLEEP:
     493                    if config.PREVENT_SLEEP:
    623494                        subprocess.Popen(PREVENT_SLEEP_COMMAND)
    624495
    625496                    time.sleep(test_command_settle_time)
     
    632503                            "Remoting Tech"  : tech_name,
    633504                            "Server Version" : server_version,
    634505                            "Client Version" : client_version,
    635                             "Custom Params"  : " ".join(sys.argv[1:]),
     506                            "Custom Params"  : " ".join(config.CUSTOM_PARAMS),
    636507                            "SVN Version"    : SVN_VERSION,
    637508                            "Encoding"       : encoding,
    638509                            "Quality"        : quality,
     
    639510                            "Speed"          : speed,
    640511                            "OpenGL"         : opengl,
    641512                            "Test Command"   : get_command_name(test_command),
    642                             "Sample Duration (s)"    : MEASURE_TIME,
     513                            "Sample Duration (s)"    : config.MEASURE_TIME,
    643514                            "Sample Time (epoch)"    : time.time(),
    644515                            "CPU info"       : CPU_INFO,
    645516                            "Platform"       : PLATFORM,
     
    662533                    traceback.print_exc()
    663534                    errors += 1
    664535                    print("error during client command run for %s: %s" % (name, e))
    665                     if errors>MAX_ERRORS:
     536                    if errors>config.MAX_ERRORS:
    666537                        print("too many errors, aborting tests")
    667538                        break
    668539            finally:
     
    670541                    print("stopping '%s' with pid=%s" % (test_command, test_command_process.pid))
    671542                    try_to_stop(test_command_process)
    672543                    try_to_kill(test_command_process, 2)
    673                 if START_SERVER:
     544                if config.START_SERVER:
    674545                    try_to_stop(server_process)
    675546                    time.sleep(2)
    676547                    for s in stop_server_commands:
     
    725596    if XPRA_VERSION_NO<[0, 3]:
    726597        return  {}
    727598    info_cmd = XPRA_INFO_COMMAND[:]
    728     if XPRA_USE_PASSWORD:
     599    if config.XPRA_USE_PASSWORD:
    729600        info_cmd.append("--password-file=%s" % password_filename)
    730601    out = getoutput(info_cmd)
    731602    if not out:
     
    753624    initial_output_bytecount   = lookup.get("Application bytes out/s", 0)
    754625    initial_mmap_bytes         = lookup.get("mmap bytes/s", 0)
    755626    data = {
    756             "Application packets in/s"      : (iget(["client.connection.input.packetcount", "input_packetcount"], 0)-initial_input_packetcount)/MEASURE_TIME,
    757             "Application bytes in/s"        : (iget(["client.connection.input.bytecount", "input_bytecount"], 0)-initial_input_bytecount)/MEASURE_TIME,
    758             "Application packets out/s"     : (iget(["client.connection.output.packetcount", "output_packetcount"], 0)-initial_output_packetcount)/MEASURE_TIME,
    759             "Application bytes out/s"       : (iget(["client.connection.output.bytecount", "output_bytecount"], 0)-initial_output_bytecount)/MEASURE_TIME,
    760             "mmap bytes/s"                  : (iget(["client.connection.output.mmap_bytecount", "output_mmap_bytecount"], 0)-initial_mmap_bytes)/MEASURE_TIME,
     627            "Application packets in/s"      : (iget(["client.connection.input.packetcount", "input_packetcount"], 0)-initial_input_packetcount)/config.MEASURE_TIME,
     628            "Application bytes in/s"        : (iget(["client.connection.input.bytecount", "input_bytecount"], 0)-initial_input_bytecount)/config.MEASURE_TIME,
     629            "Application packets out/s"     : (iget(["client.connection.output.packetcount", "output_packetcount"], 0)-initial_output_packetcount)/config.MEASURE_TIME,
     630            "Application bytes out/s"       : (iget(["client.connection.output.bytecount", "output_bytecount"], 0)-initial_output_bytecount)/config.MEASURE_TIME,
     631            "mmap bytes/s"                  : (iget(["client.connection.output.mmap_bytecount", "output_mmap_bytecount"], 0)-initial_mmap_bytes)/config.MEASURE_TIME,
    761632            }
    762633
    763634    #values that are averages or min/max:
     
    840711    return data
    841712
    842713def get_xpra_start_server_command():
    843     cmd = [XPRA_BIN, "--no-daemon", "--bind-tcp=0.0.0.0:%s" % PORT]
    844     if XPRA_FORCE_XDUMMY:
     714    cmd = [XPRA_BIN, "--no-daemon", "--bind-tcp=0.0.0.0:%s" % config.PORT]
     715    if config.XPRA_FORCE_XDUMMY:
    845716        cmd.append("--xvfb=%s -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile %s -config %s" % (XORG_BIN, XORG_LOG, XORG_CONFIG))
    846717    if XPRA_VERSION_NO>=[0, 5]:
    847718        cmd.append("--no-notifications")
    848     if XPRA_USE_PASSWORD:
     719    if config.XPRA_USE_PASSWORD:
    849720        cmd.append("--password-file=%s" % password_filename)
    850721    cmd.append("--no-pulseaudio")
    851     cmd += ["start", ":%s" % DISPLAY_NO]
     722    cmd += ["start", ":%s" % config.DISPLAY_NO]
    852723    return cmd
    853724
    854725def test_xpra():
     
    857728    print("                Xpra tests")
    858729    print("")
    859730    tests = []
    860     for connect_option, encryption in XPRA_CONNECT_OPTIONS:
    861         shaping_options = TRICKLE_SHAPING_OPTIONS
     731    for connect_option, encryption in config.XPRA_CONNECT_OPTIONS:
     732        shaping_options = config.TRICKLE_SHAPING_OPTIONS
    862733        if connect_option=="unix":
    863734            shaping_options = [NO_SHAPING]
    864735        for down,up,latency in shaping_options:
    865736            for x11_test_command in X11_TEST_COMMANDS:
    866                 for encoding in XPRA_TEST_ENCODINGS:
     737                for encoding in config.XPRA_TEST_ENCODINGS:
    867738                    if XPRA_VERSION_NO>=[0, 10]:
    868                         opengl_options = XPRA_OPENGL_OPTIONS.get(encoding, [True])
     739                        opengl_options = config.XPRA_OPENGL_OPTIONS.get(encoding, [True])
    869740                    elif XPRA_VERSION_NO>=[0, 9]:
    870                         opengl_options = XPRA_OPENGL_OPTIONS.get(encoding, [False])
     741                        opengl_options = config.XPRA_OPENGL_OPTIONS.get(encoding, [False])
    871742                    else:
    872743                        opengl_options = [False]
    873744                    for opengl in opengl_options:
    874                         quality_options = XPRA_ENCODING_QUALITY_OPTIONS.get(encoding, [-1])
     745                        quality_options = config.XPRA_ENCODING_QUALITY_OPTIONS.get(encoding, [-1])
    875746                        for quality in quality_options:
    876                             speed_options = XPRA_ENCODING_SPEED_OPTIONS.get(encoding, [-1])
     747                            speed_options = config.XPRA_ENCODING_SPEED_OPTIONS.get(encoding, [-1])
    877748                            for speed in speed_options:
    878749                                for speaker in XPRA_SPEAKER_OPTIONS:
    879750                                    for mic in XPRA_MICROPHONE_OPTIONS:
    880751                                        comp_options = [None]
    881752                                        if XPRA_VERSION_NO>=[0, 13]:
    882                                             comp_options = XPRA_COMPRESSORS_OPTIONS
     753                                            comp_options = config.XPRA_COMPRESSORS_OPTIONS
    883754                                        for comp in comp_options:
    884                                             comp_level_options = XPRA_COMPRESSION_LEVEL_OPTIONS
     755                                            comp_level_options = config.XPRA_COMPRESSION_LEVEL_OPTIONS
    885756                                            for compression in comp_level_options:
    886757                                                packet_encoders_options = [None]
    887758                                                if XPRA_VERSION_NO>=[0, 14]:
    888                                                     packet_encoders_options = XPRA_PACKET_ENCODERS_OPTIONS
     759                                                    packet_encoders_options = config.XPRA_PACKET_ENCODERS_OPTIONS
    889760                                                for packet_encoders in packet_encoders_options:
    890761                                                    cmd = trickle_command(down, up, latency)
    891762                                                    cmd += [XPRA_BIN, "attach"]
    892763                                                    if connect_option=="ssh":
    893                                                         cmd.append("ssh:%s:%s" % (IP, DISPLAY_NO))
     764                                                        cmd.append("ssh:%s:%s" % (config.IP, config.DISPLAY_NO))
    894765                                                    elif connect_option=="tcp":
    895                                                         cmd.append("tcp:%s:%s" % (IP, PORT))
     766                                                        cmd.append("tcp:%s:%s" % (config.IP, config.PORT))
    896767                                                    else:
    897                                                         cmd.append(":%s" % (DISPLAY_NO))
     768                                                        cmd.append(":%s" % (config.DISPLAY_NO))
    898769                                                    cmd.append("--readonly")
    899                                                     if XPRA_USE_PASSWORD:
     770                                                    if config.XPRA_USE_PASSWORD:
    900771                                                        cmd.append("--password-file=%s" % password_filename)
    901772                                                    if packet_encoders:
    902773                                                        cmd += ["--packet-encoders=%s" % packet_encoders]
     
    912783                                                        cmd.append("--no-cursors")
    913784                                                        cmd.append("--no-notifications")
    914785                                                    if XPRA_VERSION_NO>=[0, 12]:
    915                                                         if XPRA_MDNS:
     786                                                        if config.XPRA_MDNS:
    916787                                                            cmd.append("--mdns")
    917788                                                        else:
    918789                                                            cmd.append("--no-mdns")
     
    996867        #we first need to figure out the dimensions of the client window
    997868        #within the Xvnc server, the use those dimensions to tell tcbench
    998869        #where to look in the vncviewer client window
    999         test_window_info = get_x11_client_window_info(":%s" % DISPLAY_NO)
     870        test_window_info = get_x11_client_window_info(":%s" % config.DISPLAY_NO)
    1000871        print("info for client test window: %s" % str(test_window_info))
    1001872        info = get_x11_client_window_info(None, "TigerVNC: x11", "Vncviewer")
    1002873        if not info:
     
    1007878            return  {}
    1008879        if test_window_info:
    1009880            _, _, _, w, h = test_window_info
    1010         command = [TCBENCH, "-wh%s" % wid, "-t%s" % (MEASURE_TIME-5)]
     881        command = [TCBENCH, "-wh%s" % wid, "-t%s" % (config.MEASURE_TIME-5)]
    1011882        if w>0 and h>0:
    1012883            command.append("-x%s" % int(w/2))
    1013884            command.append("-y%s" % int(h/2))
     
    1053924    print("                VNC tests")
    1054925    print("")
    1055926    tests = []
    1056     for down,up,latency in TRICKLE_SHAPING_OPTIONS:
     927    for down,up,latency in config.TRICKLE_SHAPING_OPTIONS:
    1057928        for x11_test_command in X11_TEST_COMMANDS:
    1058929            for encoding in VNC_ENCODINGS:
    1059930                for zlib in VNC_ZLIB_OPTIONS:
     
    1063934                            jpeg_quality = VNC_JPEG_OPTIONS
    1064935                        for jpegq in jpeg_quality:
    1065936                            cmd = trickle_command(down, up, latency)
    1066                             cmd += [VNCVIEWER_BIN, "%s::%s" % (IP, PORT),
     937                            cmd += [VNCVIEWER_BIN, "%s::%s" % (config.IP, config.PORT),
    1067938                                   "--ViewOnly",
    1068939                                   "--ZlibLevel=%s" % str(zlib),
    1069940                                   "--CompressLevel=%s" % str(compression),
     
    1100971    get_iptables_OUTPUT_count()
    1101972
    1102973    xpra_results = []
    1103     if TEST_XPRA:
     974    if config.TEST_XPRA:
    1104975        xpra_results = test_xpra()
    1105976    vnc_results = []
    1106     if TEST_VNC:
     977    if config.TEST_VNC:
    1107978        vnc_results = test_vnc()
    1108979    print("*"*80)
    1109980    print("RESULTS:")