1#!/usr/local/bin/python3.8
2
3# Copyright 2006 Rene Rivera.
4# Copyright 2011 Steven Watanabe
5# Distributed under the Boost Software License, Version 1.0.
6# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
7
8import BoostBuild
9
10t = BoostBuild.Tester(["-d1"], pass_toolset=0)
11
12t.write("sleep.bat", """\
13::@timeout /T %1 /NOBREAK >nul
14@ping 127.0.0.1 -n 2 -w 1000 >nul
15@ping 127.0.0.1 -n %1 -w 1000 >nul
16@exit /B 0
17""")
18
19t.write("file.jam", """\
20if $(NT)
21{
22    actions sleeper
23    {
24        echo [$(<:S)] 0
25        call sleep.bat 1
26        echo [$(<:S)] 1
27        call sleep.bat 1
28        echo [$(<:S)] 2
29        call sleep.bat $(<:B)
30    }
31}
32else
33{
34    actions sleeper
35    {
36        echo "[$(<:S)] 0"
37        sleep 1
38        echo "[$(<:S)] 1"
39        sleep 1
40        echo "[$(<:S)] 2"
41        sleep $(<:B)
42    }
43}
44
45rule sleeper
46{
47    DEPENDS $(<) : $(>) ;
48}
49
50NOTFILE front ;
51sleeper 1.a : front ;
52sleeper 2.a : front ;
53sleeper 3.a : front ;
54sleeper 4.a : front ;
55NOTFILE choke ;
56DEPENDS choke : 1.a 2.a 3.a 4.a ;
57sleeper 1.b : choke ;
58sleeper 2.b : choke ;
59sleeper 3.b : choke ;
60sleeper 4.b : choke ;
61DEPENDS bottom : 1.b 2.b 3.b 4.b ;
62DEPENDS all : bottom ;
63""")
64
65t.run_build_system(["-ffile.jam", "-j4"], stdout="""\
66...found 12 targets...
67...updating 8 targets...
68sleeper 1.a
69[.a] 0
70[.a] 1
71[.a] 2
72sleeper 2.a
73[.a] 0
74[.a] 1
75[.a] 2
76sleeper 3.a
77[.a] 0
78[.a] 1
79[.a] 2
80sleeper 4.a
81[.a] 0
82[.a] 1
83[.a] 2
84sleeper 1.b
85[.b] 0
86[.b] 1
87[.b] 2
88sleeper 2.b
89[.b] 0
90[.b] 1
91[.b] 2
92sleeper 3.b
93[.b] 0
94[.b] 1
95[.b] 2
96sleeper 4.b
97[.b] 0
98[.b] 1
99[.b] 2
100...updated 8 targets...
101""")
102
103t.cleanup()
104