Removes the old DLL solution.

pull/496/merge
zhanyong.wan 15 years ago
parent 1ec9268dfd
commit f3feb338ef
  1. 5
      Makefile.am
  2. 122
      msvc/gtest.def
  3. 169
      scripts/generate_gtest_def.py

@ -13,7 +13,6 @@ EXTRA_DIST = \
make/Makefile \
scripts/fuse_gtest_files.py \
scripts/gen_gtest_pred_impl.py \
scripts/generate_gtest_def.py \
scripts/test/Makefile
# gtest source files that we don't compile directly.
@ -122,8 +121,7 @@ EXTRA_DIST += \
msvc/gtest_prod_test-md.vcproj \
msvc/gtest_prod_test.vcproj \
msvc/gtest_unittest-md.vcproj \
msvc/gtest_unittest.vcproj \
msvc/gtest.def
msvc/gtest_unittest.vcproj
# xcode project files
EXTRA_DIST += \
@ -141,6 +139,7 @@ EXTRA_DIST += \
# xcode sample files
EXTRA_DIST += \
xcode/Samples/FrameworkSample/Info.plist \
xcode/Samples/FrameworkSample/runtests.sh \
xcode/Samples/FrameworkSample/widget_test.cc \
xcode/Samples/FrameworkSample/widget.cc \
xcode/Samples/FrameworkSample/widget.h \

