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)
8 # Test for the regression testing framework.
12 # Create a temporary working directory.
13 t = BoostBuild.Tester()
15 t.write("c.cpp", "\n")
21 int main( int ac, char * av[] )
24 for ( int i = 1; i < ac; ++i )
25 std::cout << av[ i ] << '\\n';
29 t.write("c-f.cpp", """
33 t.write("r-f.cpp", """
34 int main() { return 1; }
38 t.write("jamfile.jam", """
41 compile-fail c-f.cpp ;
42 run r.cpp libs//helper : foo bar ;
46 t.write("libs/jamfile.jam", """
47 lib helper : helper.cpp ;
50 t.write("libs/helper.cpp", """
58 t.write("jamroot.jam", "")
60 # First test that when outcomes are expected, all .test files are created.
61 t.run_build_system("hardcode-dll-paths=false", stderr=None, status=None)
62 t.expect_addition("bin/c.test/$toolset/debug/c.test")
63 t.expect_addition("bin/c-f.test/$toolset/debug/c-f.test")
64 t.expect_addition("bin/r.test/$toolset/debug/r.test")
65 t.expect_addition("bin/r-f.test/$toolset/debug/r-f.test")
67 # Make sure args are handled.
68 t.expect_content("bin/r.test/$toolset/debug/r.output",
69 "foo\nbar\n*\nEXIT STATUS: 0*\n", True)
71 # Test that input file is handled as well.
75 int main( int ac, char * av[] )
77 for ( int i = 1; i < ac; ++i )
79 std::ifstream ifs( av[ i ] );
80 std::cout << ifs.rdbuf();
85 t.write("dir/input.txt", "test input")
87 t.write("jamfile.jam", """
91 compile-fail c-f.cpp ;
92 run r.cpp : : dir/input.txt ;
95 time compilation : c-obj ;
98 t.run_build_system('hardcode-dll-paths=false')
99 t.expect_content("bin/r.test/$toolset/debug/r.output",
100 "test input\nEXIT STATUS: 0\n")
102 t.expect_addition('bin/$toolset/debug/execution.time')
103 t.expect_addition('bin/$toolset/debug/compilation.time')
105 # Make sure test failures are detected. Reverse expectation and see if .test
106 # files are created or not.
107 t.write("jamfile.jam", """
112 run-fail r.cpp : : dir/input.txt ;
116 t.touch(BoostBuild.List("c.cpp c-f.cpp r.cpp r-f.cpp"))
118 t.run_build_system("hardcode-dll-paths=false", stderr=None, status=1)
119 t.expect_removal("bin/c.test/$toolset/debug/c.test")
120 t.expect_removal("bin/c-f.test/$toolset/debug/c-f.test")
121 t.expect_removal("bin/r.test/$toolset/debug/r.test")
122 t.expect_removal("bin/r-f.test/$toolset/debug/r-f.test")