From 69c87b0914ee8cfb0b11546f13fd33bd5197c145 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 5 Dec 2012 22:54:26 +0000 Subject: [PATCH] PR10867. lit would interpret 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. llvm-svn: 169441 --- llvm/test/tools/llvm-lit/chain.c | 9 +++++++++ llvm/utils/lit/lit/TestRunner.py | 15 ++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 llvm/test/tools/llvm-lit/chain.c diff --git a/llvm/test/tools/llvm-lit/chain.c b/llvm/test/tools/llvm-lit/chain.c new file mode 100644 index 000000000000..6f6541d2e46a --- /dev/null +++ b/llvm/test/tools/llvm-lit/chain.c @@ -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: * diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index e339652f8342..fa4880a593a6 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -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: