Skip to content

Commit

Permalink
#847: run unit tests on osx during the build (and disable many posix …
Browse files Browse the repository at this point in the history
…tests since osx is missing Xvfb / proper server support..)

git-svn-id: https://xpra.org/svn/Xpra/trunk@14871 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jan 28, 2017
1 parent 6627a01 commit cc9bb89
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 15 deletions.
22 changes: 22 additions & 0 deletions osx/make-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ STRIP_SOURCE="${STRIP_SOURCE:=$STRIP_DEFAULT}"
STRIP_OPENGL="${STRIP_OPENGL:=$STRIP_DEFAULT}"
STRIP_NUMPY="${STRIP_NUMPY:=$STRIP_DEFAULT}"

DO_TESTS="${DO_TESTS:-1}"

BUILDNO="${BUILDNO:="0"}"
IMAGE_DIR="./image/Xpra.app"
CONTENTS_DIR="${IMAGE_DIR}/Contents"
Expand Down Expand Up @@ -37,6 +39,7 @@ echo "./setup.py install ${BUILD_ARGS}"
echo " (see install.log for details - this may take a minute or two)"
python ./setup.py install ${BUILD_ARGS} >& install.log
if [ "$?" != "0" ]; then
popd
echo "ERROR: install failed"
echo
tail -n 10 install.log
Expand All @@ -49,6 +52,25 @@ REVISION=`python -c "from xpra import src_info;import sys;sys.stdout.write(str(s
REV_MOD=`python -c "from xpra import src_info;import sys;sys.stdout.write(['','M'][src_info.LOCAL_MODIFICATIONS>0])"`
echo "OK"

if [ "${DO_TESTS}" == "1" ]; then
echo "running unit tests"
pushd ./unittests
#make sure the unit tests can run "python2 xpra ...":
rm -f ./xpra >& /dev/null
ln -sf ../scripts/xpra .
UNITTEST_LOG="unittest.log"
PYTHONPATH=. ./unit/run.py >& ${UNITTEST_LOG}
if [ "$?" != "0" ]; then
popd
echo "ERROR: unit tests failed, see ${UNITTEST_LOG}:"
tail -n 20 ${UNITTEST_LOG}
exit 1
else
echo "OK"
fi
fi
popd

echo
echo "*******************************************************************************"
echo "py2app step:"
Expand Down
3 changes: 2 additions & 1 deletion src/unittests/unit/client/osxlike_clipboard_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sys
import unittest
from unit.client.x11_clipboard_test_util import X11ClipboardTestUtil
from xpra.os_util import OSX


class OSXLikeClipboardTest(X11ClipboardTestUtil):
Expand Down Expand Up @@ -37,7 +38,7 @@ def test_to_client(self):


def main():
if os.name=="posix" and sys.version_info[0]==2:
if os.name=="posix" and sys.version_info[0]==2 and not OSX:
unittest.main()


Expand Down
4 changes: 2 additions & 2 deletions src/unittests/unit/client/x11_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys
import unittest
from xpra.util import envint
from xpra.os_util import load_binary_file, pollwait
from xpra.os_util import load_binary_file, pollwait, OSX
from unit.client.x11_client_test_util import X11ClientTestUtil, log

CLIENT_TIMEOUT = envint("XPRA_TEST_CLIENT_TIMEOUT", 5)
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_control_send_file(self):


def main():
if os.name=="posix" and sys.version_info[0]==2:
if os.name=="posix" and sys.version_info[0]==2 and not OSX:
unittest.main()


Expand Down
3 changes: 2 additions & 1 deletion src/unittests/unit/client/x11_clipboard_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import unittest

from unit.client.x11_clipboard_test_util import X11ClipboardTestUtil
from xpra.os_util import OSX

from xpra.log import Logger
log = Logger("clipboard")
Expand Down Expand Up @@ -36,7 +37,7 @@ def test_to_client(self):


def main():
if os.name=="posix" and sys.version_info[0]==2:
if os.name=="posix" and sys.version_info[0]==2 and not OSX:
unittest.main()


Expand Down
2 changes: 1 addition & 1 deletion src/unittests/unit/server/proxy_server_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# later version. See the file COPYING for details.

import unittest
from xpra.os_util import pollwait
from xpra.os_util import pollwait, OSX
from unit.server_test_util import ServerTestUtil, log


Expand Down
4 changes: 2 additions & 2 deletions src/unittests/unit/server/server_auth_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import sys
import unittest
from xpra.os_util import pollwait
from xpra.os_util import pollwait, OSX
from xpra.exit_codes import EXIT_OK, EXIT_FAILURE, EXIT_PASSWORD_REQUIRED
from unit.server_test_util import ServerTestUtil, log

Expand Down Expand Up @@ -78,7 +78,7 @@ def test_multifile(self):


def main():
if os.name=="posix" and sys.version_info[0]==2:
if os.name=="posix" and sys.version_info[0]==2 and not OSX:
unittest.main()


Expand Down
4 changes: 2 additions & 2 deletions src/unittests/unit/server/server_sockets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import unittest
import tempfile
from xpra.util import repr_ellipsized
from xpra.os_util import load_binary_file, pollwait
from xpra.os_util import load_binary_file, pollwait, OSX
from xpra.exit_codes import EXIT_OK, EXIT_CONNECTION_LOST
from xpra.net.net_util import get_free_tcp_port
from unit.server_test_util import ServerTestUtil, log
Expand Down Expand Up @@ -146,7 +146,7 @@ def test_bind_tmpdir(self):


def main():
if os.name=="posix" and sys.version_info[0]==2:
if os.name=="posix" and sys.version_info[0]==2 and not OSX:
unittest.main()


Expand Down
4 changes: 2 additions & 2 deletions src/unittests/unit/server/shadow_server_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys
import time
import unittest
from xpra.os_util import pollwait
from xpra.os_util import pollwait, OSX
from unit.server_test_util import ServerTestUtil


Expand All @@ -28,7 +28,7 @@ def test_shadow_start_stop(self):


def main():
if os.name=="posix" and sys.version_info[0]==2:
if os.name=="posix" and sys.version_info[0]==2 and not OSX:
unittest.main()


Expand Down
4 changes: 2 additions & 2 deletions src/unittests/unit/server/x11_server_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys
import time
import unittest
from xpra.os_util import pollwait
from xpra.os_util import pollwait, OSX
from unit.server_test_util import ServerTestUtil, log


Expand Down Expand Up @@ -57,7 +57,7 @@ def test_existing_Xvfb(self):


def main():
if os.name=="posix" and sys.version_info[0]==2:
if os.name=="posix" and sys.version_info[0]==2 and not OSX:
unittest.main()


Expand Down
2 changes: 1 addition & 1 deletion src/unittests/unit/server_test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _temp_file(self, data=None):
def find_X11_display_numbers(cls):
#use X11 sockets:
X11_displays = set()
if os.name=="posix":
if os.name=="posix" and os.path.exists("/tmp/.X11-unix"):
for x in os.listdir("/tmp/.X11-unix"):
if x.startswith("X"):
try:
Expand Down
3 changes: 2 additions & 1 deletion src/unittests/unit/x11/keyboard_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import unittest

from unit.server_test_util import ServerTestUtil, log
from xpra.os_util import OSX


class TestX11Keyboard(ServerTestUtil):
Expand All @@ -32,7 +33,7 @@ def test_unicode(self):

def main():
#can only work with an X11 server
if os.name=="posix":
if os.name=="posix" and not OSX:
unittest.main()

if __name__ == '__main__':
Expand Down

0 comments on commit cc9bb89

Please sign in to comment.