From ce3da4f80f425965fc006f801cc7731b427cffac Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Wed, 1 Jul 2020 14:56:51 +0200 Subject: [PATCH] Testsuite: canonicalize line endings in "alr" outputs (#460) A recent e3-core update changed the behavior of e3.os.process.Run's behavior regarding line endings, which are now left unchanged. This creates discrepancies in process outputs depending on the platform. --- testsuite/drivers/alr.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/testsuite/drivers/alr.py b/testsuite/drivers/alr.py index 77b038d3..62e81ac4 100644 --- a/testsuite/drivers/alr.py +++ b/testsuite/drivers/alr.py @@ -6,6 +6,7 @@ import os.path from e3.os.process import Run, quote_arg from e3.fs import mkdir +from e3.testsuite.driver.classic import ProcessResult import re @@ -48,7 +49,7 @@ def run_alr(*args, **kwargs): :param bool debug: If true (which is the default), append "-d" to the command line. This ensures uncaught exceptions are logged instead of presenting a sanitized error intended for final users. - :rtype: Run + :rtype: ProcessResult """ complain_on_error = kwargs.pop('complain_on_error', True) @@ -73,7 +74,11 @@ def run_alr(*args, **kwargs): print('Output:') print(p.out) raise CalledProcessError('alr returned non-zero status code') - return p + + # Convert CRLF line endings (Windows-style) to LF (Unix-style). This + # canonicalization is necessary to make output comparison work on all + # platforms. + return ProcessResult(p.status, p.out.replace('\r\n', '\n')) def fixtures_path(*args): -- 2.39.5