Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added boost

  • Property svn:executable set to *
File size: 2.9 KB
Line 
1#!/usr/bin/python
2
3#  Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and
4#  distribute this software is granted provided this copyright notice appears in
5#  all copies. This software is provided "as is" without express or implied
6#  warranty, and with no claim as to its suitability for any purpose.
7
8#  Test for the regression testing framework.
9from BoostBuild import Tester, List
10
11# Create a temporary working directory
12t = Tester()
13
14t.write("c.cpp", "")
15
16t.write("r.cpp", """
17
18void helper();
19
20#include <iostream>
21int main(int ac, char* av[])
22{
23    helper();
24
25    for (int i = 1; i < ac; ++i)
26       std::cout << av[i] << '\\n';
27    return 0;
28}
29""")
30
31t.write("c-f.cpp", """
32int
33""")
34
35t.write("r-f.cpp", """
36int main()
37{
38    return 1;
39}
40""")
41
42
43t.write("Jamfile", """
44import testing ;
45
46compile c.cpp ;
47compile-fail c-f.cpp ;
48run r.cpp libs//helper : foo bar ;
49run-fail r-f.cpp ;
50
51""")
52
53t.write("libs/Jamfile", """
54lib helper : helper.cpp ;
55""")
56
57t.write("libs/helper.cpp", """
58void
59#if defined(_WIN32)
60__declspec(dllexport)
61#endif
62helper() {}
63
64""")
65
66t.write("project-root.jam", "")
67
68# First test that when outcomes are expected, all .test files are created.
69t.run_build_system("hardcode-dll-paths=false", stderr=None, status=None)
70t.expect_addition("bin/c.test/$toolset/debug/c.test")
71t.expect_addition("bin/c-f.test/$toolset/debug/c-f.test")
72t.expect_addition("bin/r.test/$toolset/debug/r.test")
73t.expect_addition("bin/r-f.test/$toolset/debug/r-f.test")
74
75# Make sure args are handled.
76t.expect_content("bin/r.test/$toolset/debug/r.output",
77                 "foo\nbar\n\nEXIT STATUS: 0\n")
78
79# Test that input file is handled as well.
80t.write("r.cpp", """
81#include <iostream>
82#include <fstream>
83int main(int ac, char* av[])
84{
85    for (int i = 1; i < ac; ++i) {
86        std::ifstream ifs(av[i]);
87        std::cout << ifs.rdbuf();
88    }
89
90    return 0;
91}
92""")
93
94t.write("dir/input.txt", "test input")
95
96t.write("Jamfile", """
97import testing ;
98
99compile c.cpp ;
100obj c-obj : c.cpp ;
101compile-fail c-f.cpp ;
102run r.cpp : : dir/input.txt ;
103run-fail r-f.cpp ;
104time execution : r ;
105time compilation : c-obj ;
106""")
107
108t.run_build_system('hardcode-dll-paths=false')
109t.expect_content("bin/r.test/$toolset/debug/r.output",
110                 "test input\nEXIT STATUS: 0\n")
111
112t.expect_addition('bin/$toolset/debug/execution.time')
113t.expect_addition('bin/$toolset/debug/compilation.time')
114
115# Make sure test failures are detected. Reverse expectation and see
116# if .test files are created or not.
117t.write("Jamfile", """
118import testing ;
119
120compile-fail c.cpp ;
121compile c-f.cpp ;
122run-fail r.cpp : : dir/input.txt ;
123run r-f.cpp ;
124""")
125
126t.touch(List("c.cpp c-f.cpp r.cpp r-f.cpp"))
127
128t.run_build_system("hardcode-dll-paths=false", stderr=None, status=1)
129t.expect_removal("bin/c.test/$toolset/debug/c.test")
130t.expect_removal("bin/c-f.test/$toolset/debug/c-f.test")
131t.expect_removal("bin/r.test/$toolset/debug/r.test")
132t.expect_removal("bin/r-f.test/$toolset/debug/r-f.test")
133
134t.cleanup()
Note: See TracBrowser for help on using the repository browser.