xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #1655: config_xvfb.py

File config_xvfb.py, 12.0 KB (added by J. Max Mena, 4 years ago)

My config file

Line 
1#!/usr/bin/env python
2import sys
3import os.path
4
5HOME = os.path.expanduser("~/")
6
7#the glx tests:
8GLX_SPHERES = ["/usr/bin/glxspheres64"]
9GLX_GEARS = ["/usr/bin/glxgears", "-geometry", "1240x900"]
10
11#the plain X11 tests:
12X11_PERF = ["/usr/bin/x11perf", "-resize", "-all"]
13XTERM_TEST = ["/usr/bin/xterm", "-geometry", "160x60", "-e", "while true; do dmesg; done"]
14FAKE_CONSOLE_USER_TEST = ["/usr/bin/xterm", "-geometry", "160x60", "-e", "PYTHONPATH=`pwd` ./tests/xpra/test_apps/simulate_console_user.py"]
15
16#the screensaver tests:
17XSCREENSAVERS_PATH = "/usr/libexec/xscreensaver"
18
19#games
20NEXUIZ_TEST = ["/usr/bin/nexuiz-glx", "-benchmark", "demos/demo1", "-nosound"]
21XONOTIC_TEST = ["/usr/bin/xonotic-glx", "-benchmark", "demos/the-big-keybench"]
22
23VLC_BIN = "/usr/bin/vlc"
24MPLAYER_BIN = "/usr/bin/mplayer"
25GTKPERF_TEST = "bash -c 'while true; do gtkperf -a; done'"
26MPLAYER_SOUND_LOOP_TEST = "%s -loop 0 ./test.mp3" % MPLAYER_BIN
27VLC_SOUND_TEST = (VLC_BIN, "-L", "--audio-visual=visual", "./test.mp3")
28VLC_VIDEO_TEST = (VLC_BIN, "-L", "./test.avi")
29MPLAYER_VIDEO_TEST = "%s -loop 0 ./test.avi" % MPLAYER_BIN
30
31#ugly code duplicated from setup.py!
32def get_xorg_bin():
33    # Detect Xorg Binary
34    if os.path.exists("/usr/libexec/Xorg.bin"):
35        #fedora 21?
36        return "/usr/libexec/Xorg.bin"
37    elif os.path.exists("/usr/libexec/Xorg"):
38        #fedora 22
39        return "/usr/libexec/Xorg"
40    else:
41        #look for it in $PATH:
42        for x in os.environ.get("PATH").split(os.pathsep):
43            xorg = os.path.join(x, "Xorg")
44            if os.path.isfile(xorg):
45                return xorg
46    return None
47
48class Config():
49    def __init__(self):
50        def screensaver(x):
51            for d in [os.path.join(sys.prefix, "bin"), XSCREENSAVERS_PATH, "/usr/bin", "/usr/local/bin"]:
52                f = os.path.join(d, x)
53                if os.path.exists(f) and os.path.isfile(f):
54                    return f
55            return  None
56
57        ALL_SCREENSAVER_TESTS = [screensaver(x) for x in ["rss-glx-lattice", "rss-glx-plasma", "deluxe", "eruption", "memscroller", "moebiusgears", "polytopes"]]
58        #SOME_SCREENSAVER_TESTS = [screensaver(x) for x in ["memscroller", "eruption", "xmatrix"]]
59        SOME_SCREENSAVER_TESTS = [screensaver(x) for x in ["memscroller", "moebiusgears", "polytopes", "rss-glx-lattice"]]
60
61        #our selection:
62        self.TEST_CANDIDATES = [screensaver("deluxe")]
63        self.TEST_CANDIDATES = self.X11_TESTS + SOME_SCREENSAVER_TESTS + self.GAMES_TESTS
64        self.TEST_CANDIDATES = self.GLX_TESTS + self.X11_TESTS + ALL_SCREENSAVER_TESTS + self.GAMES_TESTS
65        self.TEST_CANDIDATES = self.X11_TESTS + ALL_SCREENSAVER_TESTS + self.SOUND_TESTS + self.VIDEO_TESTS 
66
67        #now we filter all the test commands and only keep the valid ones:
68        print("Checking for test commands:")
69        self.X11_TEST_COMMANDS = []
70        for x in self.TEST_CANDIDATES:
71            if x is None:
72                continue
73            if type(x) in (list, tuple) and not os.path.exists(x[0]):
74                print("* WARNING: cannot find %s - removed from tests" % str(x))
75            else:
76                print("* adding test: %s" % str(x))
77                self.X11_TEST_COMMANDS.append(x)
78
79    CUSTOM_PARAMS = ""
80    TEST_CANDIDATES = []
81    X11_TEST_COMMANDS = []
82
83    IP = "127.0.0.1"            #this is your IP
84    PORT = 10000                #the port to test on
85    DISPLAY_NO = 10             #the test DISPLAY no to use
86    START_SERVER = True         #if False, you are responsible for starting it
87                                #and the data will not be available
88
89    #tools we use:
90    IPTABLES_CMD = ["sudo", "/usr/sbin/iptables"]
91    TRICKLE_BIN = "/usr/bin/trickle"
92    TCBENCH = "/opt/VirtualGL/bin/tcbench"
93    TCBENCH_LOG = "./tcbench.log"
94    XORG_BIN = get_xorg_bin()
95    VGLRUN_BIN = "/usr/bin/vglrun"
96
97    XORG_CONFIG = "%s/xorg.conf" % HOME
98    XORG_LOG = "%s/Xorg.%s.log" % (HOME, DISPLAY_NO)
99    PREVENT_SLEEP_COMMAND = ["xdotool", "keydown", "Shift_L", "keyup", "Shift_L"]
100
101    SETTLE_TIME = 3             #how long to wait before we start measuring
102    MEASURE_TIME = 120          #run for N seconds
103    COLLECT_STATS_TIME = 10     #collect statistics every N seconds
104    SERVER_SETTLE_TIME = 20      #how long we wait for the server to start
105    DEFAULT_TEST_COMMAND_SETTLE_TIME = 1    #how long we wait after starting the test command
106                                            #this is the default value, some tests may override this below
107
108    TEST_XPRA = True
109    TEST_VNC = False            #WARNING: VNC not tested recently, probably needs updating
110    USE_IPTABLES = False        #this requires iptables to be setup so we can use it for accounting
111    USE_VIRTUALGL = False #allows us to run GL games and benchmarks using the GPU
112    PREVENT_SLEEP = True
113
114    STARTING_TEST = 0           #the index of the first test to run
115    LIMIT_TESTS = 999           #the limit of tests to be run
116    MAX_ERRORS = 100            #allow this many tests to cause errors before aborting
117    XPRA_USE_PASSWORD = True
118
119    NO_SHAPING = (0, 0, 0)
120    #TRICKLE_SHAPING_OPTIONS = [NO_SHAPING]
121    #TRICKLE_SHAPING_OPTIONS = [NO_SHAPING, (1024, 1024, 20)]
122    #TRICKLE_SHAPING_OPTIONS = [(1024, 1024, 20), (128, 32, 40), (0, 0, 0)]
123    #TRICKLE_SHAPING_OPTIONS = [NO_SHAPING, (1024, 256, 20), (1024, 256, 300), (128, 32, 100), (32, 8, 200)]
124    #TRICKLE_SHAPING_OPTIONS = [NO_SHAPING, (1024, 256, 20), (256, 64, 50), (128, 32, 100), (32, 8, 200)]
125    TRICKLE_SHAPING_OPTIONS = [NO_SHAPING]
126
127    GLX_TESTS = [GLX_SPHERES, GLX_GEARS]
128
129    #X11_TESTS = [X11_PERF, FAKE_CONSOLE_USER_TEST, GTKPERF_TEST]
130    X11_TESTS = [X11_PERF, XTERM_TEST, FAKE_CONSOLE_USER_TEST ]
131
132    #some commands (games especially) may need longer to startup:
133    TEST_COMMAND_SETTLE_TIME = {}
134
135    #games tests:
136    #for more info, see here: http://dri.freedesktop.org/wiki/Benchmarking
137    TEST_COMMAND_SETTLE_TIME[NEXUIZ_TEST[0]] = 10
138    TEST_COMMAND_SETTLE_TIME[XONOTIC_TEST[0]] = 20
139    GAMES_TESTS = [NEXUIZ_TEST, XONOTIC_TEST]
140
141    #sound tests
142    VIDEO_TESTS = []
143    SOUND_TESTS = []
144    if not os.path.exists("test.mp3"):
145        print("test.mp3 not found, the corresponding sound mplayer sound and vlc video tests are disabled")
146    else:
147        SOUND_TESTS.append(MPLAYER_SOUND_LOOP_TEST)
148        VIDEO_TESTS.append(VLC_SOUND_TEST)
149
150    #video tests
151    if not os.path.exists("test.avi"):
152        print("test.avi not found, vlc and mplayer video tests are disabled")
153    else:
154        VIDEO_TESTS.append(VLC_VIDEO_TEST)
155        VIDEO_TESTS.append(MPLAYER_VIDEO_TEST)
156
157    XPRA_FORCE_XDUMMY = False
158
159    #XPRA_QUALITY_OPTIONS = [40, 90]
160    #XPRA_QUALITY_OPTIONS = [80]
161    XPRA_QUALITY_OPTIONS = [10, 40, 80, 90]
162
163    #XPRA_COMPRESSORS_OPTIONS = ["lz4", "zlib", "lzo", "zlib,lzo", "all", "none"]
164    XPRA_COMPRESSORS_OPTIONS = ["all"]
165
166    #XPRA_COMPRESSION_LEVEL_OPTIONS = [0, 3, 9]
167    #XPRA_COMPRESSION_LEVEL_OPTIONS = [0, 3]
168    XPRA_COMPRESSION_LEVEL_OPTIONS = [None]
169
170    #XPRA_PACKET_ENCODERS_OPTIONS = ["rencode", "bencode", "yaml"]
171    XPRA_PACKET_ENCODERS_OPTIONS = ["rencode"]
172
173    #XPRA_CONNECT_OPTIONS = [("ssh", None), ("tcp", None), ("unix-domain", None)]
174    XPRA_CONNECT_OPTIONS = [("tcp", None)]
175    #if XPRA_VERSION_NO>=[0, 7]:
176    #    XPRA_CONNECT_OPTIONS.append(("tcp", "AES"))
177
178    #XPRA_TEST_ENCODINGS = ["png", "x264", "mmap"]
179    #XPRA_TEST_ENCODINGS = ["png", "jpeg", "x264", "vpx", "mmap"]
180    XPRA_TEST_ENCODINGS = ["png", "rgb", "jpeg", "h264", "vp8", "vp9", "mmap"]
181
182    #XPRA_ENCODING_QUALITY_OPTIONS = {"jpeg" : XPRA_QUALITY_OPTIONS,
183    #    "x264" : XPRA_QUALITY_OPTIONS+[-1]}
184    XPRA_ENCODING_QUALITY_OPTIONS = {"jpeg" : [-1], "x264" : [-1]}
185
186    XPRA_ENCODING_SPEED_OPTIONS = {"rgb24" : [-1, 0, 100]}
187
188    #XPRA_OPENGL_OPTIONS = {"x264" : [True, False],
189    #    "vpx" : [True, False]}
190    #only test default opengl setting:
191    XPRA_OPENGL_OPTIONS = {}
192
193    XPRA_MDNS = False
194    TEST_SOUND = False
195
196    TEST_NAMES = {GTKPERF_TEST: "gtkperf",
197                  MPLAYER_SOUND_LOOP_TEST : "mplayer sound",
198                  VLC_SOUND_TEST : "vlc sound visual",
199                  MPLAYER_VIDEO_TEST : "mplayer video",
200                  VLC_VIDEO_TEST : "vlc video",
201                  }
202
203    XVNC_BIN = "/usr/bin/Xvnc"
204    XVNC_SERVER_START_COMMAND = [XVNC_BIN, "--rfbport=%s" % PORT,
205                   "+extension", "GLX",
206                   "--SecurityTypes=None",
207                   "--SendCutText=0", "--AcceptCutText=0", "--AcceptPointerEvents=0", "--AcceptKeyEvents=0",
208                   "-screen", "0", "1240x900x24",
209                   ":%s" % DISPLAY_NO]
210    XVNC_SERVER_STOP_COMMANDS = [["killall Xvnc"]]     #stopped via kill - beware, this will kill *all* Xvnc sessions!
211    VNCVIEWER_BIN = "/usr/bin/vncviewer"
212
213    #VNC_ENCODINGS = ["Tight", "ZRLE", "hextile", "raw", "auto"]
214    VNC_ENCODINGS = ["auto"]
215    #VNC_ZLIB_OPTIONS = [-1, 3, 6, 9]
216    VNC_ZLIB_OPTIONS = [-1, 9]
217    #VNC_COMPRESSION_OPTIONS = [0, 3, 8, 9]
218    VNC_COMPRESSION_OPTIONS = [0, 3]
219    #VNC_JPEG_OPTIONS = [-1, 0, 8]
220    VNC_JPEG_OPTIONS = [-1, 4]
221
222    def print_options(self):
223        print("\nCurrent Settings:")
224        print("-"*80)
225        print("CUSTOM_PARAMS: %s" % self.CUSTOM_PARAMS)
226        print("GLX_TESTS: %s" % self.GLX_TESTS)
227        print("X11_TESTS: %s" % self.X11_TESTS)
228        print("GAMES_TESTS: %s" % self.GAMES_TESTS)
229        print("VIDEO_TESTS %s" % self.VIDEO_TESTS)
230        print("SOUND_TESTS %s" % self.SOUND_TESTS)
231        print("TEST_NAMES: %s" % self.TEST_NAMES)
232        print("TEST_CANDIDATES: %s" % self.TEST_CANDIDATES)
233        print("X11_TEST_COMMANDS: %s" % self.X11_TEST_COMMANDS)
234        print("TEST_COMMAND_SETTLE_TIME: %s" % self.TEST_COMMAND_SETTLE_TIME)
235        print("IP: %s" % self.IP)
236        print("PORT: %s" % self.PORT)
237        print("DISPLAY_NO: %s" % self.DISPLAY_NO)
238        print("START_SERVER: %s" % self.START_SERVER)
239        print("SETTLE_TIME: %s" % self.SETTLE_TIME)
240        print("MEASURE_TIME: %s" % self.MEASURE_TIME)
241        print("COLLECT_STATS_TIME: %s" % self.COLLECT_STATS_TIME)
242        print("SERVER_SETTLE_TIME: %s" % self.SERVER_SETTLE_TIME)
243        print("DEFAULT_TEST_COMMAND_SETTLE_TIME: %s" % self.DEFAULT_TEST_COMMAND_SETTLE_TIME)
244        print("TEST_XPRA: %s" % self.TEST_XPRA)
245        print("TEST_VNC: %s" % self.TEST_VNC)
246        print("USE_IPTABLES: %s" % self.USE_IPTABLES)
247        print("USE_VIRTUALGL: %s" % self.USE_VIRTUALGL)
248        print("PREVENT_SLEEP: %s" % self.PREVENT_SLEEP)
249        print("LIMIT_TESTS: %s" % self.LIMIT_TESTS)
250        print("MAX_ERRORS: %s" % self.MAX_ERRORS)
251        print("NO_SHAPING: %s" % str(self.NO_SHAPING))
252        print("TRICKLE_SHAPING_OPTIONS: %s" % self.TRICKLE_SHAPING_OPTIONS)
253        print("XPRA_USE_PASSWORD: %s" % self.XPRA_USE_PASSWORD)
254        print("XPRA_FORCE_XDUMMY: %s" % self.XPRA_FORCE_XDUMMY)
255        print("XPRA_QUALITY_OPTIONS: %s" % self.XPRA_QUALITY_OPTIONS)
256        print("XPRA_COMPRESSORS_OPTIONS: %s" % self.XPRA_COMPRESSORS_OPTIONS)
257        print("XPRA_COMPRESSION_LEVEL_OPTIONS: %s" % self.XPRA_COMPRESSION_LEVEL_OPTIONS)
258        print("XPRA_PACKET_ENCODERS_OPTIONS: %s" % self.XPRA_PACKET_ENCODERS_OPTIONS)
259        print("XPRA_CONNECT_OPTIONS: %s" % self.XPRA_CONNECT_OPTIONS)
260        print("XPRA_TEST_ENCODINGS: %s" % self.XPRA_TEST_ENCODINGS)
261        print("XPRA_ENCODING_QUALITY_OPTIONS: %s" % self.XPRA_ENCODING_QUALITY_OPTIONS)
262        print("XPRA_ENCODING_SPEED_OPTIONS: %s" % str(self.XPRA_ENCODING_SPEED_OPTIONS))
263        print("XPRA_OPENGL_OPTIONS: %s" % self.XPRA_OPENGL_OPTIONS)
264        print("XPRA_MDNS: %s" % self.XPRA_MDNS)
265        print("TEST_SOUND: %s" % self.TEST_SOUND)
266        print("XVNC_BIN: %s" % self.XVNC_BIN)
267        print("XVNC_SERVER_START_COMMAND: %s" % self.XVNC_SERVER_START_COMMAND)
268        print("XVNC_SERVER_STOP_COMMANDS: %s" % self.XVNC_SERVER_STOP_COMMANDS)
269        print("VNCVIEWER_BIN: %s" % self.VNCVIEWER_BIN)
270        print("VNC_ENCODINGS: %s" % self.VNC_ENCODINGS)
271        print("VNC_ZLIB_OPTIONS: %s" % self.VNC_ZLIB_OPTIONS)
272        print("VNC_COMPRESSION_OPTIONS: %s" % self.VNC_COMPRESSION_OPTIONS)
273        print("VNC_JPEG_OPTIONS: %s" % self.VNC_JPEG_OPTIONS)
274        print("-"*80)