PR10867. lit would interpret
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 5 Dec 2012 22:54:26 +0000 (22:54 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 5 Dec 2012 22:54:26 +0000 (22:54 +0000)
  RUN: a
  RUN: b || true

as "a && (b || true)" in Tcl mode, and as "(a && b) || true" in sh mode.
Everyone seems to (quite reasonably) write tests assuming the Tcl behavior,
so use that in sh mode too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169441 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-lit/chain.c [new file with mode: 0644]
utils/lit/lit/TestRunner.py

diff --git a/test/tools/llvm-lit/chain.c b/test/tools/llvm-lit/chain.c
new file mode 100644 (file)
index 0000000..6f6541d
--- /dev/null
@@ -0,0 +1,9 @@
+// This test should fail. lit used to interpret this as:
+//   (false && false) || true
+// instead of the intended
+//   false && (false || true
+//
+// RUN: false
+// RUN: false || true
+//
+// XFAIL: *
index e339652f834295100eedfe3cf9eb0f2b8732089e..fa4880a593a6c891eb861a6b3f855a5c021b2d8f 100644 (file)
@@ -241,11 +241,16 @@ def executeShCmd(cmd, cfg, cwd, results):
     return exitCode
 
 def executeScriptInternal(test, litConfig, tmpBase, commands, cwd):
-    ln = ' &&\n'.join(commands)
-    try:
-        cmd = ShUtil.ShParser(ln, litConfig.isWindows).parse()
-    except:
-        return (Test.FAIL, "shell parser error on: %r" % ln)
+    cmds = []
+    for ln in commands:
+        try:
+            cmds.append(ShUtil.ShParser(ln, litConfig.isWindows).parse())
+        except:
+            return (Test.FAIL, "shell parser error on: %r" % ln)
+
+    cmd = cmds[0]
+    for c in cmds[1:]:
+        cmd = ShUtil.Seq(cmd, '&&', c)
 
     results = []
     try: