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