[cfe-dev] RFC: Clang test runner changes

Eli Friedman eli.friedman at gmail.com
Thu Jul 30 21:13:06 PDT 2009


On Thu, Jul 30, 2009 at 8:37 PM, Daniel Dunbar<daniel at zuster.org> wrote:
>> I was just experimenting a bit with
>> not creating .script files, and somehow reading the commands from
>> stdin changes the relevant behavior.  (The other issue with reading
>> the commands from stdin is that it appears to trigger some sort of
>> thread safety bug, but that isn't really relevant if you're planning
>> on rewriting the code.)
>
> I'm not exactly sure what problem you are referring to, but yeah
> perhaps not worth worrying about until things change to not using
> /bin/sh.

Okay... if you're interested anyway, I've attached the patch.

-Eli
-------------- next part --------------
Index: test/TestRunner.py
===================================================================
--- test/TestRunner.py	(revision 77622)
+++ test/TestRunner.py	(working copy)
@@ -59,18 +59,15 @@
 
 def executeScript(script, commands, cwd, useValgrind):
     # Write script file
-    f = open(script,'w')
     if kSystemName == 'Windows':
-        f.write('\nif %ERRORLEVEL% NEQ 0 EXIT\n'.join(commands))
+        joinedString = '\nif %ERRORLEVEL% NEQ 0 EXIT\n'.join(commands) + '\n'
     else:
-        f.write(' &&\n'.join(commands))
-    f.write('\n')
-    f.close()
+        joinedString = ' &&\n'.join(commands) + '\n'
 
     if kSystemName == 'Windows':
-        command = ['cmd','/c', script]
+        command = ['cmd']
     else:
-        command = ['/bin/sh', script]
+        command = ['/bin/sh']
         if useValgrind:
             # FIXME: Running valgrind on sh is overkill. We probably could just
             # ron on clang with no real loss.
@@ -83,7 +80,7 @@
                          stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
                          env=kChildEnv)
-    out,err = p.communicate()
+    out,err = p.communicate(joinedString)
     exitCode = p.wait()
 
     # Detect Ctrl-C in subprocess.


More information about the cfe-dev mailing list