Warning, file /plasma/plasma-workspace/libtaskmanager/autotests/waylandtasksmodeltestwrapper.py was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #!/usr/bin/env python3
0002 
0003 # SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
0004 # SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 
0006 import os
0007 import subprocess
0008 import sys
0009 import time
0010 
0011 if __name__ == '__main__':
0012     assert len(sys.argv) >= 2, f"Missing waylandtasksmodeltest argument {len(sys.argv)}"
0013     test_executable_path: str = sys.argv.pop()
0014 
0015     environ = os.environ.copy()
0016     environ["KWIN_WAYLAND_NO_PERMISSION_CHECKS"] = "1"
0017     kwin_process = subprocess.Popen(["kwin_wayland", "--no-lockscreen", "--no-global-shortcuts", "--no-kactivities"], env = environ)
0018     assert kwin_process.poll() is None
0019 
0020     time.sleep(10)
0021 
0022     test_environ = os.environ.copy()
0023     test_environ["QT_QPA_PLATFORM"] = "wayland"
0024     if os.path.exists(test_executable_path):
0025         test_process = subprocess.Popen([test_executable_path], env = test_environ)
0026     elif "KDECI_BUILD" in os.environ:
0027         test_process = subprocess.Popen(["waylandtasksmodeltest"], env = test_environ) # Find in CMAKE_PREFIX_PATH
0028     assert test_process.poll() is None
0029 
0030     result: int = 1
0031     try:
0032         result = test_process.wait(timeout=60)
0033     except subprocess.TimeoutExpired as e:
0034         print("Timeout", e)
0035     finally:
0036         kwin_process.terminate()
0037 
0038     sys.exit(result)