[LLVMbugs] [Bug 16743] New: Other/pipefail.txt fails when using a timeout command prefix

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 29 18:16:09 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16743

            Bug ID: 16743
           Summary: Other/pipefail.txt fails when using a timeout command
                    prefix
           Product: new-bugs
           Version: trunk
          Hardware: All
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: fang at csl.cornell.edu
                CC: llvmbugs at cs.uiuc.edu, rafael.espindola at gmail.com
    Classification: Unclassified

On darwin8, /bin/sh shell is an old bash-2.0 (pre-pipefail), so I run with the
following patch to use a newer bash (4.0):

diff --git a/utils/lit/lit/LitConfig.py b/utils/lit/lit/LitConfig.py
index 9bcf20b..f2003eb 100644
--- a/utils/lit/lit/LitConfig.py
+++ b/utils/lit/lit/LitConfig.py
@@ -34,7 +34,8 @@ class LitConfig:
         self.debug = debug
         self.isWindows = bool(isWindows)
         self.params = dict(params)
-        self.bashPath = None
+       # local hack only, don't commit this patch
+        self.bashPath = '/sw/bin/bash'

         # Configuration files to look for when discovering test suites.
         self.config_prefix = config_prefix or 'lit'
diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py
index daa9b7d..a9d8df5 100644
--- a/utils/lit/lit/TestRunner.py
+++ b/utils/lit/lit/TestRunner.py
@@ -389,7 +389,8 @@ def parseIntegratedTestScript(test,
normalize_slashes=False,
             if script and script[-1][-1] == '\\':
                 script[-1] = script[-1][:-1] + ln
             else:
-                script.append(ln)
+                script.append('gtimeout 5m ' +ln)
+               # do not commit this patch
         elif 'XFAIL:' in ln:
             items = ln[ln.index('XFAIL:') + 6:].split(',')
             xfails.extend([s.strip() for s in items])


However, the new pipefail.txt test fails:


FAIL: LLVM :: Other/pipefail.txt (5725 of 8411)
******************** TEST 'LLVM :: Other/pipefail.txt' FAILED
******************
**
Script:
--
gtimeout 5m  ((false | true) && echo true || echo false) | grep false
--
Exit Code: 2
Command Output (stderr):
--
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/test/Other/Output/pipefail.txt.script:
line 1: syntax error near unexpected token `('
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/test/Other/Output/pipefail.txt.script:
line 1: `set -o pipefail;{ gtimeout 5m  ((false | true) && echo true || echo
false) | grep false; }'
--

********************

Proof that /sw/bin/bash works:
bash-4.2$ set -o pipefail
bash-4.2$ ((false | true) && echo true || echo false) | grep false
false
bash-4.2$ echo $?
0

But, if I paste the failing command into bash:

bash-4.2$ set -o pipefail;{ gtimeout 5m  ((false | true) && echo true || echo
false) | grep false; }
bash: syntax error near unexpected token `('
bash-4.2$ echo $?
2

If I remove the gtimeout prefix, it works again.

bash-4.2$ set -o pipefail;{ ((false | true) && echo true || echo false) | grep
false; }
false
bash-4.2$ echo $?
0

(I use timeout b/c a long time ago, some tests would hang, and only get caught
by timeout.  Not so anymore.)
Is there a trivial syntactic change to this test that would allow a timeout
prefix to work?
Maybe I need to make an exception for prepending timeout when the command
begins with any grouping operator like '('?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130730/8239e988/attachment.html>


More information about the llvm-bugs mailing list