Skip to content

Commit

Permalink
start fixing the shadow unit tests for win32
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@19414 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 24, 2018
1 parent 2173679 commit 3fa5c5c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 24 deletions.
47 changes: 26 additions & 21 deletions src/unittests/unit/server/mixins/server_mixins_option_test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import time
from collections import OrderedDict

from xpra.os_util import pollwait
from xpra.os_util import pollwait, WIN32
from unit.server_test_util import ServerTestUtil, log


Expand All @@ -32,28 +32,31 @@ class ServerMixinsOptionTestUtil(ServerTestUtil):
@classmethod
def setUpClass(cls):
ServerTestUtil.setUpClass()
cls.default_xpra_args = [
"--systemd-run=no",
"--pulseaudio=no",
"--socket-dirs=/tmp",
"--start=xterm",
]
cls.default_xpra_args = []
if not WIN32:
cls.default_xpra_args = [
"--systemd-run=no",
"--pulseaudio=no",
"--socket-dirs=/tmp",
"--start=xterm",
]
cls.display = None
cls.xvfb = None
cls.client_display = None
cls.client_xvfb = None
if False:
#use a single display for the server that we recycle:
cls.display = cls.find_free_display()
cls.xvfb = cls.start_Xvfb(cls.display)
time.sleep(1)
assert cls.display in cls.find_X11_displays()
log("ServerMixinsOptionTest.setUpClass() server display=%s, xvfb=%s", cls.display, cls.xvfb)
if True:
#display used by the client:
cls.client_display = cls.find_free_display()
cls.client_xvfb = cls.start_Xvfb(cls.client_display)
log("ServerMixinsOptionTest.setUpClass() client display=%s, xvfb=%s", cls.client_display, cls.client_xvfb)
if not WIN32:
if False:
#use a single display for the server that we recycle:
cls.display = cls.find_free_display()
cls.xvfb = cls.start_Xvfb(cls.display)
time.sleep(1)
assert cls.display in cls.find_X11_displays()
log("ServerMixinsOptionTest.setUpClass() server display=%s, xvfb=%s", cls.display, cls.xvfb)
if True:
#display used by the client:
cls.client_display = cls.find_free_display()
cls.client_xvfb = cls.start_Xvfb(cls.client_display)
log("ServerMixinsOptionTest.setUpClass() client display=%s, xvfb=%s", cls.client_display, cls.client_xvfb)


@classmethod
Expand All @@ -68,7 +71,9 @@ def _test(self, subcommand="start", options={}):
log("starting test server with options=%s", options)
args = ["--%s=%s" % (k,v) for k,v in options.items()]
xvfb = None
if self.display:
if WIN32:
display = ":0"
elif self.display:
display = self.display
args.append("--use-display")
else:
Expand All @@ -90,7 +95,7 @@ def _test(self, subcommand="start", options={}):
r = pollwait(client, 5)
assert r==0, "info client failed and returned %s for server with args=%s" % (r, args)
#connect a gui client:
if self.client_display and self.client_xvfb:
if WIN32 or (self.client_display and self.client_xvfb):
xpra_args = ["attach", display]
gui_client = self.run_xpra(xpra_args, {"DISPLAY" : self.client_display})
r = pollwait(gui_client, 5)
Expand Down
8 changes: 7 additions & 1 deletion src/unittests/unit/server/mixins/shadow_option_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ def test_start_all(self):


def main():
unittest.main()
from xpra.os_util import WIN32
if not WIN32:
unittest.main()
#for running on win32:
#XPRA_WAIT_FOR_INPUT=0 XPRA_COMMAND=../scripts/xpra \
# PYTHONPATH=".;.." XPRA_TEST_DEBUG=1 XPRA_ALL_DEBUG=1 \
# ./unit/server/mixins/shadow_option_test.py


if __name__ == '__main__':
Expand Down
6 changes: 4 additions & 2 deletions src/unittests/unit/server_test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import unittest
import subprocess
from xpra.util import envbool, envint, repr_ellipsized
from xpra.os_util import OSEnvContext, pollwait, osexpand, POSIX
from xpra.os_util import OSEnvContext, pollwait, osexpand, POSIX, WIN32
from xpra.scripts.config import get_defaults
from xpra.platform.dotxpra import DotXpra
from xpra.platform.paths import get_xpra_command
Expand Down Expand Up @@ -42,7 +42,9 @@ def setUpClass(cls):
cls.default_config = get_defaults()
cls.display_start = 100
cls.dotxpra = DotXpra("/tmp", ["/tmp"])
cls.default_xpra_args = ["--systemd-run=no", "--pulseaudio=no", "--socket-dirs=/tmp", "--speaker=no", "--microphone=no"]
cls.default_xpra_args = ["--speaker=no", "--microphone=no"]
if not WIN32:
cls.default_xpra_args += ["--systemd-run=no", "--pulseaudio=no", "--socket-dirs=/tmp"]
ServerTestUtil.existing_displays = cls.displays()
ServerTestUtil.processes = []
xpra_list = cls.run_xpra(["list"])
Expand Down

0 comments on commit 3fa5c5c

Please sign in to comment.