From 2942a14ac0542382c18b04646948207a44f188a3 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Wed, 27 Jul 2022 20:23:04 -0300 Subject: [PATCH] build: build scratches with multiple threads in test-ns3.py test case --- utils/tests/test-ns3.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/tests/test-ns3.py b/utils/tests/test-ns3.py index a9d30fea6..9c868febb 100644 --- a/utils/tests/test-ns3.py +++ b/utils/tests/test-ns3.py @@ -43,9 +43,10 @@ usual_lib_outdir = os.sep.join([usual_outdir, "lib"]) os.chdir(ns3_path) # Cmake commands +num_threads = max(1, os.cpu_count() - 1) cmake_build_project_command = "cmake --build . -j".format(ns3_path=ns3_path) cmake_build_target_command = partial("cmake --build . -j {jobs} --target {target}".format, - jobs=max(1, os.cpu_count() - 1) + jobs=num_threads ) @@ -1111,8 +1112,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Try to build them with ns3 and cmake for path in test_files+backup_files: path = path.replace(".cc", "") - return_code1, stdout1, stderr1 = run_program("cmake", "--build . --target %s" - % path.replace("/", "_"), + return_code1, stdout1, stderr1 = run_program("cmake", "--build . --target %s -j %d" + % (path.replace("/", "_"), num_threads), cwd=os.path.join(ns3_path, "cmake-cache")) return_code2, stdout2, stderr2 = run_ns3("build %s" % path) if "main" in path and ".main" not in path: