Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to turn off PDB file parsing #41

Merged
merged 5 commits into from
Mar 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions GoogleTestAdapter/Core/Helpers/XmlOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public interface IXmlOptions
string TraitsRegexesAfter { get; set; }
string TraitsRegexesBefore { get; set; }
string TestNameSeparator { get; set; }
bool? ParseSymbolInformation { get; set; }
bool? DebugMode { get; set; }
}

Expand All @@ -55,6 +56,7 @@ public static void GetUnsetValuesFrom(this IXmlOptions self, IXmlOptions other)
self.TraitsRegexesAfter = self.TraitsRegexesAfter ?? other.TraitsRegexesAfter;
self.TraitsRegexesBefore = self.TraitsRegexesBefore ?? other.TraitsRegexesBefore;
self.TestNameSeparator = self.TestNameSeparator ?? other.TestNameSeparator;
self.ParseSymbolInformation = self.ParseSymbolInformation ?? other.ParseSymbolInformation;
self.DebugMode = self.DebugMode ?? other.DebugMode;
}
}
Expand Down
8 changes: 8 additions & 0 deletions GoogleTestAdapter/Core/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ public virtual List<RegexTraitPair> TraitsRegexesAfter
public virtual string TestNameSeparator => XmlOptions.TestNameSeparator ?? OptionTestNameSeparatorDefaultValue;


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 =
Expand Down
19 changes: 17 additions & 2 deletions GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ public IList<TestCase> CreateTestCases()
var launcher = new ProcessLauncher(TestEnvironment, TestEnvironment.Options.PathExtension);
List<string> consoleOutput = launcher.GetOutputOfCommand("", Executable, GoogleTestConstants.ListTestsOption.Trim(), false, false);
IList<TestCaseDescriptor> testCaseDescriptors = new ListTestsParser(TestEnvironment).ParseListTestsOutput(consoleOutput);
List<TestCaseLocation> testCaseLocations = GetTestCaseLocations(testCaseDescriptors, TestEnvironment.Options.PathExtension);

return testCaseDescriptors.Select(descriptor => CreateTestCase(descriptor, testCaseLocations)).ToList();
if (TestEnvironment.Options.ParseSymbolInformation)
{
List<TestCaseLocation> testCaseLocations = GetTestCaseLocations(testCaseDescriptors, TestEnvironment.Options.PathExtension);
return testCaseDescriptors.Select(descriptor => CreateTestCase(descriptor, testCaseLocations)).ToList();
}
else
{
return testCaseDescriptors.Select(descriptor => CreateTestCase(descriptor)).ToList();
}
}

private List<TestCaseLocation> GetTestCaseLocations(IList<TestCaseDescriptor> testCaseDescriptors, string pathExtension)
Expand All @@ -51,6 +58,14 @@ private List<TestCaseLocation> GetTestCaseLocations(IList<TestCaseDescriptor> 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<Trait>()));
return testCase;
}

private TestCase CreateTestCase(TestCaseDescriptor descriptor, List<TestCaseLocation> testCaseLocations)
{
TestCaseLocation location = testCaseLocations.FirstOrDefault(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
<TraitsRegexesAfter />
<TraitsRegexesBefore />
<TestNameSeparator />
<ParseSymbolInformation>true</ParseSymbolInformation>
</GoogleTestAdapter>
</RunSettings>
3 changes: 3 additions & 0 deletions GoogleTestAdapter/TestAdapter/Settings/RunSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,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; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private RunSettings GetRunSettingsFromOptionPages()
TraitsRegexesBefore = generalOptions.TraitsRegexesBefore,
TraitsRegexesAfter = generalOptions.TraitsRegexesAfter,
TestNameSeparator = generalOptions.TestNameSeparator,
ParseSymbolInformation = generalOptions.ParseSymbolInformation,
DebugMode = generalOptions.DebugMode,
AdditionalTestExecutionParam = generalOptions.AdditionalTestExecutionParams,
BatchForTestSetup = generalOptions.BatchForTestSetup,
Expand All @@ -139,4 +140,4 @@ private RunSettings GetRunSettingsFromOptionPages()

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ public string TestNameSeparator
set { SetAndNotify(ref testNameSeparator, value); }
}
private string testNameSeparator = Options.OptionTestNameSeparatorDefaultValue;

[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)]
Expand Down