aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2019-03-19 17:00:08 +0100
committerChristian Tismer <tismer@stackless.com>2019-04-08 13:55:43 +0000
commit728e94e37d44229d8f31dee4761eaf66f89bf01e (patch)
tree98b7c7a89bdb1e23b2f4863b6d80fdcc4061ae2c /testing
parentafd4ee23124541c23fe58639f138ed7689cac562 (diff)
Automatically Test Small Example With PyInstaller
A simple hello.py script was modified for running in PyInstaller and stopping to execute after 2 seconds. The reason is to test that PyInstaller works correctly together with the embedded mode of the signature extension on all platforms. The script did first not work on Windows. This is now solved, after an import in pyside2_config.py is fixed. Currently, there are several configuration errors in COIN. Errors are therefore skipped in the PyInstaller build. The test tests only if the generated script works. Change-Id: I7a1b1e738d523b83cc3fe5beafa7e2579f9c7f48 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'testing')
-rw-r--r--testing/wheel_tester.py41
1 files changed, 40 insertions, 1 deletions
diff --git a/testing/wheel_tester.py b/testing/wheel_tester.py
index 60fd7a38a..810ef0f56 100644
--- a/testing/wheel_tester.py
+++ b/testing/wheel_tester.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2018 The Qt Company Ltd.
+## Copyright (C) 2019 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of Qt for Python.
@@ -71,6 +71,7 @@ from build_scripts.utils import find_glob_in_path
from build_scripts.utils import run_process
from build_scripts.utils import rmtree
import distutils.log as log
+import platform
log.set_verbosity(1)
@@ -203,6 +204,22 @@ def generate_build_qmake():
log.info("")
+def compile_using_pyinstaller():
+ src_path = os.path.join("..", "hello.py")
+ exit_code = run_process([sys.executable, "-m", "PyInstaller",
+ "--name=hello_app", "--console", "--log-level=DEBUG",
+ src_path])
+ if exit_code:
+ # raise RuntimeError("Failure while compiling script using PyInstaller.")
+ print("PYINST: Failure while compiling script using PyInstaller.")
+ print("PYINST: sys.version = {}".format(sys.version.splitlines()[0]))
+ print("PYINST: platform.platform() = {}".format(platform.platform()))
+ print("PYINST: See the error message above.")
+ return False
+ log.info("")
+ return True
+
+
def run_make():
args = []
if is_unix():
@@ -232,6 +249,14 @@ def run_make_install():
log.info("")
+def run_compiled_script(binary_path):
+ args = [binary_path]
+ exit_code = run_process(args)
+ if exit_code:
+ raise RuntimeError("Failure while executing compiled script: {}".format(binary_path))
+ log.info("")
+
+
def execute_script(script_path):
args = [sys.executable, script_path]
exit_code = run_process(args)
@@ -257,6 +282,20 @@ def prepare_build_folder(src_path, build_folder_name):
def try_build_examples():
examples_dir = get_examples_dir()
+ # This script should better go to the last place, here.
+ # But because it is most likely to break, we put it here for now.
+ log.info("Attempting to build hello.py using PyInstaller.")
+ # PyInstaller is loaded by coin_build_instructions.py, but not when
+ # testing directly this script.
+ src_path = os.path.join(examples_dir, "installer_test")
+ prepare_build_folder(src_path, "pyinstaller")
+
+ # Currently, there are bugs in the COIN setup.
+ # That is currently not the subject of this test:
+ if compile_using_pyinstaller():
+ run_compiled_script(os.path.join(src_path,
+ "pyinstaller", "dist", "hello_app", "hello_app"))
+
log.info("Attempting to build and run samplebinding using cmake.")
src_path = os.path.join(examples_dir, "samplebinding")
prepare_build_folder(src_path, "cmake")