@ -1,122 +0,0 @@
; This file is auto-generated. DO NOT EDIT DIRECTLY.
; For more information, see scripts/generate_gtest_def.py.
LIBRARY
EXPORTS
??0AssertHelper@internal@testing@@QAE@W4Type@TestPartResult@2@PBDH1@Z
??0AssertionResult@testing@@QAE@ABV01@@Z
??0ExitedWithCode@testing@@QAE@H@Z
??0GTestLog@internal@testing@@QAE@W4GTestLogSeverity@12@PBDH@Z
??0HasNewFatalFailureHelper@internal@testing@@QAE@XZ
??0ScopedFakeTestPartResultReporter@testing@@QAE@W4InterceptMode@01@PAVTestPartResultArray@1@@Z
??0ScopedTrace@internal@testing@@QAE@PBDHABVMessage@2@@Z
??0SingleFailureChecker@internal@testing@@QAE@PBVTestPartResultArray@2@W4Type@TestPartResult@2@PBD@Z
??0Test@testing@@IAE@XZ
??1AssertHelper@internal@testing@@QAE@XZ
??1GTestLog@internal@testing@@QAE@XZ
??1HasNewFatalFailureHelper@internal@testing@@UAE@XZ
??1RE@internal@testing@@QAE@XZ
??1ScopedFakeTestPartResultReporter@testing@@UAE@XZ
??1ScopedTrace@internal@testing@@QAE@XZ
??1SingleFailureChecker@internal@testing@@QAE@XZ
??1Test@testing@@UAE@XZ
??4AssertHelper@internal@testing@@QBEXABVMessage@2@@Z
??6Message@testing@@QAEAAV01@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z
??7AssertionResult@testing@@QBE?AV01@XZ
??RExitedWithCode@testing@@QBE_NH@Z
?AddEnvironment@UnitTest@testing@@AAEPAVEnvironment@2@PAV32@@Z
?AlwaysTrue@internal@testing@@YA_NXZ
?Append@TestEventListeners@testing@@QAEXPAVTestEventListener@2@@Z
?AssertionFailure@testing@@YA?AVAssertionResult@1@ABVMessage@1@@Z
?AssertionFailure@testing@@YA?AVAssertionResult@1@XZ
?AssertionSuccess@testing@@YA?AVAssertionResult@1@XZ
?CmpHelperSTRCASEEQ@internal@testing@@YA?AVAssertionResult@2@PBD000@Z
?CmpHelperSTRCASENE@internal@testing@@YA?AVAssertionResult@2@PBD000@Z
?CmpHelperSTREQ@internal@testing@@YA?AVAssertionResult@2@PBD000@Z
?CmpHelperSTREQ@internal@testing@@YA?AVAssertionResult@2@PBD0PB_W1@Z
?CmpHelperSTRNE@internal@testing@@YA?AVAssertionResult@2@PBD000@Z
?CmpHelperSTRNE@internal@testing@@YA?AVAssertionResult@2@PBD0PB_W1@Z
?Compare@String@internal@testing@@QBEHABV123@@Z
?Create@DeathTest@internal@testing@@SA_NPBDPBVRE@23@0HPAPAV123@@Z
?DoubleLE@testing@@YA?AVAssertionResult@1@PBD0NN@Z
?DoubleNearPredFormat@internal@testing@@YA?AVAssertionResult@2@PBD00NNN@Z
?EqFailure@internal@testing@@YA?AVAssertionResult@2@PBD0ABVString@12@1_N@Z
?ExitedUnsuccessfully@internal@testing@@YA_NH@Z
?FLAGS_gtest_also_run_disabled_tests@testing@@3_NA
?FLAGS_gtest_break_on_failure@testing@@3_NA
?FLAGS_gtest_catch_exceptions@testing@@3_NA
?FLAGS_gtest_color@testing@@3VString@internal@1@A
?FLAGS_gtest_filter@testing@@3VString@internal@1@A
?FLAGS_gtest_output@testing@@3VString@internal@1@A
?FLAGS_gtest_print_time@testing@@3_NA
?FLAGS_gtest_random_seed@testing@@3HA
?FLAGS_gtest_repeat@testing@@3HA
?FLAGS_gtest_shuffle@testing@@3_NA
?FLAGS_gtest_stack_trace_depth@testing@@3HA
?FLAGS_gtest_throw_on_failure@testing@@3_NA
?Failed@TestResult@testing@@QBE_NXZ
?Failed@UnitTest@testing@@QBE_NXZ
?FloatLE@testing@@YA?AVAssertionResult@1@PBD0MM@Z
?Format@String@internal@testing@@SA?AV123@PBDZZ
?FormatForFailureMessage@internal@testing@@YA?AVString@12@D@Z
?GetBoolAssertionFailureMessage@internal@testing@@YA?AVString@12@ABVAssertionResult@2@PBD11@Z
?GetInstance@UnitTest@testing@@SAPAV12@XZ
?GetTestCase@UnitTest@testing@@QBEPBVTestCase@2@H@Z
?GetTestInfo@TestCase@testing@@QBEPBVTestInfo@2@H@Z
?GetTestPartResult@TestResult@testing@@QBEABVTestPartResult@2@H@Z
?GetTestProperty@TestResult@testing@@QBEABVTestProperty@2@H@Z
?GetTestTypeId@internal@testing@@YAPBXXZ
?HasFatalFailure@Test@testing@@SA_NXZ
?HasFatalFailure@TestResult@testing@@QBE_NXZ
?HasNonfatalFailure@Test@testing@@SA_NXZ
?HasNonfatalFailure@TestResult@testing@@QBE_NXZ
?Init@RE@internal@testing@@AAEXPBD@Z
?InitGoogleTest@testing@@YAXPAHPAPAD@Z
?InitGoogleTest@testing@@YAXPAHPAPA_W@Z
?IsHRESULTFailure@internal@testing@@YA?AVAssertionResult@2@PBDJ@Z
?IsHRESULTSuccess@internal@testing@@YA?AVAssertionResult@2@PBDJ@Z
?IsTrue@internal@testing@@YA_N_N@Z
?LastMessage@DeathTest@internal@testing@@SAPBDXZ
?MakeAndRegisterTestInfo@internal@testing@@YAPAVTestInfo@2@PBD000PBXP6AXXZ2PAVTestFactoryBase@12@@Z
?Passed@UnitTest@testing@@QBE_NXZ
?RecordProperty@Test@testing@@SAXPBD0@Z
?Release@TestEventListeners@testing@@QAEPAVTestEventListener@2@PAV32@@Z
?ReportInvalidTestCaseType@internal@testing@@YAXPBD0H@Z
?Run@UnitTest@testing@@QAEHXZ
?SetUp@Test@testing@@MAEXXZ
?ShowCStringQuoted@String@internal@testing@@SA?AV123@PBD@Z
?ShowWideCStringQuoted@String@internal@testing@@SA?AV123@PB_W@Z
?StrStreamToString@internal@testing@@YA?AVString@12@PAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
?TearDown@Test@testing@@MAEXXZ
?VerifyRegisteredTestNames@TypedTestCasePState@internal@testing@@QAEPBDPBDH0@Z
?comment@TestInfo@testing@@QBEPBDXZ
?current_test_case@UnitTest@testing@@QBEPBVTestCase@2@XZ
?current_test_info@UnitTest@testing@@QBEPBVTestInfo@2@XZ
?disabled_test_count@TestCase@testing@@QBEHXZ
?disabled_test_count@UnitTest@testing@@QBEHXZ
?elapsed_time@UnitTest@testing@@QBE_JXZ
?failed_test_case_count@UnitTest@testing@@QBEHXZ
?failed_test_count@TestCase@testing@@QBEHXZ
?failed_test_count@UnitTest@testing@@QBEHXZ
?g_linked_ptr_mutex@internal@testing@@3VMutex@12@A
?listeners@UnitTest@testing@@QAEAAVTestEventListeners@2@XZ
?name@TestInfo@testing@@QBEPBDXZ
?original_working_dir@UnitTest@testing@@QBEPBDXZ
?parameterized_test_registry@UnitTest@testing@@QAEAAVParameterizedTestCaseRegistry@internal@2@XZ
?random_seed@UnitTest@testing@@QBEHXZ
?result@TestInfo@testing@@QBEPBVTestResult@2@XZ
?should_run@TestInfo@testing@@QBE_NXZ
?successful_test_case_count@UnitTest@testing@@QBEHXZ
?successful_test_count@TestCase@testing@@QBEHXZ
?successful_test_count@UnitTest@testing@@QBEHXZ
?test_case_comment@TestInfo@testing@@QBEPBDXZ
?test_case_name@TestInfo@testing@@QBEPBDXZ
?test_case_to_run_count@UnitTest@testing@@QBEHXZ
?test_property_count@TestResult@testing@@QBEHXZ
?test_to_run_count@TestCase@testing@@QBEHXZ
?test_to_run_count@UnitTest@testing@@QBEHXZ
?total_part_count@TestResult@testing@@QBEHXZ
?total_test_case_count@UnitTest@testing@@QBEHXZ
?total_test_count@TestCase@testing@@QBEHXZ
?total_test_count@UnitTest@testing@@QBEHXZ

