Skip to content

Commit c0317fb

Browse files
committed
twister: handler quotes in extra_args
Escape quotes provided in extra arguments on the command line. example: ... -x "CONFIG_COMPILER_OPT=\"-fanalyzer\"" Fixes #46382 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
1 parent 930f56b commit c0317fb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/pylib/twister/twisterlib/runner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def run_build(self, args=[]):
234234

235235
return results
236236

237-
def run_cmake(self, args=[]):
237+
def run_cmake(self, args=""):
238238

239239
if not self.options.disable_warnings_as_errors:
240240
ldflags = "-Wl,--fatal-warnings"
@@ -257,7 +257,6 @@ def run_cmake(self, args=[]):
257257
f'-G{self.env.generator}'
258258
]
259259

260-
args = ["-D{}".format(a.replace('"', '')) for a in args]
261260
cmake_args.extend(args)
262261

263262
cmake_opts = ['-DBOARD={}'.format(self.platform.name)]
@@ -659,7 +658,6 @@ def cmake(self):
659658

660659
instance = self.instance
661660
args = self.testsuite.extra_args[:]
662-
args += self.options.extra_args
663661

664662
if instance.handler:
665663
args += instance.handler.args
@@ -689,7 +687,9 @@ def extract_overlays(args):
689687
if overlays:
690688
args.append("OVERLAY_CONFIG=\"%s\"" % (" ".join(overlays)))
691689

692-
res = self.run_cmake(args)
690+
args_expanded = ["-D{}".format(a.replace('"', '\"')) for a in self.options.extra_args]
691+
args_expanded = args_expanded + ["-D{}".format(a.replace('"', '')) for a in args]
692+
res = self.run_cmake(args_expanded)
693693
return res
694694

695695
def build(self):

0 commit comments

Comments
 (0)