66import re
77import shutil
88import subprocess
9+ import sys
910from dataclasses import dataclass
1011from pathlib import Path
1112from typing import List , Literal , Optional , Tuple
@@ -132,10 +133,10 @@ def generate_network(config: DeeployTestConfig, skip: bool = False) -> None:
132133
133134 log .debug (f"[pytestRunner] Generation command: { ' ' .join (cmd )} " )
134135
135- result = subprocess .run (cmd , capture_output = True , text = True )
136+ result = subprocess .run (cmd , check = False )
136137
137138 if result .returncode != 0 :
138- log .error (f"Network generation failed: \n STDOUT: \n { result .stdout } \n STDERR: \n { result . stderr } " )
139+ log .error (f"Network generation failed with return code { result .returncode } " )
139140 raise RuntimeError (f"Network generation failed for { config .test_name } " )
140141
141142
@@ -192,10 +193,10 @@ def configure_cmake(config: DeeployTestConfig) -> None:
192193
193194 log .debug (f"[pytestRunner] CMake command: { ' ' .join (cmd )} " )
194195
195- result = subprocess .run (cmd , capture_output = True , text = True , env = env )
196+ result = subprocess .run (cmd , check = False , env = env )
196197
197198 if result .returncode != 0 :
198- log .error (f"CMake configuration failed: \n STDOUT: \n { result .stdout } \n STDERR: \n { result . stderr } " )
199+ log .error (f"CMake configuration failed with return code { result .returncode } " )
199200 raise RuntimeError (f"CMake configuration failed for { config .test_name } " )
200201
201202
@@ -223,10 +224,10 @@ def build_binary(config: DeeployTestConfig) -> None:
223224
224225 log .debug (f"[pytestRunner] Build command: { ' ' .join (cmd )} " )
225226
226- result = subprocess .run (cmd , capture_output = True , text = True , env = env )
227+ result = subprocess .run (cmd , check = False , env = env )
227228
228229 if result .returncode != 0 :
229- log .error (f"Build failed: \n STDOUT: \n { result .stdout } \n STDERR: \n { result . stderr } " )
230+ log .error (f"Build failed with return code { result .returncode } " )
230231 raise RuntimeError (f"Build failed for { config .test_name } " )
231232
232233
@@ -281,6 +282,12 @@ def run_simulation(config: DeeployTestConfig, skip: bool = False) -> TestResult:
281282
282283 result = subprocess .run (cmd , capture_output = True , text = True , env = env )
283284
285+ # Print captured output so it's visible when running with pytest -s
286+ if result .stdout :
287+ print (result .stdout , end = '' )
288+ if result .stderr :
289+ print (result .stderr , end = '' , file = sys .stderr )
290+
284291 # Parse output for error count
285292 output = result .stdout + result .stderr
286293
@@ -362,19 +369,39 @@ def create_test_config(
362369 toolchain_dir : Optional [str ],
363370 cmake_args : List [str ],
364371 tiling : bool = False ,
372+ cores : Optional [int ] = None ,
373+ l1 : Optional [int ] = None ,
374+ l2 : int = 1024000 ,
375+ default_mem_level : str = "L2" ,
376+ double_buffer : bool = False ,
377+ mem_alloc_strategy : str = "MiniMalloc" ,
378+ search_strategy : str = "random-max" ,
379+ profile_tiling : bool = False ,
380+ plot_mem_alloc : bool = False ,
381+ randomized_mem_scheduler : bool = False ,
365382) -> DeeployTestConfig :
366383 """
367384 Create DeeployTestConfig for a specific test and platform.
368385
369386 Args:
370387 test_name: Name of the test
371- platform: Target platform (e.g., "Generic", "QEMU-ARM")
388+ platform: Target platform (e.g., "Generic", "QEMU-ARM", "Siracusa" )
372389 simulator: Simulator to use
373390 deeploy_test_dir: Base DeeployTest directory
374391 toolchain: Toolchain to use - LLVM/GCC
375392 toolchain_dir: Path to toolchain installation
376393 cmake_args: Additional CMake arguments
377394 tiling: Whether to use tiling
395+ cores: Number of cores (for Siracusa platforms)
396+ l1: L1 memory size in bytes (for tiled platforms)
397+ l2: L2 memory size in bytes (default: 1024000)
398+ default_mem_level: Default memory level ("L2" or "L3")
399+ double_buffer: Enable double buffering
400+ mem_alloc_strategy: Memory allocation strategy
401+ search_strategy: CP solver search strategy
402+ profile_tiling: Enable tiling profiling
403+ plot_mem_alloc: Enable memory allocation plotting
404+ randomized_mem_scheduler: Enable randomized memory scheduler
378405
379406 Returns:
380407 DeeployTestConfig instance
@@ -384,7 +411,39 @@ def create_test_config(
384411 gen_dir , test_dir_abs , test_name_clean = get_test_paths (test_dir , platform , base_dir = deeploy_test_dir )
385412
386413 worker_id = get_worker_id ()
387- build_dir = str (Path (deeploy_test_dir ) / f"TEST_{ platform .upper ()} " / f"build_{ worker_id } " )
414+
415+ # VJUNG: Build dir has to be unique for each worker to prevent conflict
416+ build_suffix = Path (gen_dir ).name
417+ build_dir = str (Path (deeploy_test_dir ) / f"TEST_{ platform .upper ()} " / f"build_{ worker_id } _{ build_suffix } " )
418+
419+ cmake_args_list = list (cmake_args ) if cmake_args else []
420+ if cores is not None :
421+ cmake_args_list .append (f"NUM_CORES={ cores } " )
422+
423+ gen_args_list = []
424+
425+ if cores is not None and platform in ["Siracusa" , "Siracusa_w_neureka" ]:
426+ gen_args_list .append (f"--cores={ cores } " )
427+
428+ if tiling :
429+ if l1 is not None :
430+ gen_args_list .append (f"--l1={ l1 } " )
431+ if l2 != 1024000 :
432+ gen_args_list .append (f"--l2={ l2 } " )
433+ if default_mem_level != "L2" :
434+ gen_args_list .append (f"--defaultMemLevel={ default_mem_level } " )
435+ if double_buffer :
436+ gen_args_list .append ("--doublebuffer" )
437+ if mem_alloc_strategy != "MiniMalloc" :
438+ gen_args_list .append (f"--memAllocStrategy={ mem_alloc_strategy } " )
439+ if search_strategy != "random-max" :
440+ gen_args_list .append (f"--searchStrategy={ search_strategy } " )
441+ if profile_tiling :
442+ gen_args_list .append ("--profileTiling" )
443+ if plot_mem_alloc :
444+ gen_args_list .append ("--plotMemAlloc" )
445+ if randomized_mem_scheduler :
446+ gen_args_list .append ("--randomizedMemoryScheduler" )
388447
389448 config = DeeployTestConfig (
390449 test_name = test_name_clean ,
@@ -396,7 +455,8 @@ def create_test_config(
396455 build_dir = build_dir ,
397456 toolchain = toolchain ,
398457 toolchain_install_dir = toolchain_dir ,
399- cmake_args = cmake_args ,
458+ cmake_args = cmake_args_list ,
459+ gen_args = gen_args_list ,
400460 )
401461
402462 return config
0 commit comments