1#!/usr/bin/env python
2
3# Copyright (c) 2013 Google Inc. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7"""
8Make sure mapfile settings are extracted properly.
9"""
10
11import TestGyp
12
13import sys
14
15if sys.platform == 'win32':
16  test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
17
18  CHDIR = 'linker-flags'
19  test.run_gyp('mapfile.gyp', chdir=CHDIR)
20  test.build('mapfile.gyp', test.ALL, chdir=CHDIR)
21
22  map_file = test.built_file_path('test_mapfile_unset.map', chdir=CHDIR)
23  test.must_not_exist(map_file)
24
25  map_file = test.built_file_path('test_mapfile_generate.map', chdir=CHDIR)
26  test.must_exist(map_file)
27  test.must_contain(map_file, '?AnExportedFunction@@YAXXZ')
28  test.must_not_contain(map_file, 'void __cdecl AnExportedFunction(void)')
29
30  map_file = test.built_file_path('test_mapfile_generate_exports.map',
31          chdir=CHDIR)
32  test.must_exist(map_file)
33  test.must_contain(map_file, 'void __cdecl AnExportedFunction(void)')
34
35  map_file = test.built_file_path('test_mapfile_generate_filename.map',
36          chdir=CHDIR)
37  test.must_not_exist(map_file)
38
39  map_file = test.built_file_path('custom_file_name.map', chdir=CHDIR)
40  test.must_exist(map_file)
41  test.must_contain(map_file, '?AnExportedFunction@@YAXXZ')
42  test.must_not_contain(map_file, 'void __cdecl AnExportedFunction(void)')
43
44  test.pass_test()
45