From: Gary Lockyer Date: Tue, 3 Mar 2020 03:59:19 +0000 (+1300) Subject: ndrdump tests: Make the tests less fragile X-Git-Tag: ldb-2.2.0~1512 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56e466b4b849b7269add03faebeb0a63f9cda827;p=thirdparty%2Fsamba.git ndrdump tests: Make the tests less fragile Remove the C source file and line number from the expected output to make the tests less likely to break if ndr.c changes. Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/blackbox/ndrdump.py b/python/samba/tests/blackbox/ndrdump.py index 22aa326e201..0b72684f270 100644 --- a/python/samba/tests/blackbox/ndrdump.py +++ b/python/samba/tests/blackbox/ndrdump.py @@ -22,6 +22,7 @@ from __future__ import print_function """Blackbox tests for ndrdump.""" import os +import re from samba.tests import BlackboxTestCase, BlackboxProcessError for p in ["../../../../../source4/librpc/tests", @@ -436,6 +437,11 @@ dump OK except BlackboxProcessError as e: self.fail(e) + # Filter out the C source file and line number + regex = rb"\.\./\.\./librpc/ndr/ndr\.c:[0-9]+" + actual = re.sub(regex, b"", actual) + expected = re.sub(regex, b"", expected) + self.assertEqual(actual, expected) # Test a print of NULL pointer in manually-written ndr_drsuapi.c