Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/build/v2/test/glob.py @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/usr/bin/python
2
3#  Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and
4#  distribute this software is granted provided this copyright notice appears in
5#  all copies. This software is provided "as is" without express or implied
6#  warranty, and with no claim as to its suitability for any purpose.
7
8#  Test the 'glob' rule in Jamfile context.
9from BoostBuild import Tester, List
10import os
11import string
12
13# Create a temporary working directory
14t = Tester()
15
16t.write("project-root.jam", """
17""")
18
19t.write("Jamfile", """
20""")
21
22t.write("d1/a.cpp", """
23int main() { return 0; }
24
25""")
26
27t.write("d1/Jamfile", """
28exe a : [ glob *.cpp ] ../d2/d//l ;
29""")
30
31t.write("d2/d/l.cpp", """
32#if defined(_WIN32)
33__declspec(dllexport)
34void force_import_lib_creation() {}
35#endif
36""")
37
38t.write("d2/d/Jamfile", """
39lib l : [ glob *.cpp ] ;
40""")
41
42t.write("d3/d/Jamfile", """
43exe a : [ glob ../*.cpp ] ;
44""")
45t.write("d3/a.cpp", """
46int main()
47{
48    return 0;
49}
50""")
51
52t.run_build_system(subdir="d1")
53t.expect_addition("d1/bin/$toolset/debug/a.exe")
54
55t.run_build_system(subdir="d3/d")
56t.expect_addition("d3/d/bin/$toolset/debug/a.exe")
57
58t.rm("d2/d/bin")
59t.run_build_system(subdir="d2/d")
60t.expect_addition("d2/d/bin/$toolset/debug/l.dll")
61
62# Test that when 'source-location' is explicitly-specified
63# glob works relatively to source location
64t.rm("d1")
65
66t.write("d1/src/a.cpp", """
67int main() { return 0; }
68
69""")
70
71t.write("d1/Jamfile", """
72project : source-location src ;
73exe a : [ glob *.cpp ] ../d2/d//l ;
74""")
75
76t.run_build_system(subdir="d1")
77t.expect_addition("d1/bin/$toolset/debug/a.exe")
78
79# Test that wildcards can include directories
80t.rm("d1")
81
82t.write("d1/src/foo/a.cpp", """
83void bar();
84int main() { bar(); return 0; }
85
86""")
87
88t.write("d1/src/bar/b.cpp", """
89void bar() {}
90
91""")
92
93
94t.write("d1/Jamfile", """
95project : source-location src ;
96exe a : [ glob foo/*.cpp bar/*.cpp ] ../d2/d//l ;
97""")
98
99t.run_build_system(subdir="d1")
100t.expect_addition("d1/bin/$toolset/debug/a.exe")
101
102# Test that 'glob' works with absolute names
103t.rm("d1/bin")
104
105# Note that to get current dir, we use bjam's PWD,
106# not Python's os.getcwd, because the former will
107# always return long path. The latter might return
108# short path, and that will confuse path.glob.
109t.write("d1/Jamfile", """
110project : source-location src ;
111local pwd = [ PWD ] ; # Always absolute
112exe a : [ glob $(pwd)/src/foo/*.cpp $(pwd)/src/bar/*.cpp ] ../d2/d//l ;
113""")
114
115t.run_build_system(subdir="d1")
116t.expect_addition("d1/bin/$toolset/debug/a.exe")
117
118
119t.cleanup()
Note: See TracBrowser for help on using the repository browser.