aboutsummaryrefslogtreecommitdiffstats
path: root/coin_test_instructions.py
diff options
context:
space:
mode:
Diffstat (limited to 'coin_test_instructions.py')
-rw-r--r--coin_test_instructions.py132
1 files changed, 68 insertions, 64 deletions
diff --git a/coin_test_instructions.py b/coin_test_instructions.py
index c560f2175..b0e71fba7 100644
--- a/coin_test_instructions.py
+++ b/coin_test_instructions.py
@@ -1,50 +1,16 @@
-#############################################################################
-##
-## Copyright (C) 2019 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:LGPL$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 3 as published by the Free Software
-## Foundation and appearing in the file LICENSE.LGPL3 included in the
-## packaging of this file. Please review the following information to
-## ensure the GNU Lesser General Public License version 3 requirements
-## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 2.0 or (at your option) the GNU General
-## Public license version 3 or any later version approved by the KDE Free
-## Qt Foundation. The licenses are as published by the Free Software
-## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-2.0.html and
-## https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-from build_scripts.options import has_option
-from build_scripts.options import option_value
-from build_scripts.utils import install_pip_dependencies
-from build_scripts.utils import get_qtci_virtualEnv
-from build_scripts.utils import run_instruction
-from build_scripts.utils import rmtree
-from build_scripts.utils import acceptCITestConfiguration
-from build_scripts.utils import get_ci_qmake_path
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import os
+import logging
+import site
+import sys
+
+from build_scripts.log import log
+from build_scripts.options import has_option, option_value
+from build_scripts.utils import (expand_clang_variables, get_ci_qmake_path,
+ get_qtci_virtualEnv, remove_tree, run_instruction)
+
+log.setLevel(logging.INFO)
# Values must match COIN thrift
CI_HOST_OS = option_value("os")
@@ -62,14 +28,49 @@ if _ci_features is not None:
CI_FEATURES.append(f)
CI_RELEASE_CONF = has_option("packaging")
+
def call_testrunner(python_ver, buildnro):
- _pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH)
- rmtree(_env, True)
- run_instruction(["virtualenv", "-p", _pExe, _env], "Failed to create virtualenv")
- install_pip_dependencies(env_pip, ["pip", "numpy", "PyOpenGL", "setuptools", "six", "pyinstaller", "wheel"])
- cmd = [env_python, "testrunner.py", "test",
- "--blacklist", "build_history/blacklist.txt",
- "--buildno=" + buildnro]
+ _pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH,
+ CI_TARGET_ARCH)
+ remove_tree(_env, True)
+ # Pinning the virtualenv before creating one
+ # Use pip3 if possible while pip seems to install the virtualenv to wrong dir in some OS
+ python3 = "python3"
+ if sys.platform == "win32":
+ python3 = os.path.join(os.getenv("PYTHON3_PATH"), "python.exe")
+
+ # we shouldn't install anything outside of virtualenv, while m1 is not virtualized yet
+ if CI_HOST_OS == "MacOS" and CI_HOST_ARCH == "ARM64":
+ v_env = "virtualenv"
+ run_instruction([str(v_env), "-p", str(_pExe), str(_env)], "Failed to create virtualenv")
+ run_instruction([env_pip, "install", "-r", "requirements.txt"],
+ "Failed to install dependencies")
+ else:
+ run_instruction([python3, "-m", "pip", "install", "--user", "virtualenv==20.7.2"],
+ "Failed to pin virtualenv")
+ # installing to user base might not be in PATH by default.
+ env_path = os.path.join(site.USER_BASE, "bin")
+ v_env = os.path.join(env_path, "virtualenv")
+ if sys.platform == "win32":
+ env_path = os.path.join(site.USER_BASE, "Scripts")
+ v_env = os.path.join(env_path, "virtualenv.exe")
+ try:
+ run_instruction([str(v_env), "--version"], "Using default virtualenv")
+ except Exception as e:
+ log.info("Failed to use the default virtualenv")
+ log.info(f"{type(e).__name__}: {e}")
+ v_env = "virtualenv"
+ run_instruction([str(v_env), "-p", str(_pExe), str(_env)], "Failed to create virtualenv")
+ # When the 'python_ver' variable is empty, we are using Python 2
+ # Pip is always upgraded when CI template is provisioned,
+ # upgrading it in later phase may cause perm issue
+ run_instruction([env_pip, "install", "-r", "requirements.txt"],
+ "Failed to install dependencies")
+ # Install distro to replace missing platform.linux_distribution() in python3.8
+ run_instruction([env_pip, "install", "distro"], "Failed to install distro")
+
+ cmd = [env_python, "testrunner.py", "test", "--blacklist", "build_history/blacklist.txt",
+ f"--buildno={buildnro}"]
run_instruction(cmd, "Failed to run testrunner.py")
qmake_path = get_ci_qmake_path(CI_ENV_INSTALL_DIR, CI_HOST_OS)
@@ -77,27 +78,30 @@ def call_testrunner(python_ver, buildnro):
# Try to install built wheels, and build some buildable examples.
if CI_RELEASE_CONF:
wheel_tester_path = os.path.join("testing", "wheel_tester.py")
- cmd = [env_python, wheel_tester_path, qmake_path]
- run_instruction(cmd, "Error while running wheel_tester.py")
+ # Run the test for the new set of wheels
+ cmd = [env_python, wheel_tester_path, qmake_path, "--wheels-dir=dist", "--new"]
+ run_instruction(cmd, "Error while running wheel_tester.py on new wheels")
-def run_test_instructions():
- if not acceptCITestConfiguration(CI_HOST_OS, CI_HOST_OS_VER, CI_TARGET_ARCH, CI_COMPILER):
- exit()
+def run_test_instructions():
# Remove some environment variables that impact cmake
+ arch = '32' if CI_TARGET_ARCH == 'X86' else '64'
+ expand_clang_variables(arch)
for env_var in ['CC', 'CXX']:
if os.environ.get(env_var):
del os.environ[env_var]
os.chdir(CI_ENV_AGENT_DIR)
testRun = 0
- # We didn't build for Python 2 in win
- if CI_HOST_OS != "Windows":
- call_testrunner("", str(testRun))
- testRun =+ 1
- # We know that second build was with python3
- if CI_RELEASE_CONF and CI_HOST_OS_VER not in ["RHEL_6_6"]:
+
+ # In win machines, there are additional python versions to test with
+ if CI_HOST_OS == "Windows":
+ call_testrunner("3.10.0", str(testRun))
+ elif CI_HOST_OS == "Linux":
+ call_testrunner("3.11", str(testRun))
+ else:
call_testrunner("3", str(testRun))
+
if __name__ == "__main__":
run_test_instructions()