summaryrefslogtreecommitdiffstats
path: root/scripts/qmlbenchrunner/change_sdk_ver.py
diff options
context:
space:
mode:
authorDaniel Smith <daniel.smith@qt.io>2021-04-30 15:28:12 +0200
committerDaniel Smith <daniel.smith@qt.io>2021-10-08 09:08:49 +0200
commit89f47602a8026c5111f482c71a30a274430596e1 (patch)
treee5bdf8b98e632103e2e8c29663346b90031019e9 /scripts/qmlbenchrunner/change_sdk_ver.py
parent7e68ee7a7e6e3d8f895cb7ff859f3448fcf311ca (diff)
Split embedded runners for qt5 and qt6
Branching off the qt5 embedded runner is cleaner than adapting the single script to cross-compile both qt5 and qt6, since both require completely different cross-compilation strategies due to the switch to cmake in qt6 from qmake. As the old embedded runner did, the new embedded runner for qt6 builds qt components required for qmlbench, deploys them to a target device, runs the benchmark suite, and then collects results. For qt6, a new python script is included to update hard-coded version strings in the boot2qt sdk as a workaround to enable the use of a single sdk across various versions of qt6. Task-number: QTQAINFRA-4412 Change-Id: I96fa0f9649fd22d0fb96001d79f1733bfba34c62 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'scripts/qmlbenchrunner/change_sdk_ver.py')
-rw-r--r--scripts/qmlbenchrunner/change_sdk_ver.py68
1 files changed, 68 insertions, 0 deletions
diff --git a/scripts/qmlbenchrunner/change_sdk_ver.py b/scripts/qmlbenchrunner/change_sdk_ver.py
new file mode 100644
index 00000000..3c64b5a6
--- /dev/null
+++ b/scripts/qmlbenchrunner/change_sdk_ver.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python3
+#############################################################################
+##
+## Copyright (C) 2021 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the qtqa module of the Qt Toolkit.
+##
+## $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$
+##
+#############################################################################
+
+import os
+import sys
+import re
+
+cmake_ver = ""
+
+with open("qtbase/.cmake.conf") as cmake:
+ for line in cmake.readlines():
+ if line.startswith("set(QT_REPO_MODULE_VERSION"):
+ cmake_ver = re.match(".+(\d.\d+.\d+)", line).groups()[0]
+
+
+for root, dirs, files in os.walk(os.path.expanduser(os.environ.get("LB_TOOLCHAIN"))):
+ for name in files:
+ with open(os.path.join(root, name), mode='r+') as f:
+ start = f.read().find("set(PACKAGE_VERSION")
+ if start < 0:
+ continue
+ f.seek(start)
+ end = f.read().find("\n")
+ f.seek(start)
+ toWrite = f"set(PACKAGE_VERSION \"{cmake_ver}\")"
+ if len(toWrite) == end:
+ f.write(toWrite)
+ print(f"Wrote '{toWrite}' to {os.path.join(root, name)}")
+ else:
+ print(f"Writing to {os.path.join(root, name)} would cause corruption.")
+ print(f.read()[start:start+end])