[LNT] r239518 - [LNT] Add cflags string argument to LNT.

Charlie Turner charlie.turner at arm.com
Thu Jun 11 02:38:51 PDT 2015


Author: chatur01
Date: Thu Jun 11 04:38:50 2015
New Revision: 239518

URL: http://llvm.org/viewvc/llvm-project?rev=239518&view=rev
Log:
[LNT] Add cflags string argument to LNT.

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=239518&r1=239517&r2=239518&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/nt.py (original)
+++ lnt/trunk/lnt/tests/nt.py Thu Jun 11 04:38:50 2015
@@ -11,6 +11,8 @@ import traceback
 from datetime import datetime
 from optparse import OptionParser, OptionGroup
 import urllib2
+import shlex
+import pipes
 
 import lnt.testing
 import lnt.testing.util.compilers
@@ -132,6 +134,11 @@ class TestConfiguration(object):
         # FIXME: Eliminate this blanket option.
         target_flags.extend(self.cflags)
 
+        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)
+
         # Pass flags to backend.
         for f in self.mllvm:
             target_flags.extend(['-mllvm', f])
@@ -1510,6 +1517,10 @@ class NTTest(builtintest.BuiltinTest):
         group.add_option("", "--cflag", dest="cflags",
                          help="Additional flags to set in TARGET_FLAGS",
                          action="append", type=str, default=[], metavar="FLAG")
+        group.add_option("", "--cflags", dest="cflag_string",
+                         help="Additional flags to set in TARGET_FLAGS, space separated string. "
+                         "These flags are appended after *all* the individual --cflag arguments.",
+                         type=str, default='', metavar="FLAG")
         group.add_option("", "--mllvm", dest="mllvm",
                          help="Add -mllvm FLAG to TARGET_FLAGS",
                          action="append", type=str, default=[], metavar="FLAG")
@@ -1829,6 +1840,8 @@ class NTTest(builtintest.BuiltinTest):
         # test-suite directory, that borks things. <rdar://problem/7876418>
         prepare_report_dir(config)
 
+        note('TARGET_FLAGS: {}'.format(' '.join(config.target_flags)))
+
         # Multisample, if requested.
         if opts.multisample is not None:
             # Collect the sample reports.

Modified: lnt/trunk/tests/runtest/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/runtest/nt.py?rev=239518&r1=239517&r2=239518&view=diff
==============================================================================
--- lnt/trunk/tests/runtest/nt.py (original)
+++ lnt/trunk/tests/runtest/nt.py Thu Jun 11 04:38:50 2015
@@ -63,3 +63,64 @@
 # RUN:   --test-suite %S/Inputs/test-suite \
 # RUN:   --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
 # RUN:   --no-timestamp --without-llvm > %t.log 2> %t.err
+
+# Check cflag handling
+
+## With a lone cflag
+# RUN: lnt runtest nt \
+# RUN:   --sandbox %t.SANDBOX \
+# RUN:   --test-suite %S/Inputs/test-suite \
+# RUN:   --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN:   --cflag '-Wall' \
+# RUN:   --no-timestamp > %t.log 2> %t.err
+# RUN: FileCheck --check-prefix CHECK-CFLAG1 < %t.err %s
+# CHECK-CFLAG1: inferred C++ compiler under test
+# CHECK-CFLAG1: TARGET_FLAGS: -Wall
+
+## With a couple of cflags
+# RUN: lnt runtest nt \
+# RUN:   --sandbox %t.SANDBOX \
+# RUN:   --test-suite %S/Inputs/test-suite \
+# RUN:   --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN:   --cflag '-Wall' \
+# RUN:   --cflag '-mfloat-abi=hard' \
+# RUN:   --cflag '-O3' \
+# RUN:   --no-timestamp > %t.log 2> %t.err
+# RUN: FileCheck --check-prefix CHECK-CFLAG2 < %t.err %s
+# CHECK-CFLAG2: inferred C++ compiler under test
+# CHECK-CFLAG2: TARGET_FLAGS: -Wall -mfloat-abi=hard -O3
+
+## With a cflags
+# RUN: lnt runtest nt \
+# RUN:   --sandbox %t.SANDBOX \
+# RUN:   --test-suite %S/Inputs/test-suite \
+# RUN:   --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN:   --cflags '-Wall -mfloat-abi=hard -O3' \
+# RUN:   --no-timestamp > %t.log 2> %t.err
+# RUN: FileCheck --check-prefix CHECK-CFLAG3 < %t.err %s
+# CHECK-CFLAG3: inferred C++ compiler under test
+# CHECK-CFLAG3: TARGET_FLAGS: -Wall -mfloat-abi=hard -O3
+
+## With a cflags with a quoted space and escaped spaces
+# RUN: lnt runtest nt \
+# RUN:   --sandbox %t.SANDBOX \
+# RUN:   --test-suite %S/Inputs/test-suite \
+# RUN:   --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN:   --cflags "-Wall -test=escaped\ space -some-option='stay with me' -O3" \
+# RUN:   --no-timestamp > %t.log 2> %t.err
+# RUN: FileCheck --check-prefix CHECK-CFLAG4 < %t.err %s
+# CHECK-CFLAG4: inferred C++ compiler under test
+# CHECK-CFLAG4: TARGET_FLAGS: -Wall '-test=escaped space' '-some-option=stay with me' -O3
+
+## With cflag and cflags
+# RUN: lnt runtest nt \
+# RUN:   --sandbox %t.SANDBOX \
+# RUN:   --test-suite %S/Inputs/test-suite \
+# RUN:   --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN:   --cflag '--target=armv7a-none-eabi' \
+# RUN:   --cflag '-Weverything' \
+# RUN:   --cflags '-Wall -test=escaped\ space -some-option="stay with me" -O3' \
+# RUN:   --no-timestamp > %t.log 2> %t.err
+# 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





More information about the llvm-commits mailing list