diff options
author | Evan Mallory <schmave@gmail.com> | 2016-09-22 18:51:10 -0400 |
---|---|---|
committer | Evan Mallory <schmave@gmail.com> | 2016-09-23 08:14:30 -0400 |
commit | 0e691e76dbd928b4aa919cbb9788c805e34937dc (patch) | |
tree | 31b4d0c6a09c6e33b1c67b943dbff79adf14bd6a /test/RegressTests.py | |
parent | 132156766770da8340138aab117cf7e37787403c (diff) | |
download | fork-ledger-0e691e76dbd928b4aa919cbb9788c805e34937dc.tar.gz fork-ledger-0e691e76dbd928b4aa919cbb9788c805e34937dc.tar.bz2 fork-ledger-0e691e76dbd928b4aa919cbb9788c805e34937dc.zip |
Fix test harness to work with msys2
With this change, 97% of the tests pass. See the build on appveyor for more info: https://ci.appveyor.com/project/Evan/ledger/build/build-49
I'll follow up with another PR to fix some of the remaining broken tests
Diffstat (limited to 'test/RegressTests.py')
-rwxr-xr-x | test/RegressTests.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/test/RegressTests.py b/test/RegressTests.py index a5bab42d..58869edc 100755 --- a/test/RegressTests.py +++ b/test/RegressTests.py @@ -98,6 +98,13 @@ class RegressFile(object): def run_test(self, test): use_stdin = False + if sys.platform == 'win32': + test['command'] = test['command'].replace('/dev/null', 'nul') + # There is no equivalent to /dev/stdout, /dev/stderr, /dev/stdin + # on Windows, so skip tests that require them. + if '/dev/std' in test['command']: + harness.success() + return if test['command'].find("-f ") != -1: test['command'] = '$ledger ' + test['command'] if re.search("-f (-|/dev/stdin)(\s|$)", test['command']): @@ -122,7 +129,16 @@ class RegressFile(object): printed = False index = 0 if test['output'] is not None: - for line in unified_diff(test['output'], harness.readlines(p.stdout)): + process_output = harness.readlines(p.stdout) + expected_output = test['output'] + if sys.platform == 'win32': + process_output = [l.replace('\r\n', '\n').replace('\\', '/') + for l in process_output] + # Replace \ with / in the expected output because the line above + # makes it impossible for the process output to have a \. + expected_output = [l.replace('\\', '/') for l in expected_output] + + for line in unified_diff(expected_output, process_output): index += 1 if index < 3: continue @@ -135,8 +151,14 @@ class RegressFile(object): printed = False index = 0 - if test['error'] is not None: - for line in unified_diff(test['error'], harness.readlines(p.stderr)): + process_error = harness.readlines(p.stderr) + if test['error'] is not None or process_error is not None: + if test['error'] is None: + test['error'] = [] + if sys.platform == 'win32': + process_error = [l.replace('\r\n', '\n').replace('\\', '/') + for l in process_error] + for line in unified_diff(test['error'], process_error): index += 1 if index < 3: continue |