From 82c3eef5e9f1535d4eb48efb01a708593db90b9f Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Wed, 8 Nov 2006 09:01:09 +0000 Subject: [PATCH] *** empty log message *** [SVN r35920] --- test/BoostBuild.py | 35 ++++++++++++++++++++++++++--------- test/notfile.py | 3 ++- test/rebuilds.py | 2 +- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/test/BoostBuild.py b/test/BoostBuild.py index a1aff2cba..209ab0219 100644 --- a/test/BoostBuild.py +++ b/test/BoostBuild.py @@ -522,7 +522,22 @@ class Tester(TestCmd.TestCmd): print 'FAILED' print '------- The following changes were unexpected ------- ' self.unexpected_difference.pprint() - self.fail_test(1) + self.fail_test(1) + + def expect_output_line(self, expected): + expected = expected.strip() + lines = self.stdout().splitlines() + found = 0 + for line in lines: + line = line.strip() + if fnmatch.fnmatch(line, expected): + found = 1 + break + + if not found: + print "Did not found expected line in output:" + print expected + self.fail_test(1) def expect_content(self, name, content, exact=0): name = self.adjust_names(name)[0] @@ -536,20 +551,22 @@ class Tester(TestCmd.TestCmd): self.fail_test(1) content = string.replace(content, "$toolset", self.toolset+"*") - + + matched = 0 if exact: matched = fnmatch.fnmatch(actual,content) else: actual_ = map(lambda x: sorted(x.split()),actual.splitlines()) content_ = map(lambda x: sorted(x.split()),content.splitlines()) - matched = map( - lambda x,y: map(lambda n,p: fnmatch.fnmatch(n,p),x,y), - actual_, content_ ) - matched = reduce( - lambda x,y: x and reduce( - lambda a,b: a and b, + if len(actual_) == len(content_): + matched = map( + lambda x,y: map(lambda n,p: fnmatch.fnmatch(n,p),x,y), + actual_, content_ ) + matched = reduce( + lambda x,y: x and reduce( + lambda a,b: a and b, y ), - matched ) + matched ) if not matched: print "Expected:\n" diff --git a/test/notfile.py b/test/notfile.py index a50a0c8fa..02b1ee238 100644 --- a/test/notfile.py +++ b/test/notfile.py @@ -10,6 +10,7 @@ from BoostBuild import Tester, List import string import os +import fnmatch t = Tester() @@ -48,7 +49,7 @@ t.fail_test(string.find(t.stdout(), "echo hi") == -1) name = t.adjust_names(["bin/$toolset/debug/hello.exe"])[0] name = apply(os.path.join, string.split(name, "/")); c = "valgrind " + name -t.fail_test(string.find(t.stdout(), c) == -1) +t.expect_output_line(c) t.cleanup() diff --git a/test/rebuilds.py b/test/rebuilds.py index 87c4d26da..60df62f1d 100644 --- a/test/rebuilds.py +++ b/test/rebuilds.py @@ -19,7 +19,7 @@ rule make actions make { echo "******" making $(<) from $(>) "******" - echo made from $(>) >> $(<) + echo made from $(>) > $(<) } make aux1 : bar ;