From a607cd9ece5b27c405fb920bdd384b884a32d412 Mon Sep 17 00:00:00 2001
From: Vladimir Prus
Effects:
@@ -214,12 +217,11 @@ FAILED test of D:\MyDocu~1\Work\build\boost-build\boost-build -d0 original_workdir.bjam by
- default) and build system files, assuming that the current
- directory is tools/build/test. Formulates jam
- invocation command, which will include explicit setting for
- BOOST_BUILD_PATH variable and arguments passed to this
- methods, if any. This command will be used by subsequent
- invocation of tools/build/test. Formulates jam invocation command, which
+ will include explicit setting for BOOST_BUILD_PATH variable
+ and arguments passed to this methods, if any. This command will be used
+ by subsequent invocation of run_build_system. Finally,
initializes the base class.Effects:
@@ -305,6 +306,21 @@ FAILED test of D:\MyDocu~1\Work\build\boost-build\boost-build -d0Read the specified file and returns it content. Raises an exception is the file is absent.
+Effects:
+ +Read the specified file and returns it content, after removing + trailing whitespace from every line. Raises an exception is the file is + absent.
+ +Rationale:
+ +Althought this method is questionable, there are a lot of cases when + jam or shells it uses insert spaces. It seems that introducing this + method is much simpler than dealing with all those cases.
+Lastly, there's a method to compare file content with expected + content:
+ expect_content(self, name, content, exact=0) + +The method fails the test if the content of file identified by 'name' + is different from 'content'. If 'exact' is true, the file content is used + as-is, otherwise, two transformations are applied:
+ +There are five methods which ignore changes made to the working tree. diff --git a/v2/test/BoostBuild.py b/v2/test/BoostBuild.py index 0573ff945..a3a8b07ad 100644 --- a/v2/test/BoostBuild.py +++ b/v2/test/BoostBuild.py @@ -175,7 +175,16 @@ class Tester(TestCmd.TestCmd): self.last_build_time = time.time() def read(self, name): - return open(self.native_file_name(name), "rb").read() + return open(self.native_file_name(name), "r").read() + + def read_and_strip(self, name): + lines = open(self.native_file_name(name), "r").readlines() + result = string.join(map(string.rstrip, lines), "\n") + if lines and lines[-1][-1] == '\n': + return result + '\n' + else: + return result + # A number of methods below check expectations with actual difference # between directory trees before and after build. @@ -264,6 +273,18 @@ class Tester(TestCmd.TestCmd): if not self.unexpected_difference.empty(): self.fail_test(1) + def expect_content(self, name, content, exact=0): + if exact: + actual = self.read(name) + else: + actual = string.replace(self.read_and_strip(name), "\\", "/") + + if actual != content: + print "Expected:\n" + print content + print "Got:\n" + print actual + self.fail_test(1) # Helpers def mul(self, *arguments): diff --git a/v2/test/test_system.html b/v2/test/test_system.html index 11d0e5724..f00ad9925 100644 --- a/v2/test/test_system.html +++ b/v2/test/test_system.html @@ -60,6 +60,9 @@
Effects:
@@ -214,12 +217,11 @@ FAILED test of D:\MyDocu~1\Work\build\boost-build\boost-build -d0 original_workdir.bjam by
- default) and build system files, assuming that the current
- directory is tools/build/test. Formulates jam
- invocation command, which will include explicit setting for
- BOOST_BUILD_PATH variable and arguments passed to this
- methods, if any. This command will be used by subsequent
- invocation of tools/build/test. Formulates jam invocation command, which
+ will include explicit setting for BOOST_BUILD_PATH variable
+ and arguments passed to this methods, if any. This command will be used
+ by subsequent invocation of run_build_system. Finally,
initializes the base class.Effects:
@@ -305,6 +306,21 @@ FAILED test of D:\MyDocu~1\Work\build\boost-build\boost-build -d0Read the specified file and returns it content. Raises an exception is the file is absent.
+Effects:
+ +Read the specified file and returns it content, after removing + trailing whitespace from every line. Raises an exception is the file is + absent.
+ +Rationale:
+ +Althought this method is questionable, there are a lot of cases when + jam or shells it uses insert spaces. It seems that introducing this + method is much simpler than dealing with all those cases.
+Lastly, there's a method to compare file content with expected + content:
+ expect_content(self, name, content, exact=0) + +The method fails the test if the content of file identified by 'name' + is different from 'content'. If 'exact' is true, the file content is used + as-is, otherwise, two transformations are applied:
+ +There are five methods which ignore changes made to the working tree.