Files
deskflow/scripts/tests.py
Nick Bolton ce3f8869e7 Reduce GUI compile time by building a GUI library (#7412)
* Call ensure_in_venv before all imports

* Create `gui` lib and link to `synergy` and test bins

* Move GUI IPC code to GUI lib

* Improve `AppConfig` members and change `minimizeOnClose` to `closeToTray`

* Group getters and setters

* Add missing `m_CloseToTray` load

* Fixed lint issue

* Add TODO comment for main window integ test

* Remove redundant comments and add override

* Remove dead code

* Update ChangeLog

* Fixed activation related compile errors

* Disable concurrency cancel jobs

* Disable fail-fast for matrix
2024-07-23 20:17:40 +01:00

61 lines
1.5 KiB
Python
Executable File

#!/usr/bin/env python3
import lib.env as env
env.ensure_in_venv(__file__)
import argparse, os, sys
import lib.cmd_utils as cmd_utils
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--unit-tests", action="store_true")
parser.add_argument("--integ-tests", action="store_true")
parser.add_argument(
"--filter-file",
type=str,
help="Takes the base filename without extension and uses it as a filter",
)
parser.add_argument(
"--ignore-return-code",
action="store_true",
help="Ignore the return code of the test command",
)
parser.add_argument(
"--valgrind",
action="store_true",
help="Run the test command with valgrind",
)
args = parser.parse_args()
binary = get_binary_path(args)
if args.filter_file:
file_base = os.path.basename(args.filter_file)
without_ext = os.path.splitext(file_base)[0]
command = [binary, f"--gtest_filter={without_ext}*"]
else:
command = [binary]
if args.valgrind:
command = ["valgrind"] + command
result = cmd_utils.run(command, print_cmd=True, check=False)
if not args.ignore_return_code:
sys.exit(result.returncode)
def get_binary_path(args):
base_dir = "./build/bin"
if args.unit_tests:
return f"{base_dir}/unittests"
elif args.integ_tests:
return f"{base_dir}/integtests"
else:
raise RuntimeError("No test type specified")
if __name__ == "__main__":
main()