[commit: ghc] master: testsuite driver: don't append to existing output files (35a5b60)

git at git.haskell.org git at git.haskell.org
Tue Jan 10 20:28:05 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/35a5b60390f2a400d06a2209eb03b7fd6ccffdab/ghc

>---------------------------------------------------------------

commit 35a5b60390f2a400d06a2209eb03b7fd6ccffdab
Author: Reid Barton <rwbarton at gmail.com>
Date:   Tue Jan 10 14:29:11 2017 -0500

    testsuite driver: don't append to existing output files
    
    If you happen to have a T1234.run.stdout file lying aroud (probably
    from before the move to running tests in temporary subdirectories)
    it gets symlinked into the T1234.run directory since its name starts
    with T1234; and then program output gets appended to the existing
    file (through the symlink). We should open the file for writing
    instead, to replace the symlink with a new file.
    
    Test Plan: tested locally, + harbormaster
    
    Reviewers: austin, Phyx, bgamari
    
    Reviewed By: Phyx, bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2946


>---------------------------------------------------------------

35a5b60390f2a400d06a2209eb03b7fd6ccffdab
 testsuite/driver/testlib.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index f6729ac..c0135f0 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1801,11 +1801,11 @@ def runCmd(cmd, stdin=None, stdout=None, stderr=None, timeout_multiplier=1.0, pr
                 sys.stderr.buffer.write(stderr_buffer)
 
         if stdout:
-            with io.open(stdout, 'ab') as f:
+            with io.open(stdout, 'wb') as f:
                 f.write(stdout_buffer)
         if stderr:
             if stderr is not subprocess.STDOUT:
-                with io.open(stderr, 'ab') as f:
+                with io.open(stderr, 'wb') as f:
                     f.write(stderr_buffer)
 
     if r.returncode == 98:



More information about the ghc-commits mailing list