[PATCH] [LNT] Add --qemu-flags option in addition to --qemu-flag

Charlie Turner charlie.turner at arm.com
Thu Jun 11 05:14:31 PDT 2015


Hi jmolloy, kristof.beyls, cmatthews, vkalintiris,

In a similar way to the cflag changes in D10364, add --qemu-flags.
Also refactored the unix argument quoting stuff into its own function.

http://reviews.llvm.org/D10383

Files:
  lnt/tests/nt.py
  tests/runtest/nt.py

Index: lnt/tests/nt.py
===================================================================
--- lnt/tests/nt.py
+++ lnt/tests/nt.py
@@ -136,8 +136,7 @@
 
         if self.cflag_string:
             # FIXME: This isn't generally OK on Windows :/
-            safely_quoted_on_unix = map(pipes.quote, shlex.split(self.cflag_string))
-            target_flags.extend(safely_quoted_on_unix)
+            target_flags.extend(_unix_quote_args(self.cflag_string))
 
         # Pass flags to backend.
         for f in self.mllvm:
@@ -185,7 +184,10 @@
     def qemu_user_mode_command(self):
         """ The command used for qemu user mode """
         assert self.qemu_user_mode
-        return ' '.join([self.qemu_user_mode] + self.qemu_flags)
+        qemu_cmd_line = [self.qemu_user_mode] + self.qemu_flags
+        if self.qemu_string:
+            qemu_cmd_line += _unix_quote_args(self.qemu_string)
+        return ' '.join(qemu_cmd_line)
 
     @property
     def generate_report_script(self):
@@ -1208,6 +1210,8 @@
     assert len(results) > 0
     return results
 
+def _unix_quote_args(s):
+    return map(pipes.quote, shlex.split(s))
 
 # When set to true, all benchmarks will be rerun.
 # TODO: remove me when rerun patch is done.
@@ -1634,6 +1638,11 @@
         group.add_option("", "--qemu-flag", dest="qemu_flags",
                          help="Additional flags to pass to qemu",
                          action="append", type=str, default=[], metavar="FLAG")
+        group.add_option("", "--qemu-flags", dest="qemu_string",
+                         help="Additional flags to pass to qemu, space separated string. "
+                         "These flags are appended after *all* the individual "
+                         "--qemu-flag arguments.",
+                         type=str, default='', metavar="FLAG")
 
         group.add_option("", "--multisample", dest="multisample",
                          help="Accumulate test data from multiple runs",
@@ -1840,7 +1849,11 @@
         # test-suite directory, that borks things. <rdar://problem/7876418>
         prepare_report_dir(config)
 
+        # These notes are used by the regression tests to check if we've handled
+        # flags correctly.
         note('TARGET_FLAGS: {}'.format(' '.join(config.target_flags)))
+        if config.qemu_user_mode:
+            note('QEMU_USER_MODE_COMMAND: {}'.format(config.qemu_user_mode_command))
 
         # Multisample, if requested.
         if opts.multisample is not None:
Index: tests/runtest/nt.py
===================================================================
--- tests/runtest/nt.py
+++ tests/runtest/nt.py
@@ -124,3 +124,16 @@
 # RUN: FileCheck --check-prefix CHECK-CFLAG5 < %t.err %s
 # CHECK-CFLAG5: inferred C++ compiler under test
 # CHECK-CFLAG5: TARGET_FLAGS: --target=armv7a-none-eabi -Weverything -Wall '-test=escaped space' '-some-option=stay with me' -O3
+
+# Qemu flag handling
+# RUN: lnt runtest nt \
+# RUN:   --sandbox %t.SANDBOX \
+# RUN:   --test-suite %S/Inputs/test-suite \
+# RUN:   --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN:   --qemu-user-mode TEST \
+# RUN:   --qemu-flag '-soundhw gus' \
+# RUN:   --qemu-flag '-net nic' \
+# RUN:   --qemu-flags '-device gus,irq=5 -test=escaped\ space -some-option="stay with me"' \
+# RUN:   --no-timestamp > %t.log 2> %t.err
+# RUN: FileCheck --check-prefix CHECK-QEMU-FLAG1 < %t.err %s
+# CHECK-QEMU-FLAG1: QEMU_USER_MODE_COMMAND: TEST -soundhw gus -net nic -device gus,irq=5 '-test=escaped space' '-some-option=stay with me'

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10383.27495.patch
Type: text/x-patch
Size: 3531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150611/a371266e/attachment.bin>


More information about the llvm-commits mailing list