2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 12:22:17 +00:00
Files
build/test/copy_time.py
Jurko Gospodnetić 343b4d6532 Updated the internal Boost Build testing system to use the Python subprocess module (introduced in Python 2.4) for running external processes instead of popen2 (deprecated since Python 2.6). We are already using Python 2.4 features in this codebase so there is no need to support Python releases older than 2.4.
Related changes:
  * BoostBuild.Tester & TestCmd.TestCmd interfaces now accept external process parameters as a list of strings, thus avoiding problems with parsing arguments containing spaces.
  * Avoided a potential process hang in case an external process being run prints out enough output to fill up the OS's pipe buffer (OS would pause the process until someone read the data from the pipe but the testing framework would not do this until the process in question had terminated).

[SVN r79448]
2012-07-12 12:55:25 +00:00

70 lines
1.9 KiB
Python
Executable File

#!/usr/bin/python
#
# Copyright (c) 2008 Steven Watanabe
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Test that the common.copy rule set the modification date of the new file to
# the current time.
import BoostBuild
tester = BoostBuild.Tester()
tester.write("test1.cpp", """\
template<bool, int M, class Next>
struct time_waster {
typedef typename time_waster<true, M-1, time_waster>::type type1;
typedef typename time_waster<false, M-1, time_waster>::type type2;
typedef void type;
};
template<bool B, class Next>
struct time_waster<B, 0, Next> {
typedef void type;
};
typedef time_waster<true, 10, void>::type type;
int f() { return 0; }
""")
tester.write("test2.cpp", """\
template<bool, int M, class Next>
struct time_waster {
typedef typename time_waster<true, M-1, time_waster>::type type1;
typedef typename time_waster<false, M-1, time_waster>::type type2;
typedef void type;
};
template<bool B, class Next>
struct time_waster<B, 0, Next> {
typedef void type;
};
typedef time_waster<true, 10, void>::type type;
int g() { return 0; }
""")
tester.write("jamroot.jam", """\
obj test2 : test2.cpp ;
obj test1 : test1.cpp : <dependency>test2 ;
install test2i : test2 : <dependency>test1 ;
""")
tester.run_build_system()
tester.expect_addition("bin/$toolset/debug/test2.obj")
tester.expect_addition("bin/$toolset/debug/test1.obj")
tester.expect_addition("test2i/test2.obj")
tester.expect_nothing_more()
test2src = tester.read("test2i/test2.obj")
test2dest = tester.read("bin/$toolset/debug/test2.obj")
if test2src != test2dest:
BoostBuild.annotation("failure", "The object file was not copied "
"correctly")
tester.fail_test(1)
tester.run_build_system(["-d1"])
tester.expect_output_line("common.copy*", expected_to_exist=False)
tester.expect_nothing_more()
tester.cleanup()