@@ -75,7 +75,6 @@ def __init__(self, instance, type_str="build"):
7575 self .run = False
7676 self .type_str = type_str
7777
78- self .binary = None
7978 self .pid_fn = None
8079 self .call_make_run = True
8180
@@ -167,6 +166,19 @@ def _final_handle_actions(self, harness, handler_time):
167166
168167 self .record (harness )
169168
169+ def get_default_domain_build_dir (self ):
170+ if self .instance .testsuite .sysbuild :
171+ # Load domain yaml to get default domain build directory
172+ # Note: for targets using QEMU, we assume that the target will
173+ # have added any additional images to the run target manually
174+ domain_path = os .path .join (self .build_dir , "domains.yaml" )
175+ domains = Domains .from_file (domain_path )
176+ logger .debug ("Loaded sysbuild domain data from %s" % domain_path )
177+ build_dir = domains .get_default_domain ().build_dir
178+ else :
179+ build_dir = self .build_dir
180+ return build_dir
181+
170182
171183class BinaryHandler (Handler ):
172184 def __init__ (self , instance , type_str ):
@@ -239,7 +251,8 @@ def _create_command(self, robot_test):
239251 elif self .call_make_run :
240252 command = [self .generator_cmd , "run" ]
241253 else :
242- command = [self .binary ]
254+ binary = os .path .join (self .get_default_domain_build_dir (), "zephyr" , "zephyr.exe" )
255+ command = [binary ]
243256
244257 if self .options .enable_valgrind :
245258 command = ["valgrind" , "--error-exitcode=2" ,
@@ -344,7 +357,6 @@ def __init__(self, instance, type_str):
344357 self .pid_fn = os .path .join (instance .build_dir , "renode.pid" )
345358 elif type_str == 'native' :
346359 self .call_make_run = False
347- self .binary = os .path .join (instance .build_dir , "zephyr" , "zephyr.exe" )
348360 self .ready = True
349361
350362
@@ -949,20 +961,6 @@ def _thread(handler, timeout, outdir, logfile, fifo_fn, pid_fn,
949961
950962 QEMUHandler ._thread_close_files (fifo_in , fifo_out , pid , out_fp , in_fp , log_out_fp )
951963
952- def _get_sysbuild_build_dir (self ):
953- if self .instance .testsuite .sysbuild :
954- # Load domain yaml to get default domain build directory
955- # Note: for targets using QEMU, we assume that the target will
956- # have added any additional images to the run target manually
957- domain_path = os .path .join (self .build_dir , "domains.yaml" )
958- domains = Domains .from_file (domain_path )
959- logger .debug ("Loaded sysbuild domain data from %s" % domain_path )
960- build_dir = domains .get_default_domain ().build_dir
961- else :
962- build_dir = self .build_dir
963-
964- return build_dir
965-
966964 def _set_qemu_filenames (self , sysbuild_build_dir ):
967965 # We pass this to QEMU which looks for fifos with .in and .out suffixes.
968966 # QEMU fifo will use main build dir
@@ -994,11 +992,11 @@ def _update_instance_info(self, harness_state, is_timeout):
994992 def handle (self , harness ):
995993 self .run = True
996994
997- sysbuild_build_dir = self ._get_sysbuild_build_dir ()
995+ domain_build_dir = self .get_default_domain_build_dir ()
998996
999- command = self ._create_command (sysbuild_build_dir )
997+ command = self ._create_command (domain_build_dir )
1000998
1001- self ._set_qemu_filenames (sysbuild_build_dir )
999+ self ._set_qemu_filenames (domain_build_dir )
10021000
10031001 self .thread = threading .Thread (name = self .name , target = QEMUHandler ._thread ,
10041002 args = (self , self .get_test_timeout (), self .build_dir ,
@@ -1138,20 +1136,6 @@ def _monitor_update_instance_info(handler, handler_time, out_state):
11381136 handler .instance .status = out_state
11391137 handler .instance .reason = "Unknown"
11401138
1141- def _get_sysbuild_build_dir (self ):
1142- if self .instance .testsuite .sysbuild :
1143- # Load domain yaml to get default domain build directory
1144- # Note: for targets using QEMU, we assume that the target will
1145- # have added any additional images to the run target manually
1146- domain_path = os .path .join (self .build_dir , "domains.yaml" )
1147- domains = Domains .from_file (domain_path )
1148- logger .debug ("Loaded sysbuild domain data from %s" % domain_path )
1149- build_dir = domains .get_default_domain ().build_dir
1150- else :
1151- build_dir = self .build_dir
1152-
1153- return build_dir
1154-
11551139 def _set_qemu_filenames (self , sysbuild_build_dir ):
11561140 # PID file will be created in the main sysbuild app's build dir
11571141 self .pid_fn = os .path .join (sysbuild_build_dir , "qemu.pid" )
@@ -1291,9 +1275,9 @@ def _monitor_output(self, queue, timeout, logfile, pid_fn, harness, ignore_unexp
12911275 def handle (self , harness ):
12921276 self .run = True
12931277
1294- sysbuild_build_dir = self ._get_sysbuild_build_dir ()
1295- command = self ._create_command (sysbuild_build_dir )
1296- self ._set_qemu_filenames (sysbuild_build_dir )
1278+ domain_build_dir = self .get_default_domain_build_dir ()
1279+ command = self ._create_command (domain_build_dir )
1280+ self ._set_qemu_filenames (domain_build_dir )
12971281
12981282 logger .debug ("Running %s (%s)" % (self .name , self .type_str ))
12991283 is_timeout = False
0 commit comments