Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/build/v2/test/v1_testing.py @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 3.6 KB
Line 
1#!/usr/bin/python
2
3from BoostBuild import Tester, List
4import os
5from string import strip
6import re
7import time
8
9def match_re(actual,expected):
10    return re.match(expected,actual,re.DOTALL) != None
11
12t = Tester(match = match_re, boost_build_path = os.path.join(os.getcwd(), ".."))
13t.set_tree('v1_testing')
14
15os.environ['TOOLS'] = 'gcc'
16os.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.
24t.run_build_system(arguments = 'test', status = 0)
25t.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!
37t.rename('lib.cpp', 'lib.cpp.bak')
38t.run_build_system(arguments = 'test', status = 1)
39t.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.
46t.rename('lib.cpp.bak', 'lib.cpp')
47t.run_build_system(arguments = 'test', status = 0)
48t.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.
63t.rename('lib.cpp', 'lib.cpp.bak')
64t.rename('lib-err.cpp', 'lib.cpp')
65t.touch('lib.cpp')
66t.run_build_system(arguments = 'test', status=1)
67t.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!
75t.rename('lib.cpp.bak', 'lib.cpp')
76t.run_build_system(arguments = 'test', status = 0)
77t.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
82t.cleanup()
83print 'tesing complete'
Note: See TracBrowser for help on using the repository browser.