File: copy_time.py

package info (click to toggle)
boost1.74 1.74.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 464,084 kB
  • sloc: cpp: 3,338,324; xml: 131,293; python: 33,088; ansic: 14,336; asm: 4,034; sh: 3,351; makefile: 1,193; perl: 1,036; yacc: 478; php: 212; ruby: 102; lisp: 24; sql: 13; csh: 6
file content (69 lines) | stat: -rwxr-xr-x 1,978 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/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(use_test_config=False)

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", binary=True)
test2dest = tester.read("bin/$toolset/debug*/test2.obj", binary=True)
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_lines("common.copy*", False)
tester.expect_nothing_more()

tester.cleanup()