From ff7a685e82d917a61f55cba499aed960ee7e344c Mon Sep 17 00:00:00 2001 From: Peter Budai Date: Wed, 23 Mar 2016 16:56:40 +0100 Subject: [PATCH 1/4] Added option to completely skip parsing PDB files. This will turn off source locations in Test Explorer and GTA traits parsing. Regex-based traits will remain active, and not parsing PDB files will greatly speed up test discovery and execution in case of very large test binaries. The default option is to keep current behavior. --- GoogleTestAdapter/Core/Helpers/XmlOptions.cs | 2 ++ GoogleTestAdapter/Core/Options.cs | 9 ++++++++- .../Core/TestCases/TestCaseFactory.cs | 19 +++++++++++++++++-- .../Resources/AllTestSettings.gta.runsettings | 3 ++- .../TestAdapter/Settings/RunSettings.cs | 3 +++ .../GoogleTestExtensionOptionsPage.cs | 1 + .../OptionsPages/GeneralOptionsDialogPage.cs | 10 ++++++++++ 7 files changed, 43 insertions(+), 4 deletions(-) diff --git a/GoogleTestAdapter/Core/Helpers/XmlOptions.cs b/GoogleTestAdapter/Core/Helpers/XmlOptions.cs index b827d26ba..ca2dc2bc4 100644 --- a/GoogleTestAdapter/Core/Helpers/XmlOptions.cs +++ b/GoogleTestAdapter/Core/Helpers/XmlOptions.cs @@ -29,6 +29,7 @@ public interface IXmlOptions string BatchForTestTeardown { get; set; } string TraitsRegexesAfter { get; set; } string TraitsRegexesBefore { get; set; } + bool? ParseSymbolInformation { get; set; } bool? DebugMode { get; set; } } @@ -52,6 +53,7 @@ public static void GetUnsetValuesFrom(this IXmlOptions self, IXmlOptions other) self.BatchForTestTeardown = self.BatchForTestTeardown ?? other.BatchForTestTeardown; self.TraitsRegexesAfter = self.TraitsRegexesAfter ?? other.TraitsRegexesAfter; self.TraitsRegexesBefore = self.TraitsRegexesBefore ?? other.TraitsRegexesBefore; + self.ParseSymbolInformation = self.ParseSymbolInformation ?? other.ParseSymbolInformation; self.DebugMode = self.DebugMode ?? other.DebugMode; } } diff --git a/GoogleTestAdapter/Core/Options.cs b/GoogleTestAdapter/Core/Options.cs index 55c3d4d1b..fbc1046b9 100644 --- a/GoogleTestAdapter/Core/Options.cs +++ b/GoogleTestAdapter/Core/Options.cs @@ -152,7 +152,14 @@ public virtual List TraitsRegexesAfter } } - + public const string OptionParseSymbolInformation = "Parse symbol information"; + public const bool OptionParseSymbolInformationDefaultValue = true; + public const string OptionParseSymbolInformationDescription = + "Parse debug symbol information for test executables to obtain source location information and traits (defined via the macros in GTA_Traits.h).\n" + + "If this is set to false step 2 of traits discovery will be left out and only traits regexes will be effective."; + + public virtual bool ParseSymbolInformation => XmlOptions.ParseSymbolInformation ?? OptionParseSymbolInformationDefaultValue; + public const string OptionDebugMode = "Debug mode"; public const bool OptionDebugModeDefaultValue = false; public const string OptionDebugModeDescription = diff --git a/GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs b/GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs index fa4f87e4b..dc7bd170d 100644 --- a/GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs +++ b/GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs @@ -22,9 +22,16 @@ public TestCaseFactory(string executable, TestEnvironment testEnvironment) public IList CreateTestCases() { IList testCaseDescriptors = new ListTestsParser(TestEnvironment).ParseListTestsOutput(Executable); - List testCaseLocations = GetTestCaseLocations(testCaseDescriptors, TestEnvironment.Options.PathExtension); - return testCaseDescriptors.Select(descriptor => CreateTestCase(descriptor, testCaseLocations)).ToList(); + if (TestEnvironment.Options.ParseSymbolInformation) + { + List testCaseLocations = GetTestCaseLocations(testCaseDescriptors, TestEnvironment.Options.PathExtension); + return testCaseDescriptors.Select(descriptor => CreateTestCase(descriptor, testCaseLocations)).ToList(); + } + else + { + return testCaseDescriptors.Select(descriptor => CreateTestCase(descriptor)).ToList(); + } } private List GetTestCaseLocations(IList testCaseDescriptors, string pathExtension) @@ -49,6 +56,14 @@ private List GetTestCaseLocations(IList te return testCaseLocations; } + private TestCase CreateTestCase(TestCaseDescriptor descriptor) + { + var testCase = new TestCase( + descriptor.FullyQualifiedName, Executable, descriptor.DisplayName, "", 0); + testCase.Traits.AddRange(GetFinalTraits(descriptor.DisplayName, new List())); + return testCase; + } + private TestCase CreateTestCase(TestCaseDescriptor descriptor, List testCaseLocations) { TestCaseLocation location = testCaseLocations.FirstOrDefault( diff --git a/GoogleTestAdapter/Resources/AllTestSettings.gta.runsettings b/GoogleTestAdapter/Resources/AllTestSettings.gta.runsettings index 1a0efaa70..f5a2091e0 100644 --- a/GoogleTestAdapter/Resources/AllTestSettings.gta.runsettings +++ b/GoogleTestAdapter/Resources/AllTestSettings.gta.runsettings @@ -19,5 +19,6 @@ C:\fooDir;C:\barDir - + true + \ No newline at end of file diff --git a/GoogleTestAdapter/TestAdapter/Settings/RunSettings.cs b/GoogleTestAdapter/TestAdapter/Settings/RunSettings.cs index 217a8cfe6..27d043879 100644 --- a/GoogleTestAdapter/TestAdapter/Settings/RunSettings.cs +++ b/GoogleTestAdapter/TestAdapter/Settings/RunSettings.cs @@ -51,6 +51,9 @@ public RunSettings() public bool? DebugMode { get; set; } public bool ShouldSerializeDebugMode() { return DebugMode != null; } + public bool? ParseSymbolInformation { get; set; } + public bool ShouldSerializeParseSymbolInformation() { return ParseSymbolInformation != null; } + public string AdditionalTestExecutionParam { get; set; } public bool ShouldSerializeAdditionalTestExecutionParam() { return AdditionalTestExecutionParam != null; } diff --git a/GoogleTestAdapter/VsPackage/GoogleTestExtensionOptionsPage.cs b/GoogleTestAdapter/VsPackage/GoogleTestExtensionOptionsPage.cs index bdc469693..aab5816c7 100644 --- a/GoogleTestAdapter/VsPackage/GoogleTestExtensionOptionsPage.cs +++ b/GoogleTestAdapter/VsPackage/GoogleTestExtensionOptionsPage.cs @@ -61,6 +61,7 @@ private RunSettings GetRunSettingsFromOptionPages() runSettings.PathExtension = generalOptions.PathExtension; runSettings.TraitsRegexesBefore = generalOptions.TraitsRegexesBefore; runSettings.TraitsRegexesAfter = generalOptions.TraitsRegexesAfter; + runSettings.ParseSymbolInformation = generalOptions.ParseSymbolInformation; runSettings.DebugMode = generalOptions.DebugMode; runSettings.AdditionalTestExecutionParam = generalOptions.AdditionalTestExecutionParams; runSettings.BatchForTestSetup = generalOptions.BatchForTestSetup; diff --git a/GoogleTestAdapter/VsPackage/OptionsPages/GeneralOptionsDialogPage.cs b/GoogleTestAdapter/VsPackage/OptionsPages/GeneralOptionsDialogPage.cs index 2a5ded515..01a8f8bdf 100644 --- a/GoogleTestAdapter/VsPackage/OptionsPages/GeneralOptionsDialogPage.cs +++ b/GoogleTestAdapter/VsPackage/OptionsPages/GeneralOptionsDialogPage.cs @@ -65,6 +65,16 @@ public string TraitsRegexesAfter } private string traitsRegexesAfter = Options.OptionTraitsRegexesDefaultValue; + [Category(Options.CategoryName)] + [DisplayName(Options.OptionParseSymbolInformation)] + [Description(Options.OptionParseSymbolInformationDescription)] + public bool ParseSymbolInformation + { + get { return parseSymbolInformation; } + set { SetAndNotify(ref parseSymbolInformation, value); } + } + private bool parseSymbolInformation = Options.OptionParseSymbolInformationDefaultValue; + [Category(Options.CategoryName)] [DisplayName(Options.OptionAdditionalTestExecutionParams)] [Description(Options.OptionAdditionalTestExecutionParamsDescription)] From 8a95e0949912bb0e189360c673a470657eef7c5d Mon Sep 17 00:00:00 2001 From: Peter Budai Date: Wed, 23 Mar 2016 17:18:27 +0100 Subject: [PATCH 2/4] Fixed indentation --- GoogleTestAdapter/Resources/AllTestSettings.gta.runsettings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GoogleTestAdapter/Resources/AllTestSettings.gta.runsettings b/GoogleTestAdapter/Resources/AllTestSettings.gta.runsettings index f5a2091e0..da55f4bdd 100644 --- a/GoogleTestAdapter/Resources/AllTestSettings.gta.runsettings +++ b/GoogleTestAdapter/Resources/AllTestSettings.gta.runsettings @@ -20,5 +20,5 @@ true - + \ No newline at end of file From af984e503b3750d2f6014f703f53db37ea39c34a Mon Sep 17 00:00:00 2001 From: Peter Budai Date: Wed, 23 Mar 2016 17:52:14 +0100 Subject: [PATCH 3/4] Added missing mock option --- GoogleTestAdapter/Core.Tests/AbstractGoogleTestExtensionTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/GoogleTestAdapter/Core.Tests/AbstractGoogleTestExtensionTests.cs b/GoogleTestAdapter/Core.Tests/AbstractGoogleTestExtensionTests.cs index ee41a2df2..848002773 100644 --- a/GoogleTestAdapter/Core.Tests/AbstractGoogleTestExtensionTests.cs +++ b/GoogleTestAdapter/Core.Tests/AbstractGoogleTestExtensionTests.cs @@ -99,6 +99,7 @@ virtual public void SetUp() MockOptions.Setup(o => o.RunDisabledTests).Returns(Options.OptionRunDisabledTestsDefaultValue); MockOptions.Setup(o => o.ShuffleTests).Returns(Options.OptionShuffleTestsDefaultValue); MockOptions.Setup(o => o.ShuffleTestsSeed).Returns(Options.OptionShuffleTestsSeedDefaultValue); + MockOptions.Setup(o => o.ParseSymbolInformation).Returns(Options.OptionParseSymbolInformationDefaultValue); MockOptions.Setup(o => o.DebugMode).Returns(Options.OptionDebugModeDefaultValue); MockOptions.Setup(o => o.AdditionalTestExecutionParam).Returns(Options.OptionAdditionalTestExecutionParamsDefaultValue); MockOptions.Setup(o => o.BatchForTestSetup).Returns(Options.OptionBatchForTestSetupDefaultValue); From 5775fcf5a436112375c6ce8cd2cefb246b9cedf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Budai?= Date: Wed, 23 Mar 2016 18:19:52 +0100 Subject: [PATCH 4/4] Fix indentation in GoogleTestExtensionOptionsPage.cs --- GoogleTestAdapter/VsPackage/GoogleTestExtensionOptionsPage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GoogleTestAdapter/VsPackage/GoogleTestExtensionOptionsPage.cs b/GoogleTestAdapter/VsPackage/GoogleTestExtensionOptionsPage.cs index 5a4fcbaa7..4c201ae14 100644 --- a/GoogleTestAdapter/VsPackage/GoogleTestExtensionOptionsPage.cs +++ b/GoogleTestAdapter/VsPackage/GoogleTestExtensionOptionsPage.cs @@ -120,7 +120,7 @@ private RunSettings GetRunSettingsFromOptionPages() TraitsRegexesBefore = generalOptions.TraitsRegexesBefore, TraitsRegexesAfter = generalOptions.TraitsRegexesAfter, TestNameSeparator = generalOptions.TestNameSeparator, - ParseSymbolInformation = generalOptions.ParseSymbolInformation, + ParseSymbolInformation = generalOptions.ParseSymbolInformation, DebugMode = generalOptions.DebugMode, AdditionalTestExecutionParam = generalOptions.AdditionalTestExecutionParams, BatchForTestSetup = generalOptions.BatchForTestSetup,