diff --git a/docs/user_guide/ci.rst b/docs/user_guide/ci.rst index e7b381da3..fea751f6a 100644 --- a/docs/user_guide/ci.rst +++ b/docs/user_guide/ci.rst @@ -56,3 +56,12 @@ Example usage: Additional MPI arguments can be supplied with ``--additional-mpi-args`` when running in ``processes`` mode. + +The ``--counts`` option allows sequential execution of tests with several +thread/process counts. When specified, the script will iterate over the provided +values, updating ``PPC_NUM_THREADS`` or ``PPC_NUM_PROC`` accordingly before each +run. + +Use ``--verbose`` to print every command executed by ``run_tests.py``. This can +be helpful for debugging CI failures or verifying the exact arguments passed to +the test binaries. diff --git a/scripts/run_tests.py b/scripts/run_tests.py index f54a8a6cb..0a11e7b14 100755 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -28,17 +28,23 @@ def init_cmd_args(): type=int, help="List of process/thread counts to run sequentially" ) + parser.add_argument( + "--verbose", + action="store_true", + help="Print commands executed by the script" + ) args = parser.parse_args() _args_dict = vars(args) return _args_dict class PPCRunner: - def __init__(self): + def __init__(self, verbose=False): self.__ppc_num_threads = None self.__ppc_num_proc = None self.__ppc_env = None self.work_dir = None + self.verbose = verbose self.valgrind_cmd = "valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all" @@ -71,6 +77,8 @@ def setup_env(self, ppc_env): self.work_dir = Path(self.__get_project_path()) / "build" / "bin" def __run_exec(self, command): + if self.verbose: + print("Executing:", " ".join(shlex.quote(part) for part in command)) result = subprocess.run(command, shell=False, env=self.__ppc_env) if result.returncode != 0: raise Exception(f"Subprocess return {result.returncode}.") @@ -144,7 +152,7 @@ def run_performance(self): def _execute(args_dict, env): - runner = PPCRunner() + runner = PPCRunner(verbose=args_dict.get("verbose", False)) runner.setup_env(env) if args_dict["running_type"] in ["threads", "processes"]: