From 748618d6e39c3bce5f8f697a90cd35ffe3c14206 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 4 Mar 2013 07:30:31 -0800 Subject: PIM testing: ignore valgrind ERROR when checking output Complaining about "ERROR SUMMARY" when using valgrind is a false positive. Ignore that text by making it lower case before searching. Other attempts based on regex matching somehow failed (UTF-8 encoding error?!). --- src/dbus/server/pim/testpim.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/dbus/server/pim/testpim.py b/src/dbus/server/pim/testpim.py index 1060b20d..3201269c 100755 --- a/src/dbus/server/pim/testpim.py +++ b/src/dbus/server/pim/testpim.py @@ -479,9 +479,18 @@ END:VCARD(\r|\n)*''', # [ERROR] The string supplied did not seem to be a phone number. # to stdout until we reduced the log level. # + # ==4039== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 185 from 175) + # as printed by valgrind is okay, so don't match that. + # # We check both D-Bus messages (which did not contain that # text, but some other error messages) and the servers stdout. - self.runTestDBusCheck = lambda test, log: test.assertNotIn('ERROR', log) + def unicodeLog(test, log): + open('/tmp/out', 'wb').write(log) + print re.match(r'ERROR(?! SUMMARY:)', log) + # Using assertNotRegexMatches with a negative lookahead led to unicode errors?! + # Therefore stick to plain text checks and avoid false matches against valgind's + # 'ERROR SUMMARY' by replacing that first. + self.runTestDBusCheck = lambda test, log: test.assertNotIn('ERROR', log.replace('ERROR SUMMARY:', 'error summary:')) self.runTestOutputCheck = self.runTestDBusCheck # Runtime varies a lot when using valgrind, because -- cgit v1.2.3