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

Charlie Turner charlie.turner at arm.com
Mon Jun 22 05:12:13 PDT 2015


Author: chatur01
Date: Mon Jun 22 07:12:13 2015
New Revision: 240274

URL: http://llvm.org/viewvc/llvm-project?rev=240274&view=rev
Log:
Add --qemu-flags option in addition to --qemu-flag.

Modified:
    lnt/trunk/lnt/tests/nt.py
    lnt/trunk/tests/runtest/nt.py

Modified: lnt/trunk/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/nt.py?rev=240274&r1=240273&r2=240274&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/nt.py (original)
+++ lnt/trunk/lnt/tests/nt.py Mon Jun 22 07:12:13 2015
@@ -136,8 +136,7 @@ class TestConfiguration(object):
 
         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 @@ class TestConfiguration(object):
     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 @@ def _execute_test_again(config, test_nam
     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 @@ class NTTest(builtintest.BuiltinTest):
         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 @@ class NTTest(builtintest.BuiltinTest):
         # 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:

Modified: lnt/trunk/tests/runtest/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/runtest/nt.py?rev=240274&r1=240273&r2=240274&view=diff
==============================================================================
--- lnt/trunk/tests/runtest/nt.py (original)
+++ lnt/trunk/tests/runtest/nt.py Mon Jun 22 07:12:13 2015
@@ -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'





More information about the llvm-commits mailing list