1 | #!/usr/bin/python |
---|
2 | |
---|
3 | from BoostBuild import Tester, List |
---|
4 | import os |
---|
5 | from string import strip |
---|
6 | import re |
---|
7 | import time |
---|
8 | |
---|
9 | def match_re(actual,expected): |
---|
10 | return re.match(expected,actual,re.DOTALL) != None |
---|
11 | |
---|
12 | t = Tester(match = match_re, boost_build_path = os.path.join(os.getcwd(), "..")) |
---|
13 | t.set_tree('v1_testing') |
---|
14 | |
---|
15 | os.environ['TOOLS'] = 'gcc' |
---|
16 | os.environ['NOARSCAN'] = '1' |
---|
17 | |
---|
18 | # 1) No existing bin directories. Both build and test ran fine. As |
---|
19 | # expected, the residue files were a bit different: There was no |
---|
20 | # path_test.success, and path_test.test contained the word "passed" |
---|
21 | # instead of the path to the .cpp file. I've haven't looked yet to |
---|
22 | # see if the lack of the path is a problem for reporting, but |
---|
23 | # hopefully the information is trivially available somewhere else. |
---|
24 | t.run_build_system(arguments = 'test', status = 0) |
---|
25 | t.expect_addition( |
---|
26 | ['bin/compile.test/gcc/debug/runtime-link-dynamic/compile.test' |
---|
27 | , 'bin/nocompile.test/gcc/debug/runtime-link-dynamic/nocompile.test' |
---|
28 | , 'bin/link.test/gcc/debug/runtime-link-dynamic/link.test' |
---|
29 | , 'bin/nolink.test/gcc/debug/runtime-link-dynamic/nolink.test' |
---|
30 | , 'bin/run.test/gcc/debug/runtime-link-dynamic/run.test']) |
---|
31 | |
---|
32 | |
---|
33 | # 2) Missing source file for the library build. path_test.test was |
---|
34 | # deleted, so the reporting programs would know that failure |
---|
35 | # occurred. The stdout messages also indicated what had |
---|
36 | # happened. Excellent! |
---|
37 | t.rename('lib.cpp', 'lib.cpp.bak') |
---|
38 | t.run_build_system(arguments = 'test', status = 1) |
---|
39 | t.expect_removal( |
---|
40 | ['bin/link.test/gcc/debug/runtime-link-dynamic/link.test' |
---|
41 | , 'bin/nolink.test/gcc/debug/runtime-link-dynamic/nolink.test' |
---|
42 | , 'bin/run.test/gcc/debug/runtime-link-dynamic/run.test']) |
---|
43 | |
---|
44 | # 3) Missing file restored. Worked fine; path_test.test was recreated, |
---|
45 | # no other files were touched. |
---|
46 | t.rename('lib.cpp.bak', 'lib.cpp') |
---|
47 | t.run_build_system(arguments = 'test', status = 0) |
---|
48 | t.expect_addition( |
---|
49 | [ 'bin/link.test/gcc/debug/runtime-link-dynamic/link.test' |
---|
50 | , 'bin/nolink.test/gcc/debug/runtime-link-dynamic/nolink.test' |
---|
51 | , 'bin/run.test/gcc/debug/runtime-link-dynamic/run.test']) |
---|
52 | # I didn't add a test for 'no other files were touched', because |
---|
53 | # it's a little complicated. There is an expect_nothing_more() |
---|
54 | # function, but we actually need to spell out a lot more than |
---|
55 | # what we currently have to do that. |
---|
56 | |
---|
57 | # 4) Introduced error into one of the library files, causing a library build |
---|
58 | # compile to fail. path_test.test was deleted, so the reporting programs |
---|
59 | # would know that failure occurred. Excellent! This is the case that has |
---|
60 | # caused regression testing to report the wrong results in the past, so it |
---|
61 | # was good news to see it working correctly now. We probably should figure |
---|
62 | # out some other test cases just to be sure it is working for full coverage. |
---|
63 | t.rename('lib.cpp', 'lib.cpp.bak') |
---|
64 | t.rename('lib-err.cpp', 'lib.cpp') |
---|
65 | t.touch('lib.cpp') |
---|
66 | t.run_build_system(arguments = 'test', status=1) |
---|
67 | t.expect_removal( |
---|
68 | ['bin/link.test/gcc/debug/runtime-link-dynamic/link.test' |
---|
69 | , 'bin/nolink.test/gcc/debug/runtime-link-dynamic/nolink.test' |
---|
70 | , 'bin/run.test/gcc/debug/runtime-link-dynamic/run.test']) |
---|
71 | |
---|
72 | # 5) Fixed the error in the library file. The library build then worked, and |
---|
73 | # path_test.exe was relinked, without first recompiling path_test.obj. Test |
---|
74 | # was rerun. Exactly right behavior! |
---|
75 | t.rename('lib.cpp.bak', 'lib.cpp') |
---|
76 | t.run_build_system(arguments = 'test', status = 0) |
---|
77 | t.expect_addition( |
---|
78 | [ 'bin/link.test/gcc/debug/runtime-link-dynamic/link.test' |
---|
79 | , 'bin/nolink.test/gcc/debug/runtime-link-dynamic/nolink.test' |
---|
80 | , 'bin/run.test/gcc/debug/runtime-link-dynamic/run.test']) |
---|
81 | |
---|
82 | t.cleanup() |
---|
83 | print 'tesing complete' |
---|