diff options
Diffstat (limited to 'packaging-tools')
9 files changed, 474 insertions, 22 deletions
diff --git a/packaging-tools/bld_ifw_tools.py b/packaging-tools/bld_ifw_tools.py index a068a19fc..1e8c8360b 100644 --- a/packaging-tools/bld_ifw_tools.py +++ b/packaging-tools/bld_ifw_tools.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- ############################################################################# ## ## Copyright (C) 2018 The Qt Company Ltd. @@ -39,12 +40,14 @@ import bldinstallercommon import pkg_constants import shutil import shlex +import traceback +import subprocess +from multiprocessing.connection import Listener ROOT_DIR = os.path.dirname(os.path.realpath(__file__)) ARCH_EXT = '.zip' if platform.system().lower().startswith('win') else '.tar.xz' - ################################################################## # Get default Qt configure arguments. Platform is detected. ################################################################## @@ -141,7 +144,7 @@ class IfwOptions: default_qt_src_pkg = 'http://download.qt.io/official_releases/qt/5.9/5.9.5/single/qt-everywhere-opensource-src-5.9.5' + ARCH_EXT default_qt_installer_framework_url = 'git://code.qt.io/installer-framework/installer-framework.git' default_qt_installer_framework_branch_qt = '3.0' - default_qt_installer_framework_qmake_args = ['-config', 'release', '-config', 'static'] + default_qt_installer_framework_qmake_args = ['-r', '-config', 'release', '-config', 'static'] def __init__(self, qt_source_package_uri, @@ -155,7 +158,12 @@ class IfwOptions: qt_binaries_dynamic, signserver, signpwd, - incremental_build = False): + incremental_build = False, + squish_dir = "", + squish_src = "" + ): + self.squish_dir = squish_dir + self.squish_src = squish_src self.signserver = signserver self.signpwd = signpwd self.incremental_mode = incremental_build @@ -164,6 +172,7 @@ class IfwOptions: self.qt_build_dir_dynamic = os.path.join(ROOT_DIR, 'qt-bld-dynamic') self.installer_framework_source_dir = os.path.join(ROOT_DIR, 'ifw-src') self.installer_framework_build_dir = os.path.join(ROOT_DIR, 'ifw-bld') + self.installer_framework_build_dir_squish = os.path.join(ROOT_DIR, 'ifw-bld_squish') self.installer_framework_pkg_dir = os.path.join(ROOT_DIR, 'ifw-pkg') self.installer_framework_target_dir = os.path.join(ROOT_DIR, 'ifw-target') self.qt_installer_framework_uri = qt_installer_framework_uri @@ -212,21 +221,22 @@ class IfwOptions: self.architecture = bldinstallercommon.get_architecture() self.plat_suffix = bldinstallercommon.get_platform_suffix() self.installer_framework_archive_name = 'installer-framework-build-' + self.qt_installer_framework_branch_pretty + "-" + self.plat_suffix + '-' + self.architecture + '.7z' + self.installer_framework_with_squish_archive_name = 'installer-framework-build-squish-' + self.qt_installer_framework_branch_pretty + "-" + self.plat_suffix + '-' + self.architecture + '.7z' self.installer_base_archive_name = 'installerbase-' + self.qt_installer_framework_branch_pretty + "-" + self.plat_suffix + '-' + self.architecture + '.7z' self.installer_framework_payload_arch = 'installer-framework-build-stripped-' + self.qt_installer_framework_branch_pretty + "-" + self.plat_suffix + '-' + self.architecture + '.7z' self.qt_source_package_uri = qt_source_package_uri self.qt_source_package_uri_saveas = os.path.join(ROOT_DIR, os.path.basename(self.qt_source_package_uri)) # Set Qt build prefix - qt_prefix = ' -prefix ' + self.qt_build_dir + os.sep + 'qtbase' - self.qt_configure_options = qt_configure_options + qt_prefix + qt_prefix = ' -prefix ' + self.qt_build_dir + os.sep + 'qtbase' + self.qt_configure_options = qt_configure_options + qt_prefix # Product key checker self.product_key_checker_pri = product_key_checker_pri if product_key_checker_pri: if os.path.isfile(product_key_checker_pri): - self.qt_installer_framework_qmake_args += ['-r', 'PRODUCTKEYCHECK_PRI_FILE=' + self.product_key_checker_pri] + self.qt_installer_framework_qmake_args += ['PRODUCTKEYCHECK_PRI_FILE=' + self.product_key_checker_pri] # macOS specific if bldinstallercommon.is_mac_platform(): - self.qt_installer_framework_qmake_args += ['-r', '"LIBS+=-framework IOKit"'] + self.qt_installer_framework_qmake_args += ['"LIBS+=-framework IOKit"'] # sanity check self.sanity_check() @@ -238,9 +248,9 @@ class IfwOptions: sys.exit(-1) if self.product_key_checker_pri: if os.path.isfile(self.product_key_checker_pri): - print('Using product key checker: '.format(self.product_key_checker_pri)) + print('Using product key checker: {0}'.format(self.product_key_checker_pri)) else: - print('*** Error! Given product key checker is not a valid file: '.format(self.product_key_checker_pri)) + print('*** Error! Given product key checker is not a valid file: {0}'.format(self.product_key_checker_pri)) sys.exit(-1) def print_data(self): @@ -262,6 +272,7 @@ class IfwOptions: print('installer_framework_source_dir: {0}'.format(self.installer_framework_source_dir)) print('installer_framework_build_dir: {0}'.format(self.installer_framework_build_dir)) print('installer_framework_archive_name: {0}'.format(self.installer_framework_archive_name)) + print('installer_framework_with_squish_archive_name: {0}'.format(self.installer_framework_with_squish_archive_name)) print('installer_base_archive_name: {0}'.format(self.installer_base_archive_name)) print('installer_framework_pkg_dir: {0}'.format(self.installer_framework_pkg_dir)) print('installer_framework_target_dir: {0}'.format(self.installer_framework_target_dir)) @@ -269,6 +280,8 @@ class IfwOptions: print('product_key_checker: {0}'.format(self.product_key_checker_pri)) print('qt_binaries_static: {0}'.format(self.qt_binaries_static)) print('qt_binaries_dynamic: {0}'.format(self.qt_binaries_dynamic)) + print('squish_dir: {0}'.format(self.squish_dir)) + print('squish_src: {0}'.format(self.squish_src)) print('-----------------------------------------') @@ -289,6 +302,9 @@ def build_ifw(options, create_installer=False, build_ifw_examples=False): else: prepare_qt_sources(options) build_qt(options, options.qt_build_dir, options.qt_configure_options, options.qt_build_modules) + + if(options.squish_src): + build_squish(options) # build installer framework build_installer_framework(options) if build_ifw_examples: @@ -310,7 +326,9 @@ def build_ifw(options, create_installer=False, build_ifw_examples=False): create_installer_package(options) #archive archive_installerbase(options) - archive_installer_framework(options) + archive_installer_framework(options.installer_framework_build_dir, options.installer_framework_archive_name, options.build_artifacts_dir) + if (options.squish_dir): + archive_installer_framework(options.installer_framework_build_dir_squish, options.installer_framework_with_squish_archive_name, options.build_artifacts_dir) return os.path.basename(options.installer_framework_build_dir) @@ -392,6 +410,36 @@ def build_qt(options, qt_build_dir, qt_configure_options, qt_modules): ############################### # function ############################### +def build_squish(options): + + print('--------------------------------------------------------------------') + print('Configuring Squish') + qmake_bin = os.path.join(options.qt_build_dir, 'qtbase', 'bin', options.qt_qmake_bin) + print ('qmake path ' + qmake_bin) + + if bldinstallercommon.is_win_platform(): + cmd_args = "configure --with-qmake=" + qmake_bin + " --enable-qmake-config --disable-all --enable-idl --enable-qt" + print("command args " + cmd_args) + bldinstallercommon.do_execute_sub_process(cmd_args, options.squish_src) + else: + cmd_args = os.path.join(options.squish_src, "configure") + " --with-qmake=" + qmake_bin + " --enable-qmake-config --disable-all --enable-idl --enable-qt" + print("command args " + cmd_args) + bldinstallercommon.do_execute_sub_process(shlex.split(cmd_args), options.squish_src) + + print('--------------------------------------------------------------------') + print("building form source " + options.squish_src) + print('Building Squish') + + if bldinstallercommon.is_win_platform(): + bldinstallercommon.do_execute_sub_process('build', options.squish_src) + bldinstallercommon.do_execute_sub_process('build install DESTDIR=' + options.squish_dir, options.squish_src) + else: + bldinstallercommon.do_execute_sub_process(shlex.split(os.path.join(options.squish_src, 'build')), options.squish_src) + bldinstallercommon.do_execute_sub_process(shlex.split(os.path.join(options.squish_src,'build install DESTDIR=') + options.squish_dir), options.squish_src) + +############################### +# function +############################### def prepare_installer_framework(options): if options.incremental_mode and os.path.exists(options.installer_framework_source_dir): return @@ -399,6 +447,8 @@ def prepare_installer_framework(options): print('Prepare Installer Framework source') #create dirs bldinstallercommon.create_dirs(options.installer_framework_build_dir) + if (options.squish_dir): + bldinstallercommon.create_dirs(options.installer_framework_build_dir_squish) if options.qt_installer_framework_uri.endswith('.git'): # clone repos bldinstallercommon.clone_repository(options.qt_installer_framework_uri, options.qt_installer_framework_branch, options.installer_framework_source_dir) @@ -407,6 +457,13 @@ def prepare_installer_framework(options): prepare_compressed_package(options.qt_installer_framework_uri, options.qt_installer_framework_uri_saveas, options.installer_framework_source_dir) +def start_IFW_build(options, cmd_args, installer_framework_build_dir): + print("cmd_args: " + bldinstallercommon.list_as_string(cmd_args)) + bldinstallercommon.do_execute_sub_process(cmd_args, installer_framework_build_dir) + cmd_args = options.make_cmd + print("cmd_args: " + bldinstallercommon.list_as_string(cmd_args)) + bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), installer_framework_build_dir) + ############################### # function ############################### @@ -430,14 +487,25 @@ def build_installer_framework(options): cmd_args = [qmake_bin] cmd_args += options.qt_installer_framework_qmake_args cmd_args += [options.installer_framework_source_dir] - bldinstallercommon.do_execute_sub_process(cmd_args, options.installer_framework_build_dir) - cmd_args = options.make_cmd - bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), options.installer_framework_build_dir) + start_IFW_build(options, cmd_args, options.installer_framework_build_dir) + if options.squish_dir: + print('--------------------------------------------------------------------') + print('Build Installer Framework with squish support') + if not os.path.exists(options.installer_framework_build_dir_squish): + bldinstallercommon.create_dirs(options.installer_framework_build_dir_squish) + cmd_args = [qmake_bin] + cmd_args += options.qt_installer_framework_qmake_args + cmd_args += ['SQUISH_PATH=' + options.squish_dir] + cmd_args += [options.installer_framework_source_dir] + start_IFW_build(options, cmd_args, options.installer_framework_build_dir_squish) def build_installer_framework_examples(options): print('--------------------------------------------------------------------') print('Building Installer Framework Examples') - file_binarycreator = os.path.join(options.installer_framework_build_dir, 'bin', 'binarycreator') + if options.squish_dir: + file_binarycreator = os.path.join(options.installer_framework_build_dir_squish, 'bin', 'binarycreator') + else: + file_binarycreator = os.path.join(options.installer_framework_build_dir, 'bin', 'binarycreator') if bldinstallercommon.is_win_platform(): file_binarycreator += '.exe' if not os.path.exists(file_binarycreator): @@ -458,7 +526,22 @@ def build_installer_framework_examples(options): target_dir = os.path.join(root, directory, 'installer') bldinstallercommon.do_execute_sub_process(args=(file_binarycreator, '--offline-only', '-c', config_file, '-p', package_dir, target_dir), execution_path=package_dir) #Breaking here as we don't want to go through sub directories - break; + break + file_squishDir = options.squish_dir + if os.path.exists(file_squishDir): + print('--------------------------------------------------------------------') + print('Running squish tests') + # Windows + if sys.platform.startswith('win'): + squishserver_handle = subprocess.Popen(os.path.join(file_squishDir, 'bin', 'squishserver.exe')) + bldinstallercommon.do_execute_sub_process(args=('squishrunner.exe --testsuite ' + os.path.join(os.getcwd(), 'squish_suites', 'suite_IFW_examples')), execution_path=os.path.join(file_squishDir, 'bin')) + squishserver_handle.kill() # this will not kill squishserver most likely + subprocess.Popen("TASKKILL /IM _squishserver.exe /F") #this should kill squish server + # Unix + else: + squishserver_handle = subprocess.Popen(shlex.split(os.path.join(file_squishDir, "bin", "squishserver")), shell=False) + bldinstallercommon.do_execute_sub_process(args=shlex.split(os.path.join(file_squishDir, "bin", "squishrunner") + ' --testsuite ' +os.path.join(os.getcwd(), "squish_suites", "suite_IFW_examples")), execution_path=os.path.join(file_squishDir, "bin")) + squishserver_handle.kill() #kills squish server ############################### # function @@ -534,6 +617,8 @@ def create_installer_package(options): def clean_build_environment(options): if os.path.isfile(options.installer_framework_archive_name): os.remove(options.installer_framework_archive_name) + if os.path.isfile(options.installer_framework_with_squish_archive_name): + os.remove(options.installer_framework_with_squish_archive_name) if os.path.isfile(options.installer_framework_payload_arch): os.remove(options.installer_framework_payload_arch) if os.path.exists(options.build_artifacts_dir): @@ -541,6 +626,8 @@ def clean_build_environment(options): bldinstallercommon.create_dirs(options.build_artifacts_dir) if os.path.exists(options.installer_framework_build_dir): bldinstallercommon.remove_tree(options.installer_framework_build_dir) + if os.path.exists(options.installer_framework_build_dir_squish): + bldinstallercommon.remove_tree(options.installer_framework_build_dir_squish) if os.path.exists(options.installer_framework_pkg_dir): shutil.rmtree(options.installer_framework_pkg_dir) @@ -555,7 +642,7 @@ def clean_build_environment(options): if os.path.exists(options.qt_source_dir): bldinstallercommon.remove_tree(options.qt_source_dir) if os.path.exists(options.qt_build_dir): - bldinstallercommon.remove_tree(options.qt_build_dir) + bldinstallercommon.remove_tree(options.qt_source_dir) if os.path.isfile(options.qt_source_package_uri_saveas): os.remove(options.qt_source_package_uri_saveas) if os.path.isfile(options.qt_installer_framework_uri_saveas): @@ -565,17 +652,17 @@ def clean_build_environment(options): ############################### # function ############################### -def archive_installer_framework(options): +def archive_installer_framework(installer_framework_build_dir, installer_framework_archive_name, build_artifacts_dir): print('--------------------------------------------------------------------') print('Archive Installer Framework') # first strip out all unnecessary files - for root, dummy, files in os.walk(options.installer_framework_build_dir): + for root, dummy, files in os.walk(installer_framework_build_dir): for filename in files: if filename.endswith(('.moc', 'Makefile', '.cpp', '.h', '.o')) or filename == 'Makefile': os.remove(os.path.join(root, filename)) - cmd_args = ['7z', 'a', options.installer_framework_archive_name, os.path.basename(options.installer_framework_build_dir)] + cmd_args = ['7z', 'a', installer_framework_archive_name, os.path.basename(installer_framework_build_dir)] bldinstallercommon.do_execute_sub_process(cmd_args, ROOT_DIR) - shutil.move(options.installer_framework_archive_name, options.build_artifacts_dir) + shutil.move(installer_framework_archive_name, build_artifacts_dir) ############################### @@ -701,9 +788,10 @@ def setup_argument_parser(): parser.add_argument('--qt_binaries_dynamic', help="Use prebuilt Qt package instead of building from scratch", required=False) parser.add_argument('--sign_server', help="Signing server address", required=False) parser.add_argument('--sign_server_pwd', help="Signing server parssword", required=False) + parser.add_argument('--squish_dir', help="Path to Squish. If set, runs squish tests to IFW examples", required=False, default='') + parser.add_argument('--squish_src', help="Path to Squish sources. If set, Squish is built", required=False, default='') return parser - ############################### # Main ############################### @@ -736,7 +824,9 @@ if __name__ == "__main__": CARGS.qt_binaries_dynamic, signserver, signpwd, - CARGS.incremental + CARGS.incremental, + CARGS.squish_dir, + CARGS.squish_src ) # build ifw tools build_ifw(OPTIONS, CARGS.create_installer, CARGS.build_ifw_examples) diff --git a/packaging-tools/squish_suites/shared/__init__.py b/packaging-tools/squish_suites/shared/__init__.py new file mode 100644 index 000000000..90e6df838 --- /dev/null +++ b/packaging-tools/squish_suites/shared/__init__.py @@ -0,0 +1,2 @@ +# This file makes python to treat this directory as package +# As Package file can be imported using import statement diff --git a/packaging-tools/squish_suites/shared/shared.py b/packaging-tools/squish_suites/shared/shared.py new file mode 100644 index 000000000..fabd46636 --- /dev/null +++ b/packaging-tools/squish_suites/shared/shared.py @@ -0,0 +1,85 @@ +########################################################################### +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Qt Installer Framework. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +########################################################################### +import os +import sys +import shlex +import subprocess +import test +import testData +import object +import objectMap +import squishinfo +import squish +import squish_module_helper + +def add_attachable_aut(name="teest",port=11233): + test.log("Adding attachable aut to autlist") + squish_module_helper.import_squish_symbols() + if sys.platform.startswith("win"): + subprocess.Popen([os.path.join(os.environ["SQUISH_PREFIX"], 'bin', 'squishserver.exe'), '--config', 'addAttachableAUT', name, str(port)]) + else: + subprocess.Popen([os.path.join(os.environ["SQUISH_PREFIX"], 'bin', 'squishserver'), '--config', 'addAttachableAUT', name, str(port)]) + +def attach_to_aut(application_folder_path, + executable, + arguments_for_aut = "--uses-builtin-hook", + squish_path = os.path.join(os.environ["SQUISH_PREFIX"])): + + squish_module_helper.import_squish_symbols() + start_aut_bin = os.path.join(squish_path, "bin", "startaut") + if sys.platform.startswith("win"): + executable += ".exe" + start_aut_bin += ".exe" + application_under_test = os.path.join(application_folder_path, executable) + # builds absolute path to testable application + test.log("Application under test: " + str(application_folder_path)+"/"+executable) + test.log(str(start_aut_bin)) + if sys.platform.startswith("win"): + start_aut_bin = start_aut_bin.replace("\\", "\\\\") + application_under_test = application_under_test.replace("\\", "\\\\") + start_aut_cmd = " ".join([start_aut_bin,arguments_for_aut,application_under_test]) # creates string for launching aut + start_aut_cmd = shlex.split(start_aut_cmd) # Converts launch string to list as needed by Unix; Windows can use string or list. + test.log("Subprocess call arguments", ' '.join(start_aut_cmd)) + test.log(start_aut_cmd[0]) + subprocess_handle = subprocess.Popen(start_aut_cmd, shell=False) + if sys.platform.startswith("win"): + snooze(5) + else: + snooze(1) # This delay is need to give time for application to start + test.log("Attaching to application") + testSettings.waitForObjectTimeout = 2000 +# Attempts to attach to application under test, if it fails will close program. + try: + attachToApplication("teest") # Note that name teest comes from Applications source code (all examples use this at least for now) + except Exception as e: # Handles failing to attach to application eg. log and kill. + test.fatal("FAIL: failed to attach to application", str(e)) + subprocess_handle.kill() + return None + else: + test.passes("Application successfully attached") + return subprocess_handle diff --git a/packaging-tools/squish_suites/shared/squish_module_helper.py b/packaging-tools/squish_suites/shared/squish_module_helper.py new file mode 100644 index 000000000..c6907349a --- /dev/null +++ b/packaging-tools/squish_suites/shared/squish_module_helper.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +# Copyright by Squish +# Script from +# https://kb.froglogic.com/display/KB/Article+-+Using+Squish+functions+in+your+own+Python+modules+or+packages +# +import inspect +import sys + +import test + +def import_squish_symbols(import_into_module=None): + if import_into_module is None: + frame = inspect.stack()[1] + fn = frame[1] + mn = inspect.getmodulename(fn) + import_into_module = sys.modules[mn] + squish_module = sys.modules["squish"] + for n in dir(squish_module): + setattr(import_into_module, n, getattr(squish_module, n)) + setattr(import_into_module, "test", sys.modules["test"]) + setattr(import_into_module, "testData", sys.modules["testData"]) + setattr(import_into_module, "object", sys.modules["object"]) + setattr(import_into_module, "objectMap", sys.modules["objectMap"]) + setattr(import_into_module, "squishinfo", sys.modules["squishinfo"]) + +def import_squish_symbols_decorator(f, import_into_module): + def wrapper(): + squish_module = sys.modules["squish"] + for n in dir(squish_module): + setattr(import_into_module, n, getattr(squish_module, n)) + setattr(import_into_module, "test", sys.modules["test"]) + setattr(import_into_module, "testData", sys.modules["testData"]) + setattr(import_into_module, "object", sys.modules["object"]) + setattr(import_into_module, "objectMap", sys.modules["objectMap"]) + setattr(import_into_module, "squishinfo", sys.modules["squishinfo"]) + f() + return wrapper diff --git a/packaging-tools/squish_suites/suite_IFW_examples/envvars b/packaging-tools/squish_suites/suite_IFW_examples/envvars new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/packaging-tools/squish_suites/suite_IFW_examples/envvars diff --git a/packaging-tools/squish_suites/suite_IFW_examples/objects.map b/packaging-tools/squish_suites/suite_IFW_examples/objects.map new file mode 100644 index 000000000..d53c18396 --- /dev/null +++ b/packaging-tools/squish_suites/suite_IFW_examples/objects.map @@ -0,0 +1,66 @@ +::Maintain Modify Extract Installer Example.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +::Maintain Modify Extract Installer Example.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +::Maintain Modify Extract Installer Example.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +:Change Installer UI Example Setup.AcceptLicenseLabel_QLabel {name='AcceptLicenseLabel' type='QLabel' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.AcceptLicenseRadioButton_QRadioButton {name='AcceptLicenseRadioButton' type='QRadioButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.TargetDirectoryLineEdit_QLineEdit {name='TargetDirectoryLineEdit' type='QLineEdit' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2 {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.qt_wizard_cancel_QPushButton {name='qt_wizard_cancel' type='QPushButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.qt_wizard_commit_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Change Installer UI Example Setup_InstallerGui'} +:Change Installer UI Example Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='Change Installer UI Example Setup'} +:Component Error Example Setup.FinishedPage_QInstaller::FinishedPage {name='FinishedPage' type='QInstaller::FinishedPage' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup.IntroductionPage_QInstaller::IntroductionPage {name='IntroductionPage' type='QInstaller::IntroductionPage' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup.MessageLabel_QLabel {name='MessageLabel' type='QLabel' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup.__qt__passive_wizardbutton1_QPushButton {name='qt_wizard_cancel' type='QPushButton' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup.__qt__pazardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Component Error Example Setup_InstallerGui'} +:Component Error Example Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='Component Error Example Setup'} +:Component Error Example Setup_QWidget {type='QWidget' unnamed='1' visible='1' window=':Component Error Example Setup_InstallerGui'} +:ComponentsTreeView.Uncheckable component_QModelIndex {column='0' container=':Hide checkbox Setup.ComponentsTreeView_QTreeView' text='Uncheckable component' type='QModelIndex'} +:Dependency Solving Example Setup.TargetDirectoryLineEdit_QLineEdit {name='TargetDirectoryLineEdit' type='QLineEdit' visible='1' window=':Dependency Solving Example Setup_InstallerGui'} +:Dependency Solving Example Setup.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Dependency Solving Example Setup_InstallerGui'} +:Dependency Solving Example Setup.__qt__passive_wizardbutton1_QPushButton_2 {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Dependency Solving Example Setup_InstallerGui'} +:Dependency Solving Example Setup.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Dependency Solving Example Setup_InstallerGui'} +:Dependency Solving Example Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Dependency Solving Example Setup_InstallerGui'} +:Dependency Solving Example Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='Dependency Solving Example Setup'} +:Hide checkbox Setup.ComponentsTreeView_QTreeView {name='ComponentsTreeView' type='QTreeView' visible='1' window=':Hide checkbox Setup_InstallerGui'} +:Hide checkbox Setup.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Hide checkbox Setup_InstallerGui'} +:Hide checkbox Setup.__qt__passive_wizardbutton1_QPushButton_2 {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Hide checkbox Setup_InstallerGui'} +:Hide checkbox Setup.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Hide checkbox Setup_InstallerGui'} +:Hide checkbox Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Hide checkbox Setup_InstallerGui'} +:Hide checkbox Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='Hide checkbox Setup'} +:License Agreement Example Setup.AcceptLicenseLabel_QLabel {name='AcceptLicenseLabel' type='QLabel' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.AcceptLicenseRadioButton_QRadioButton {name='AcceptLicenseRadioButton' type='QRadioButton' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.RejectLicenseLabel_QLabel {name='RejectLicenseLabel' type='QLabel' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.__qt__passive_wizardbutton1_QPushButton_2 {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':License Agreement Example Setup_InstallerGui'} +:License Agreement Example Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='License Agreement Example Setup'} +:Maintain Change Installer UI Example.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain Change Installer UI Example_MaintenanceGui'} +:Maintain Change Installer UI Example.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain Change Installer UI Example_MaintenanceGui'} +:Maintain Change Installer UI Example.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain Change Installer UI Example_MaintenanceGui'} +:Maintain Change Installer UI Example_MaintenanceGui {type='MaintenanceGui' unnamed='1' visible='1' windowTitle='Maintain Change Installer UI Example'} +:Maintain Dependency Solving Example.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain Dependency Solving Example_MaintenanceGui'} +:Maintain Dependency Solving Example.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain Dependency Solving Example_MaintenanceGui'} +:Maintain Dependency Solving Example.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain Dependency Solving Example_MaintenanceGui'} +:Maintain Dependency Solving Example_MaintenanceGui {type='MaintenanceGui' unnamed='1' visible='1' windowTitle='Maintain Dependency Solving Example'} +:Maintain Hide checkbox.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain Hide checkbox_MaintenanceGui'} +:Maintain Hide checkbox.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain Hide checkbox_MaintenanceGui'} +:Maintain Hide checkbox.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain Hide checkbox_MaintenanceGui'} +:Maintain Hide checkbox_MaintenanceGui {type='MaintenanceGui' unnamed='1' visible='1' windowTitle='Maintain Hide checkbox'} +:Maintain License Agreement Example.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain License Agreement Example_MaintenanceGui'} +:Maintain License Agreement Example.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain License Agreement Example_MaintenanceGui'} +:Maintain License Agreement Example.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain License Agreement Example_MaintenanceGui'} +:Maintain License Agreement Example_MaintenanceGui {type='MaintenanceGui' unnamed='1' visible='1' windowTitle='Maintain License Agreement Example'} +:Maintain Modify Extract Installer Example.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +:Maintain Modify Extract Installer Example.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +:Maintain Modify Extract Installer Example.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Maintain Modify Extract Installer Example_MaintenanceGui'} +:Maintain Modify Extract Installer Example_MaintenanceGui {type='MaintenanceGui' unnamed='1' visible='1' windowTitle='Maintain Modify Extract Installer Example'} +:Modify Extract Installer Example Setup.__qt__passive_wizardbutton1_QPushButton {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Modify Extract Installer Example Setup_InstallerGui'} +:Modify Extract Installer Example Setup.__qt__passive_wizardbutton1_QPushButton_2 {name='__qt__passive_wizardbutton1' type='QPushButton' visible='1' window=':Modify Extract Installer Example Setup_InstallerGui'} +:Modify Extract Installer Example Setup.qt_wizard_commit_QPushButton {name='qt_wizard_commit' type='QPushButton' visible='1' window=':Modify Extract Installer Example Setup_InstallerGui'} +:Modify Extract Installer Example Setup.qt_wizard_finish_QPushButton {name='qt_wizard_finish' type='QPushButton' visible='1' window=':Modify Extract Installer Example Setup_InstallerGui'} +:Modify Extract Installer Example Setup_InstallerGui {type='InstallerGui' unnamed='1' visible='1' windowTitle='Modify Extract Installer Example Setup'} diff --git a/packaging-tools/squish_suites/suite_IFW_examples/suite.conf b/packaging-tools/squish_suites/suite_IFW_examples/suite.conf new file mode 100644 index 000000000..5b2a400f5 --- /dev/null +++ b/packaging-tools/squish_suites/suite_IFW_examples/suite.conf @@ -0,0 +1,8 @@ +AUT= +ENVVARS=envvars +HOOK_SUB_PROCESSES=false +IMPLICITAUTSTART=0 +LANGUAGE=Python +TEST_CASES=tst_start_suite tst_install_changeuserinterface tst_uninstall_changeuserinterface tst_install_dependencies_default tst_uninstall_dependencies_default tst_base tst_install_hidecheckbox tst_uninstall_hidecheckbox tst_install_licenseagreement tst_uninstall_licenseagreement tst_install_modifyextract tst_uninstall_modifyextract tst_end_suite +VERSION=3 +WRAPPERS=Qt diff --git a/packaging-tools/squish_suites/suite_IFW_examples/tst_install_changeuserinterface/test.py b/packaging-tools/squish_suites/suite_IFW_examples/tst_install_changeuserinterface/test.py new file mode 100644 index 000000000..fcf8eaa34 --- /dev/null +++ b/packaging-tools/squish_suites/suite_IFW_examples/tst_install_changeuserinterface/test.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- + +########################################################################### +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Qt Installer Framework. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +########################################################################### + +import os +from os.path import expanduser +import subprocess +import shlex +import sys +sys.path.append(os.path.join(os.pardir,os.pardir, "shared")) +import shared +import time + + +def info(): + test.log("#" * 50) + test.log("Squish path: " + os.environ["SQUISH_PREFIX"]) + test.log("#" * 50 + "\n") + +def main(): + info() + shared.add_attachable_aut() + time.sleep(7) + home = os.path.expanduser("~") + application_folder = "changeuserinterface" #folder where application resides + executable = "installer" #executable without filename extension eg. exe + # abs path to application folder(folder of tested program) + primary_test_install_dir = os.path.join(home, "IfwExamples") + application_folder_path = os.path.join("ifw-src", "examples", application_folder) + application_folder_path = os.path.normpath(os.path.join(os.path.abspath(__file__), os.path.pardir,os.path.pardir, os.path.pardir, os.path.pardir, application_folder_path)) + # Attempts to start and attach testable application + test.log("Attempting to start and attach AUT") + subprocess_handle = shared.attach_to_aut(application_folder_path, executable) + if not subprocess_handle: + return False + + # Actual beginning for test + test.log("Clicking next button at welcome page.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2")) + test.log("Appending _2 to installation path.") + type(waitForObject(":Change Installer UI Example Setup.TargetDirectoryLineEdit_QLineEdit"), "_2") + test.log("Clicking next button at installation path specification page.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2")) + test.log("Clicking next button at component selection page.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2")) + test.log("Clicking i agree radio button at license agreement page.") + clickButton(waitForObject(":Change Installer UI Example Setup.AcceptLicenseRadioButton_QRadioButton")) + test.log("Clicking next button at license agreement page.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2")) + #Only win has this start menu thing + if sys.platform.startswith("win"): + test.log("Clicking next button at StartMenu Shortcut specification screen.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton_2")) + test.log("Clicking install button at ready to install page.") + clickButton(waitForObject(":Change Installer UI Example Setup.__qt__passive_wizardbutton1_QPushButton")) + test.log("Clicking finish button at end page.") + clickButton(waitForObject(":Change Installer UI Example Setup.qt_wizard_finish_QPushButton")) + test.verify(os.path.exists(os.path.join(home, "IfwExamples", "changeuserinterface_2")), "installation folder exists") + + snooze(1) + # Makes sure that application under test will not keep running after test. + subprocess_handle.kill() diff --git a/packaging-tools/squish_suites/suite_IFW_examples/tst_uninstall_changeuserinterface/test.py b/packaging-tools/squish_suites/suite_IFW_examples/tst_uninstall_changeuserinterface/test.py new file mode 100644 index 000000000..eaeb471ca --- /dev/null +++ b/packaging-tools/squish_suites/suite_IFW_examples/tst_uninstall_changeuserinterface/test.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +########################################################################### +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Qt Installer Framework. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +########################################################################### +import os +from os.path import expanduser +import subprocess +import shlex +import sys +sys.path.append(os.path.join(os.pardir,os.pardir,"shared")) +import shared +import time + + +def info(): + test.log("#" * 50) + test.log("Squish path: " + os.environ["SQUISH_PREFIX"]) + test.log("#" * 50 + "\n") + +def main(): + info() + shared.add_attachable_aut() + time.sleep(7) + home = os.path.expanduser("~") + application_folder = "changeuserinterface_2" #folder where application resides + executable = "maintenancetool" #executable without filename extension eg. exe + # abs path to application folder(folder of tested program) + primary_test_install_dir = os.path.join(home, "IfwExamples") + application_folder_path = os.path.join(primary_test_install_dir, application_folder) + application_folder_path = os.path.normpath(os.path.join(os.path.abspath(__file__), os.path.pardir, os.path.pardir, os.path.pardir, application_folder_path)) + # Attempts to start and attach testable application + test.log("Attempting to start and attach AUT") + subprocess_handle = shared.attach_to_aut(application_folder_path, executable) + if not subprocess_handle: + return False + + # Actual beginning for test + test.log("Clicking next button at action selection screen.") + clickButton(waitForObject(":Maintain Change Installer UI Example.__qt__passive_wizardbutton1_QPushButton")) + test.log("Clicking uninstall button at warning screen.") + clickButton(waitForObject(":Maintain Change Installer UI Example.qt_wizard_commit_QPushButton")) + test.log("Clicking Finish button") + clickButton(waitForObject(":Maintain Change Installer UI Example.qt_wizard_finish_QPushButton")) + #win file operations are slow + if sys.platform.startswith("win"): + snooze(5) + else: + snooze(1) + test.verify(not os.path.exists(os.path.join(home,"IfwExamples",application_folder)), "Installation folder successfully removed") + # Makes sure that application under test will not keep running after test. + subprocess_handle.kill() |