From b340b8697542e4b62393f203068ecc140c221b98 Mon Sep 17 00:00:00 2001 From: Joel Stanley Date: Mon, 14 Nov 2022 22:01:25 +1030 Subject: [PATCH] test_cpu: Set number of verilator jobs By default verilator will be built with -j with no arguments, spawning many processors. This causes large designs to failure in CI (probably due to exhausting the memory of the build box): Error: Process completed with exit code 143. Set the number of jobs to the number of CPUs in the system. This allows designs such as Microwatt to build in CI. Signed-off-by: Joel Stanley --- test/test_cpu.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/test_cpu.py b/test/test_cpu.py index 5860eeebc..43a8a56e7 100644 --- a/test/test_cpu.py +++ b/test/test_cpu.py @@ -7,10 +7,11 @@ import unittest import pexpect import sys +import os class TestCPU(unittest.TestCase): - def boot_test(self, cpu_type, cpu_variant="standard"): - cmd = f'litex_sim --cpu-type={cpu_type} --cpu-variant={cpu_variant} --opt-level=O0' + def boot_test(self, cpu_type, jobs, cpu_variant="standard"): + cmd = f'litex_sim --cpu-type={cpu_type} --cpu-variant={cpu_variant} --opt-level=O0 --jobs {jobs}' litex_prompt = [b'\033\[[0-9;]+mlitex\033\[[0-9;]+m>'] is_success = True with open("/tmp/test_boot_log", "wb") as result_file: @@ -65,6 +66,7 @@ class TestCPU(unittest.TestCase): "zynq7000", # (arm / hardcore) -> Hardcore. "zynqmp", # (aarch64 / hardcore) -> Hardcore. ] + jobs = os.cpu_count() for cpu in tested_cpus: with self.subTest(target=cpu): - self.assertTrue(self.boot_test(cpu)) + self.assertTrue(self.boot_test(cpu, jobs))