Index: test/win/gyptest-cl_function_level_linking.py |
diff --git a/test/win/gyptest-cl_function_level_linking.py b/test/win/gyptest-cl_function_level_linking.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..69a091d5510a1a02fd4174652912eb68d8adc6c7 |
--- /dev/null |
+++ b/test/win/gyptest-cl_function_level_linking.py |
@@ -0,0 +1,53 @@ |
+#!/usr/bin/env python |
+ |
+# Copyright (c) 2012 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 function-level linking setting is extracted properly. |
+""" |
+ |
+import TestGyp |
+ |
+import subprocess |
+import sys |
+ |
+if sys.platform == 'win32': |
+ test = TestGyp.TestGyp(formats=['ninja', 'msvs']) |
+ |
+ CHDIR = 'compiler_flags' |
+ test.run_gyp('function-level-linking.gyp', chdir=CHDIR) |
+ test.build('function-level-linking.gyp', test.ALL, chdir=CHDIR) |
+ |
+ def CheckForSectionString(binary, string): |
+ proc = subprocess.Popen(['dumpbin', '/headers', binary], |
+ stdout=subprocess.PIPE) |
+ output = proc.communicate()[0] |
+ assert not proc.returncode |
+ if string not in output: |
+ print 'Did not find "%s" in %s' % (string, binary) |
+ test.fail_test() |
+ |
+ def ObjName(proj, obj): |
+ if test.format == 'ninja': |
+ sep = '.' |
+ else: |
+ sep = '\\' |
+ return 'obj\\%s%s%s' % (proj, sep, obj) |
+ |
+ look_for = '''COMDAT; sym= "int __cdecl stripped_function''' |
+ CheckForSectionString( |
+ test.built_file_path(ObjName('test_fll_on', 'function_level_linking.obj'), |
+ chdir=CHDIR), |
+ look_for) |
+ |
+ if test.format == 'ninja': |
+ ninja_file = test.built_file_path('obj/test_fll_off.ninja', chdir=CHDIR) |
+ test.must_contain(ninja_file, 'cflags = /Gy-') |
+ |
+ ninja_file = test.built_file_path('obj/test_fll_on.ninja', chdir=CHDIR) |
+ test.must_contain(ninja_file, 'cflags = /Gy') |
+ test.must_not_contain(ninja_file, '/Gy-') |
+ |
+ test.pass_test() |