Skip to content

Commit

Permalink
if listing of tests fails, GTA produces a warning now, and no further…
Browse files Browse the repository at this point in the history
… efforts are taken to parse SourceFileLocations (#63)
  • Loading branch information
csoltenborn authored and chris committed Jul 19, 2016
1 parent 1446361 commit 79de2ad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 19 additions & 2 deletions GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text.RegularExpressions;
using GoogleTestAdapter.DiaResolver;
using GoogleTestAdapter.Helpers;
Expand All @@ -26,9 +28,24 @@ public TestCaseFactory(string executable, TestEnvironment testEnvironment, IDiaR
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);
int processReturnCode;
List<string> consoleOutput = launcher.GetOutputOfCommand("", _executable, GoogleTestConstants.ListTestsOption.Trim(), false, false, out processReturnCode);
if (processReturnCode != 0)
{
string messsage =
$"Could not list test cases of executable '{_executable}': executing process failed with return code {processReturnCode}";
messsage += $"\nCommand executed: '{_executable} {GoogleTestConstants.ListTestsOption.Trim()}', working directory: '{Path.GetDirectoryName(_executable)}'";
if (consoleOutput.Count(s => !string.IsNullOrEmpty(s)) > 0)
messsage += $"\nOutput of command:\n{string.Join("\n", consoleOutput)}";
else
messsage += "\nCommand produced no output";

_testEnvironment.LogWarning(messsage);

return new List<TestCase>();
}

IList<TestCaseDescriptor> testCaseDescriptors = new ListTestsParser(_testEnvironment).ParseListTestsOutput(consoleOutput);
if (_testEnvironment.Options.ParseSymbolInformation)
{
List<TestCaseLocation> testCaseLocations = GetTestCaseLocations(testCaseDescriptors, _testEnvironment.Options.PathExtension);
Expand Down
4 changes: 4 additions & 0 deletions GoogleTestAdapter/VsPackage/Resources/ReleaseNotes/0.8.0.md
@@ -0,0 +1,4 @@
* enhancement: settings are now printed to test output if GTA is running in debug mode ([#60](https://github.com/csoltenborn/GoogleTestAdapter/issues/60))
* enhancement: cleaned up log output a bit ([#62](https://github.com/csoltenborn/GoogleTestAdapter/issues/62))
* bugfix: if listing of tests failed, GTA produces a warning now, and no further efforts are taken to parse SourceFileLocations ([#63](https://github.com/csoltenborn/GoogleTestAdapter/issues/63), thanks to [Sergey Gomon](https://github.com/gomons) for example solution)
* bugfix: if a test crashed, but produced output immediately before the crash, that output would not end up in the test explorer ([#58](https://github.com/csoltenborn/GoogleTestAdapter/issues/58)

0 comments on commit 79de2ad

Please sign in to comment.