Skip to content

Commit 6b3fa6d

Browse files
committed
fix linux
1 parent a021153 commit 6b3fa6d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

scripts/run_tests.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def get_project_path():
3131

3232

3333
def source_script(script_path):
34-
command = f"source {script_path} && env"
35-
result = subprocess.run(command, shell=True, capture_output=True, text=True)
34+
command = f"bash -c 'source {script_path} && env'"
35+
result = subprocess.run(command, stdout=subprocess.PIPE, shell=True, text=True)
3636
if result.returncode == 0:
3737
# Parse the output environment variables
3838
env_vars = {}
@@ -65,9 +65,9 @@ def run_exec_file(command):
6565
raise Exception(f"Subprocess return {result.returncode}.")
6666

6767

68-
def get_common_gtest_settings():
68+
def get_common_gtest_settings(repeats_count):
6969
command = "--gtest_also_run_disabled_tests "
70-
command += "--gtest_repeat=10 "
70+
command += f"--gtest_repeat={repeats_count} "
7171
command += "--gtest_recreate_environments_when_repeating "
7272
command += "--gtest_color=0 "
7373
return command
@@ -78,14 +78,14 @@ def run_threads():
7878

7979

8080
def run_common(install_bin_dir):
81-
valgrind_settings = "--error-exitcode=1 --leak-check=full --show-leak-kinds=all"
81+
valgrind_running = "valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all"
8282

8383
if platform.system() == "Linux" and not os.environ.get("ASAN_RUN"):
84-
run_exec_file(f"valgrind {valgrind_settings} {Path(install_bin_dir) / 'core_func_tests'}")
85-
run_exec_file(f"valgrind {valgrind_settings} {Path(install_bin_dir) / 'ref_func_tests'}")
84+
run_exec_file(f"{valgrind_running} {Path(install_bin_dir) / 'core_func_tests'} {get_common_gtest_settings(1)}")
85+
run_exec_file(f"{valgrind_running} {Path(install_bin_dir) / 'ref_func_tests'} {get_common_gtest_settings(1)}")
8686

87-
run_exec_file(f"{Path(install_bin_dir) / 'core_func_tests'} {get_common_gtest_settings()}")
88-
run_exec_file(f"{Path(install_bin_dir) / 'ref_func_tests'} {get_common_gtest_settings()}")
87+
run_exec_file(f"{Path(install_bin_dir) / 'core_func_tests'} {get_common_gtest_settings(10)}")
88+
run_exec_file(f"{Path(install_bin_dir) / 'ref_func_tests'} {get_common_gtest_settings(10)}")
8989

9090

9191
def run_processes(install_bin_dir, additional_mpi_args):
@@ -95,8 +95,8 @@ def run_processes(install_bin_dir, additional_mpi_args):
9595

9696
mpi_running = f"mpirun {additional_mpi_args} -np {proc_count}"
9797
if not os.environ.get("ASAN_RUN"):
98-
run_exec_file(f"{mpi_running} {Path(install_bin_dir) / 'all_func_tests'} {get_common_gtest_settings()}")
99-
run_exec_file(f"{mpi_running} {Path(install_bin_dir) / 'mpi_func_tests'} {get_common_gtest_settings()}")
98+
run_exec_file(f"{mpi_running} {Path(install_bin_dir) / 'all_func_tests'} {get_common_gtest_settings(10)}")
99+
run_exec_file(f"{mpi_running} {Path(install_bin_dir) / 'mpi_func_tests'} {get_common_gtest_settings(10)}")
100100

101101

102102
if __name__ == "__main__":

0 commit comments

Comments
 (0)