Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012 Google Inc. All rights reserved. | 3 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 Make sure optimization settings are extracted properly. | 8 Make sure optimization settings are extracted properly. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import TestGyp | 11 import TestGyp |
| 12 | 12 |
| 13 import sys | 13 import sys |
| 14 | 14 |
| 15 if sys.platform == 'win32': | 15 if sys.platform == 'win32': |
| 16 test = TestGyp.TestGyp(formats=['ninja']) | 16 test = TestGyp.TestGyp(formats=['ninja']) |
| 17 | 17 |
| 18 CHDIR = 'compiler-flags' | 18 CHDIR = 'compiler-flags' |
| 19 test.run_gyp('optimizations.gyp', chdir=CHDIR) | 19 test.run_gyp('optimizations.gyp', chdir=CHDIR) |
| 20 | 20 |
| 21 # It's hard to map flags to output contents in a non-fragile way (especially | 21 # It's hard to map flags to output contents in a non-fragile way (especially |
| 22 # handling both 2008/2010), so just verify the correct ninja command line | 22 # handling both 2008/2010), so just verify the correct ninja command line |
| 23 # contents. | 23 # contents. |
| 24 | 24 |
| 25 ninja_file = test.built_file_path('obj/test_opt_off.ninja', chdir=CHDIR) | 25 ninja_file = test.built_file_path('obj/test_opt_off.ninja', chdir=CHDIR) |
| 26 test.must_contain(ninja_file, 'cflags = /Od') | 26 test.must_contain(ninja_file, 'cflags = /Od') |
| 27 | 27 |
| 28 ninja_file = test.built_file_path('obj/test_opt_level_s.ninja', chdir=CHDIR) | 28 ninja_file = test.built_file_path('obj/test_opt_lev_size.ninja', chdir=CHDIR) |
| 29 test.must_contain(ninja_file, 'cflags = /Os') | 29 test.must_contain(ninja_file, 'cflags = /O1') |
| 30 | |
| 31 ninja_file = test.built_file_path('obj/test_opt_lev_speed.ninja', chdir=CHDIR) | |
| 32 test.must_contain(ninja_file, 'cflags = /O2') | |
| 33 | |
| 34 ninja_file = test.built_file_path('obj/test_opt_lev_max.ninja', chdir=CHDIR) | |
| 35 test.must_contain(ninja_file, 'cflags = /Ox') | |
| 30 | 36 |
| 31 ninja_file = test.built_file_path('obj/test_opt_unset.ninja', chdir=CHDIR) | 37 ninja_file = test.built_file_path('obj/test_opt_unset.ninja', chdir=CHDIR) |
| 32 test.must_not_contain(ninja_file, '/Os') | 38 test.must_not_contain(ninja_file, '/O1') |
| 39 test.must_not_contain(ninja_file, '/O2') | |
| 40 test.must_not_contain(ninja_file, '/Od') | |
|
Nico
2012/05/06 20:16:47
nit: Od, O1, O2, Ox (to match order above)
| |
| 33 test.must_not_contain(ninja_file, '/Ox') | 41 test.must_not_contain(ninja_file, '/Ox') |
| 34 test.must_not_contain(ninja_file, '/Od') | |
| 35 | 42 |
| 36 ninja_file = test.built_file_path('obj/test_opt_fpo.ninja', chdir=CHDIR) | 43 ninja_file = test.built_file_path('obj/test_opt_fpo.ninja', chdir=CHDIR) |
| 37 test.must_contain(ninja_file, '/Oy') | 44 test.must_contain(ninja_file, '/Oy') |
| 38 test.must_not_contain(ninja_file, '/Oy-') | 45 test.must_not_contain(ninja_file, '/Oy-') |
| 39 | 46 |
| 40 ninja_file = test.built_file_path('obj/test_opt_fpo_off.ninja', chdir=CHDIR) | 47 ninja_file = test.built_file_path('obj/test_opt_fpo_off.ninja', chdir=CHDIR) |
| 41 test.must_contain(ninja_file, '/Oy-') | 48 test.must_contain(ninja_file, '/Oy-') |
| 42 | 49 |
| 43 ninja_file = test.built_file_path('obj/test_opt_inline_off.ninja', | 50 ninja_file = test.built_file_path('obj/test_opt_inline_off.ninja', |
| 44 chdir=CHDIR) | 51 chdir=CHDIR) |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 58 | 65 |
| 59 ninja_file = test.built_file_path('obj/test_opt_speed.ninja', | 66 ninja_file = test.built_file_path('obj/test_opt_speed.ninja', |
| 60 chdir=CHDIR) | 67 chdir=CHDIR) |
| 61 test.must_contain(ninja_file, '/Ot') | 68 test.must_contain(ninja_file, '/Ot') |
| 62 | 69 |
| 63 ninja_file = test.built_file_path('obj/test_opt_wpo.ninja', | 70 ninja_file = test.built_file_path('obj/test_opt_wpo.ninja', |
| 64 chdir=CHDIR) | 71 chdir=CHDIR) |
| 65 test.must_contain(ninja_file, '/GL') | 72 test.must_contain(ninja_file, '/GL') |
| 66 | 73 |
| 67 test.pass_test() | 74 test.pass_test() |
| OLD | NEW |