OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import itertools | 6 import itertools |
7 | 7 |
8 import make_shaders | 8 import make_shaders |
9 | 9 |
10 Help('''\ | 10 Help('''\ |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 # Define a library to be used by tests. | 170 # Define a library to be used by tests. |
171 srcs = Split('''\ | 171 srcs = Split('''\ |
172 mock_gl_interface.cc | 172 mock_gl_interface.cc |
173 mock_x_connection.cc | 173 mock_x_connection.cc |
174 test_lib.cc | 174 test_lib.cc |
175 ''') | 175 ''') |
176 libtest = wm_env.Library('test', Split(srcs)) | 176 libtest = wm_env.Library('test', Split(srcs)) |
177 | 177 |
178 wm_env.Prepend(LIBS=[libwm_core, libwm_ipc]) | 178 wm_env.Prepend(LIBS=[libwm_core, libwm_ipc]) |
179 if 'USE_BREAKPAD' in ARGUMENTS: | |
180 wm_env.Append(CPPDEFINES=['USE_BREAKPAD'], LIBS=['libbreakpad']) | |
181 | 179 |
182 backend_defines = {'opengl': ['COMPOSITOR_OPENGL'], | 180 backend_defines = {'opengl': ['COMPOSITOR_OPENGL'], |
183 'opengles': ['COMPOSITOR_OPENGLES']} | 181 'opengles': ['COMPOSITOR_OPENGLES']} |
184 wm_env.Append(CPPDEFINES=backend_defines[backend]) | 182 wm_env.Append(CPPDEFINES=backend_defines[backend]) |
185 | 183 |
| 184 # Do not include crash dumper in the unit test environment |
| 185 test_env = wm_env.Clone() |
| 186 wm_env.Append(LIBS=['libcrash']) |
| 187 |
186 wm_env.Program('wm', 'main.cc') | 188 wm_env.Program('wm', 'main.cc') |
187 | 189 |
188 test_env = wm_env.Clone() | |
189 test_env.Append(LIBS=['gtest']) | 190 test_env.Append(LIBS=['gtest']) |
190 # libtest needs to be listed first since it depends on wm_core and wm_ipc. | 191 # libtest needs to be listed first since it depends on wm_core and wm_ipc. |
191 test_env.Prepend(LIBS=[libtest]) | 192 test_env.Prepend(LIBS=[libtest]) |
192 tests = [] | 193 tests = [] |
193 | 194 |
194 # These are tests that only get built when we use particular backends | 195 # These are tests that only get built when we use particular backends |
195 backend_tests = {'opengl': ['real_compositor_test.cc', | 196 backend_tests = {'opengl': ['real_compositor_test.cc', |
196 'opengl_visitor_test.cc'], | 197 'opengl_visitor_test.cc'], |
197 'opengles': []} | 198 'opengles': []} |
198 all_backend_tests = set(itertools.chain(*backend_tests.values())) | 199 all_backend_tests = set(itertools.chain(*backend_tests.values())) |
199 for test_src in Glob('*_test.cc', strings=True): | 200 for test_src in Glob('*_test.cc', strings=True): |
200 if test_src in all_backend_tests and test_src not in backend_tests[backend]: | 201 if test_src in all_backend_tests and test_src not in backend_tests[backend]: |
201 continue | 202 continue |
202 tests += test_env.Program(test_src) | 203 tests += test_env.Program(test_src) |
203 # Create a 'tests' target that will build all tests. | 204 # Create a 'tests' target that will build all tests. |
204 test_env.Alias('tests', tests) | 205 test_env.Alias('tests', tests) |
205 | 206 |
206 # mock_chrome is just a small program that developers can use to test | 207 # mock_chrome is just a small program that developers can use to test |
207 # interaction between the window manager and Chrome. We only define a | 208 # interaction between the window manager and Chrome. We only define a |
208 # target for it if gtkmm is installed so that this SConstruct file can | 209 # target for it if gtkmm is installed so that this SConstruct file can |
209 # still be parsed in the chroot build environment, which shouldn't contain | 210 # still be parsed in the chroot build environment, which shouldn't contain |
210 # gtkmm. | 211 # gtkmm. |
211 if os.system('pkg-config --exists gtkmm-2.4') == 0: | 212 if os.system('pkg-config --exists gtkmm-2.4') == 0: |
212 mock_chrome_env = wm_env.Clone() | 213 mock_chrome_env = wm_env.Clone() |
213 mock_chrome_env.ParseConfig('pkg-config --cflags --libs gtkmm-2.4') | 214 mock_chrome_env.ParseConfig('pkg-config --cflags --libs gtkmm-2.4') |
214 mock_chrome_env.Program('mock_chrome', 'mock_chrome.cc') | 215 mock_chrome_env.Program('mock_chrome', 'mock_chrome.cc') |
OLD | NEW |