File indexing completed on 2024-05-12 05:38:09

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 
0010 if __name__ == '__main__':
0011     assert len(sys.argv) >= 2, f"Missing waylandtasksmodeltest argument {len(sys.argv)}"
0012     test_executable_path: str = sys.argv.pop()
0013 
0014     environ = os.environ.copy()
0015     environ["KWIN_WAYLAND_NO_PERMISSION_CHECKS"] = "1"
0016     kwin_process = subprocess.Popen(["kwin_wayland", "--virtual", "--no-lockscreen", "--no-global-shortcuts", "--no-kactivities", "--xwayland", "--exit-with-session", test_executable_path], env=environ)
0017 
0018     result: int = 1
0019     try:
0020         result = kwin_process.wait(timeout=60)
0021     except subprocess.TimeoutExpired as e:
0022         print("Timeout", e)
0023     finally:
0024         kwin_process.terminate()
0025 
0026     sys.exit(result)