Index: test/win/gyptest-link-ltcg.py |
=================================================================== |
--- test/win/gyptest-link-ltcg.py (revision 0) |
+++ test/win/gyptest-link-ltcg.py (revision 0) |
@@ -0,0 +1,42 @@ |
+#!/usr/bin/env python |
+ |
+# Copyright (c) 2013 Google Inc. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+""" |
+Make sure LTCG setting is extracted properly. |
+""" |
+ |
+import TestGyp |
+ |
+import sys |
+import time |
+ |
+if sys.platform == 'win32': |
+ test = TestGyp.TestGyp(formats=['msvs', 'ninja']) |
+ |
+ CHDIR = 'linker-flags' |
+ test.run_gyp('ltcg.gyp', chdir=CHDIR) |
+ |
+ if test.format == 'ninja': |
scottmg
2013/11/23 17:15:13
would it be possible to test some effect, rather t
yukawa
2013/11/25 14:04:12
OK. Added some working samples as pgo.gyp. PTAL?
|
+ def GetNinjaFile(ltcg_option): |
+ return test.built_file_path('obj/test_ltcg_%s.ninja' % ltcg_option, |
+ chdir=CHDIR) |
+ test.must_not_contain(GetNinjaFile('default'), '/LTCG') |
+ test.must_contain(GetNinjaFile('use'), '/LTCG') |
+ test.must_contain(GetNinjaFile('instrument'), '/LTCG:PGINSTRUMENT') |
+ test.must_contain(GetNinjaFile('optimize'), '/LTCG:PGOPTIMIZE') |
+ test.must_contain(GetNinjaFile('update'), '/LTCG:PGUPDATE') |
+ elif test.format == 'msvs': |
+ def AssertLTCGOption(ltcg_option, value): |
+ return test.built_file_path('test_ltcg_%s.vcxproj' % ltcg_option, |
+ chdir=CHDIR) |
+ LTCG_FORMAT = '<LinkTimeCodeGeneration>%s</LinkTimeCodeGeneration>' |
+ test.must_contain(vcproj, LTCG_FORMAT % ltcg_option) |
+ AssertLTCGOption('default', 'Default') |
+ AssertLTCGOption('use', 'UseLinkTimeCodeGeneration') |
+ AssertLTCGOption('instrument', 'PGInstrument') |
+ AssertLTCGOption('optimize', 'PGOptimization') |
+ AssertLTCGOption('update', 'PGUpdate') |
+ test.pass_test() |