Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : master
http://hackage.haskell.org/trac/ghc/changeset/846bc294c5b31cc49f033d08c044974fb9d5aac9 >--------------------------------------------------------------- commit 846bc294c5b31cc49f033d08c044974fb9d5aac9 Author: Simon Marlow <[email protected]> Date: Wed Aug 3 09:33:13 2011 +0100 Fix a framework failure on Windows when accepting output, and allow accepting output when the output file does not exist (it is now created). >--------------------------------------------------------------- driver/testlib.py | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-) diff --git a/driver/testlib.py b/driver/testlib.py index 0728cc3..5b64539 100644 --- a/driver/testlib.py +++ b/driver/testlib.py @@ -1398,9 +1398,10 @@ def compare_outputs( kind, normaliser, extra_normaliser, if os.path.exists(expected_file): expected_raw = read_no_crs(expected_file) expected_str = extra_normaliser(normaliser(expected_raw)) + expected_file_for_diff = expected_file else: expected_str = '' - expected_file = '/dev/null' + expected_file_for_diff = '/dev/null' actual_raw = read_no_crs(actual_file) actual_str = extra_normaliser(normaliser(actual_raw)) @@ -1408,12 +1409,12 @@ def compare_outputs( kind, normaliser, extra_normaliser, if expected_str != actual_str: print 'Actual ' + kind + ' output differs from expected:' - if expected_file == '/dev/null': + if expected_file_for_diff == '/dev/null': expected_normalised_file = '/dev/null' - else: expected_normalised_file = expected_file + ".normalised" write_file(expected_normalised_file, expected_str) + actual_normalised_file = actual_file + ".normalised" write_file(actual_normalised_file, actual_str) @@ -1425,24 +1426,18 @@ def compare_outputs( kind, normaliser, extra_normaliser, # (including newlines) so the diff would be hard to read. # This does mean that the diff might contain changes that # would be normalised away. - r = os.system( 'diff -uw ' + expected_file + \ + r = os.system( 'diff -uw ' + expected_file_for_diff + \ ' ' + actual_file ) # If for some reason there were no non-whitespace differences, # then do a full diff if r == 0: - r = os.system( 'diff -u ' + expected_file + \ + r = os.system( 'diff -u ' + expected_file_for_diff + \ ' ' + actual_file ) if config.accept: - if expected_file == '': - print '*** cannot accept new output: ' + kind + \ - ' file does not exist.' - return 0 - else: - print 'Accepting new output.' - write_file(expected_file, actual_raw) - return 1 + print 'Accepting new output.' + write_file(expected_file, actual_raw) return 0 return 1 _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
