summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-11-17 21:30:07 +0100
committerGitHub <noreply@github.com>2020-11-17 21:30:07 +0100
commit4abdbea978e54fceb5254246ec4eca20ebcaf796 (patch)
treeceae527ab8721fe74e639bd27ed23acf9400c97a
parentMerge pull request #7534 from chiragshah6/yang_nb1 (diff)
parenttests: ignore Windows vs Unix style newlines (diff)
downloadfrr-4abdbea978e54fceb5254246ec4eca20ebcaf796.tar.xz
frr-4abdbea978e54fceb5254246ec4eca20ebcaf796.zip
Merge pull request #7543 from GalaxyGorilla/fix_refcmp_newline
tests: ignore Windows vs Unix style newlines
-rw-r--r--tests/helpers/python/frrtest.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/helpers/python/frrtest.py b/tests/helpers/python/frrtest.py
index 0ac54fd90..584fa9037 100644
--- a/tests/helpers/python/frrtest.py
+++ b/tests/helpers/python/frrtest.py
@@ -168,8 +168,8 @@ class TestMultiOut(_TestMultiOut):
class TestRefMismatch(Exception):
def __init__(self, _test, outtext, reftext):
- self.outtext = outtext.decode("utf8") if type(outtext) is bytes else outtext
- self.reftext = reftext.decode("utf8") if type(reftext) is bytes else reftext
+ self.outtext = outtext
+ self.reftext = reftext
def __str__(self):
rv = "Expected output and actual output differ:\n"
@@ -214,7 +214,12 @@ class TestRefOut(object):
[binpath(program)], stdin=subprocess.PIPE, stdout=subprocess.PIPE
)
outtext, _ = proc.communicate(intext)
- if outtext != reftext:
- raise TestRefMismatch(self, outtext, reftext)
+
+ # Get rid of newline problems (Windows vs Unix Style)
+ outtext_str = outtext.decode("utf8").replace("\r\n", "\n").replace("\r", "\n")
+ reftext_str = reftext.decode("utf8").replace("\r\n", "\n").replace("\r", "\n")
+
+ if outtext_str != reftext_str:
+ raise TestRefMismatch(self, outtext_str, reftext_str)
if proc.wait() != 0:
raise TestExitNonzero(self)