@ -1,169 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Generates the gtest.def file to build Google Test as a DLL on Windows.
SYNOPSIS
Put diagnostic messages from building gtest_dll_test_.exe into
BUILD_RESULTS_FILE and invoke
generate_gtest_def.py <BUILD_RESULTS_FILE
Reads output of VC++ linker and re-generates the src/gtest.def file
required for building gtest as a DLL.
Use this script if you modify Google Test's source code and Visual
Studio linker starts complaining about unresolved external symbols.
You may have to repeate the build/re-generate cycle several times
because VC++ limits the number of unresolved external symbols it can
report at a time.
EXAMPLES
scons\scons.py | scripts\generate_gtest_def.py
This tool is experimental. Please report any problems to
googletestframework@googlegroups.com. You can read
http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide for more
information.
"""
__author__ = 'vladl@google.com (Vlad Losev)'
import os
import re
import sets
import sys
# We assume that this file is in the scripts/ directory in the Google
# Test root directory.
GTEST_DEF_PATH = os.path.join(os.path.dirname(__file__), '../msvc/gtest.def')
# Locates the header of the EXPORTS section.
EXPORTS_SECTION_REGEX = re.compile(r'^EXPORTS\s*$', re.IGNORECASE)
# Determines if a line looks like an export definition in the EXPORTS
# section of a module definition file.
EXPORT_REGEX = re.compile(r'^\s+(\S+)')
# Determines if a given line contains an error message about unresolved
# linker symbol.
IS_UNRESOLVED_SYMBOL_REGEX = re.compile(r'\bunresolved external symbol\b')
# Fetches the symbol name from a line that contains an unresolved linker
# symbol message.
UNRESOLVED_SYMBOL_REGEX = re.compile(r'^.*?"[^"]+" \((\S+)\)')
def ReadDefExports(stream):
"""Reads contents of a def file and returns a list of exported symbols."""
is_export = False
exports = sets.Set()
for line in stream:
if EXPORTS_SECTION_REGEX.match(line):
is_export = True
elif EXPORT_REGEX.match(line):
if is_export:
exports.add(EXPORT_REGEX.match(line).group(1))
else:
is_export = False
return exports
def ReadUnresolvedExternals(stream):
"""Reads linker output and returns list of unresolved linker symbols."""
unresolved = sets.Set()
for line in stream:
if IS_UNRESOLVED_SYMBOL_REGEX.search(line):
unresolved.add(UNRESOLVED_SYMBOL_REGEX.match(line).group(1))
return unresolved
def AdjustExports(exports, unresolved):
"""Adjusts exports list based on the list of unresolved symbols."""
if unresolved & exports:
# There are symbols that are listed as exported but are also reported
# unresolved. This is most likely because they have been removed from
# Google Test but their mentions in gtest.def constitute references. We
# need to remove such symbols from the EXPORTS section. Also, their
# presence means that the Google Test DLL has failed to link and
# consequently linking of the test .exe was not attempted, meaning that
# at this time, there will be no unresolved externals that need to be
# added to the exports list.
exports -= unresolved
else:
# Finding unresolved exports means that the Google Test DLL had link
# errors and the build script did not build gtest_dll_test_.exe. The user
# has to build the test once again and run this script on the diagnostic
# output of the build.
exports |= unresolved
return exports
def WriteGtestDefFile(stream, exports):
"""Writes contents of gtest.def given a list of exported symbols."""
stream.write('; This file is auto-generated. DO NOT EDIT DIRECTLY.\n'
'; For more information, see scripts/generate_gtest_def.py.\n'
'\nLIBRARY\n'
'\nEXPORTS\n')
for symbol in sorted(exports):
stream.write(' %s\n' % symbol)
def main():
unresolved = ReadUnresolvedExternals(sys.stdin)
if unresolved:
try:
gtest_def = open(GTEST_DEF_PATH, 'r')
exports = ReadDefExports(gtest_def)
gtest_def.close()
except IOError:
exports = sets.Set()
exports = AdjustExports(exports, unresolved)
WriteGtestDefFile(open(GTEST_DEF_PATH, 'w'), exports)
sys.stderr.write('Updated gtest.def. Please clean the .dll file\n'
'produced by your Google Test DLL build, run the build\n'
'again and pass its diagnostic output to this script\n'
'unless the build succeeds.\n')
else:
sys.stderr.write('The build diagnostic output indicates no unresolved\n'
'externals. gtest.def is likely up to date and\n'
'has not been updated.\n')
if __name__ == '__main__':
main()
Loading…
Cancel
Save