]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/regression.py
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / test / regression.py
1 #!/usr/bin/python
2
3 # Copyright (C) Vladimir Prus 2003.
4 # Distributed under the Boost Software License, Version 1.0.
5 # (See accompanying file LICENSE_1_0.txt or copy at
6 # http://www.boost.org/LICENSE_1_0.txt)
7
8 # Test for the regression testing framework.
9
10 import BoostBuild
11
12 # Create a temporary working directory.
13 t = BoostBuild.Tester(use_test_config=False)
14
15 t.write("c.cpp", "\n")
16 t.write("r.cpp", """\
17 void helper();
18
19 #include <iostream>
20 int main( int ac, char * av[] )
21 {
22 helper();
23 for ( int i = 1; i < ac; ++i )
24 std::cout << av[ i ] << '\\n';
25 }
26 """)
27 t.write("c-f.cpp", "int\n")
28 t.write("r-f.cpp", "int main() { return 1; }\n")
29
30 t.write("jamroot.jam", "")
31 t.write("jamfile.jam", """\
32 import testing ;
33 compile c.cpp ;
34 compile-fail c-f.cpp ;
35 run r.cpp libs//helper : foo bar ;
36 run-fail r-f.cpp ;
37 """)
38
39 t.write("libs/jamfile.jam", "lib helper : helper.cpp ;")
40 t.write("libs/helper.cpp", """\
41 void
42 #if defined(_WIN32)
43 __declspec(dllexport)
44 #endif
45 helper() {}
46 """)
47
48 # First test that when outcomes are expected, all .test files are created.
49 t.run_build_system(["hardcode-dll-paths=false"], stderr=None, status=None)
50 t.expect_addition("bin/c.test/$toolset/debug*/c.test")
51 t.expect_addition("bin/c-f.test/$toolset/debug*/c-f.test")
52 t.expect_addition("bin/r.test/$toolset/debug*/r.test")
53 t.expect_addition("bin/r-f.test/$toolset/debug*/r-f.test")
54
55 # Make sure args are handled.
56 t.expect_content("bin/r.test/$toolset/debug*/r.output",
57 "foo\nbar\n*\nEXIT STATUS: 0*\n", True)
58
59 # Test that input file is handled as well.
60 t.write("r.cpp", """\
61 #include <iostream>
62 #include <fstream>
63 int main( int ac, char * av[] )
64 {
65 for ( int i = 1; i < ac; ++i )
66 {
67 std::ifstream ifs( av[ i ] );
68 std::cout << ifs.rdbuf();
69 }
70 }
71 """)
72
73 t.write("dir/input.txt", "test input")
74
75 t.write("jamfile.jam", """\
76 import testing ;
77 compile c.cpp ;
78 obj c-obj : c.cpp ;
79 compile-fail c-f.cpp ;
80 run r.cpp : : dir/input.txt ;
81 run-fail r-f.cpp ;
82 time execution : r ;
83 time compilation : c-obj ;
84 """)
85
86 t.run_build_system(["hardcode-dll-paths=false"])
87 t.expect_content("bin/r.test/$toolset/debug*/r.output", """\
88 test input
89 EXIT STATUS: 0
90 """)
91
92 t.expect_addition('bin/$toolset/debug*/execution.time')
93 t.expect_addition('bin/$toolset/debug*/compilation.time')
94
95 # Make sure test failures are detected. Reverse expectation and see if .test
96 # files are created or not.
97 t.write("jamfile.jam", """\
98 import testing ;
99 compile-fail c.cpp ;
100 compile c-f.cpp ;
101 run-fail r.cpp : : dir/input.txt ;
102 run r-f.cpp ;
103 """)
104
105 t.touch(BoostBuild.List("c.cpp c-f.cpp r.cpp r-f.cpp"))
106
107 t.run_build_system(["hardcode-dll-paths=false"], stderr=None, status=1)
108 t.expect_removal("bin/c.test/$toolset/debug*/c.test")
109 t.expect_removal("bin/c-f.test/$toolset/debug*/c-f.test")
110 t.expect_removal("bin/r.test/$toolset/debug*/r.test")
111 t.expect_removal("bin/r-f.test/$toolset/debug*/r-f.test")
112
113 t.cleanup()