@@ -42,6 +42,14 @@ def default_args(self):
42
42
verbose_build = False ,
43
43
build_ninja = False )
44
44
45
+ def which_ninja (self , args ):
46
+ toolchain = host_toolchain ()
47
+ if toolchain .ninja is not None :
48
+ return '/path/to/installed/ninja'
49
+ # Maybe we'll build a ninja, maybe we wont.
50
+ # Fake it anyway for the tests.
51
+ return '/path/to/built/ninja'
52
+
45
53
def cmake (self , args ):
46
54
"""Return new CMake object initialized with given args
47
55
"""
@@ -50,8 +58,7 @@ def cmake(self, args):
50
58
toolchain .cxx = args .host_cxx
51
59
if args .distcc :
52
60
toolchain .distcc = self .mock_distcc_path ()
53
- if args .build_ninja :
54
- toolchain .ninja = '/path/to/built/ninja'
61
+ toolchain .ninja = self .which_ninja (args )
55
62
return CMake (args = args , toolchain = toolchain )
56
63
57
64
def test_common_options_defaults (self ):
@@ -61,7 +68,8 @@ def test_common_options_defaults(self):
61
68
list (cmake .common_options ()),
62
69
["-G" , "Ninja" ,
63
70
"-DCMAKE_C_COMPILER:PATH=/path/to/clang" ,
64
- "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ])
71
+ "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
72
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
65
73
66
74
def test_common_options_asan (self ):
67
75
args = self .default_args ()
@@ -72,7 +80,8 @@ def test_common_options_asan(self):
72
80
["-G" , "Ninja" ,
73
81
"-DLLVM_USE_SANITIZER=Address" ,
74
82
"-DCMAKE_C_COMPILER:PATH=/path/to/clang" ,
75
- "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ])
83
+ "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
84
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
76
85
77
86
def test_common_options_ubsan (self ):
78
87
args = self .default_args ()
@@ -83,7 +92,8 @@ def test_common_options_ubsan(self):
83
92
["-G" , "Ninja" ,
84
93
"-DLLVM_USE_SANITIZER=Undefined" ,
85
94
"-DCMAKE_C_COMPILER:PATH=/path/to/clang" ,
86
- "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ])
95
+ "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
96
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
87
97
88
98
def test_common_options_tsan (self ):
89
99
args = self .default_args ()
@@ -94,7 +104,8 @@ def test_common_options_tsan(self):
94
104
["-G" , "Ninja" ,
95
105
"-DLLVM_USE_SANITIZER=Thread" ,
96
106
"-DCMAKE_C_COMPILER:PATH=/path/to/clang" ,
97
- "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ])
107
+ "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
108
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
98
109
99
110
def test_common_options_asan_ubsan (self ):
100
111
args = self .default_args ()
@@ -106,7 +117,8 @@ def test_common_options_asan_ubsan(self):
106
117
["-G" , "Ninja" ,
107
118
"-DLLVM_USE_SANITIZER=Address;Undefined" ,
108
119
"-DCMAKE_C_COMPILER:PATH=/path/to/clang" ,
109
- "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ])
120
+ "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
121
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
110
122
111
123
def test_common_options_ubsan_tsan (self ):
112
124
args = self .default_args ()
@@ -118,7 +130,8 @@ def test_common_options_ubsan_tsan(self):
118
130
["-G" , "Ninja" ,
119
131
"-DLLVM_USE_SANITIZER=Undefined;Thread" ,
120
132
"-DCMAKE_C_COMPILER:PATH=/path/to/clang" ,
121
- "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ])
133
+ "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
134
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
122
135
123
136
def test_common_options_asan_ubsan_tsan (self ):
124
137
args = self .default_args ()
@@ -131,7 +144,8 @@ def test_common_options_asan_ubsan_tsan(self):
131
144
["-G" , "Ninja" ,
132
145
"-DLLVM_USE_SANITIZER=Address;Undefined;Thread" ,
133
146
"-DCMAKE_C_COMPILER:PATH=/path/to/clang" ,
134
- "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ])
147
+ "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
148
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
135
149
136
150
def test_common_options_export_compile_commands (self ):
137
151
args = self .default_args ()
@@ -142,7 +156,8 @@ def test_common_options_export_compile_commands(self):
142
156
["-G" , "Ninja" ,
143
157
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" ,
144
158
"-DCMAKE_C_COMPILER:PATH=/path/to/clang" ,
145
- "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ])
159
+ "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
160
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
146
161
147
162
def test_common_options_distcc (self ):
148
163
args = self .default_args ()
@@ -154,7 +169,8 @@ def test_common_options_distcc(self):
154
169
"-DCMAKE_C_COMPILER:PATH=" + self .mock_distcc_path (),
155
170
"-DCMAKE_C_COMPILER_ARG1=/path/to/clang" ,
156
171
"-DCMAKE_CXX_COMPILER:PATH=" + self .mock_distcc_path (),
157
- "-DCMAKE_CXX_COMPILER_ARG1=/path/to/clang++" ])
172
+ "-DCMAKE_CXX_COMPILER_ARG1=/path/to/clang++" ,
173
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
158
174
159
175
def test_common_options_xcode (self ):
160
176
args = self .default_args ()
@@ -181,7 +197,8 @@ def test_common_options_clang_compiler_version(self):
181
197
"-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
182
198
"-DLLVM_VERSION_MAJOR:STRING=3" ,
183
199
"-DLLVM_VERSION_MINOR:STRING=8" ,
184
- "-DLLVM_VERSION_PATCH:STRING=0" ])
200
+ "-DLLVM_VERSION_PATCH:STRING=0" ,
201
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
185
202
186
203
def test_common_options_build_ninja (self ):
187
204
args = self .default_args ()
@@ -192,7 +209,7 @@ def test_common_options_build_ninja(self):
192
209
["-G" , "Ninja" ,
193
210
"-DCMAKE_C_COMPILER:PATH=/path/to/clang" ,
194
211
"-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
195
- "-DCMAKE_MAKE_PROGRAM=/path/to/built/ninja" ])
212
+ "-DCMAKE_MAKE_PROGRAM=" + self . which_ninja ( args ) ])
196
213
197
214
def test_common_options_full (self ):
198
215
args = self .default_args ()
0 commit comments