forked from dotnet/diagnostics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve SymbolService.ParseSymbolPath support for Watson. Issue dotne…
…t#2512. Can now handle the various symbol paths that Watson can throw at us. Doesn't support actually calling the symbol server dll like in the symsrv*symaudit.dll*\\server\share syntax. The dll is ignored.
- Loading branch information
Showing
5 changed files
with
195 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/SymbolServiceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.Diagnostics.DebugServices.Implementation; | ||
using System; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace Microsoft.Diagnostics.DebugServices.UnitTests | ||
{ | ||
/// <summary> | ||
/// Test the service event implementation | ||
/// </summary> | ||
public class SymbolServiceTests : IHost | ||
{ | ||
public SymbolServiceTests() | ||
{ | ||
} | ||
|
||
[Fact] | ||
public void SymbolPathTests() | ||
{ | ||
var symbolService = new SymbolService(this); | ||
Assert.False(symbolService.ParseSymbolPath("srv")); | ||
Assert.False(symbolService.ParseSymbolPath("cache")); | ||
Assert.False(symbolService.ParseSymbolPath("symsrv")); | ||
|
||
string defaultServer = $"Server: {SymbolService.MsdlSymbolServer}\r\n"; | ||
string defaultPath = $"Cache: {symbolService.DefaultSymbolCache}\r\n{defaultServer}"; | ||
|
||
Assert.True(symbolService.ParseSymbolPath("srv*")); | ||
Assert.Equal(defaultServer, symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath("srv**")); | ||
Assert.Equal(defaultPath, symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath("symsrv*symsrv.dll*")); | ||
Assert.Equal(defaultServer, symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath("cache*;srv*")); | ||
Assert.Equal(defaultPath, symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath("srv*http://msdl.microsoft.com/download/symbols/")); | ||
Assert.Equal(defaultServer, symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath($"srv**{SymbolService.MsdlSymbolServer}")); | ||
Assert.Equal(defaultPath, symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath($"srv*c:\\localsymbolcache*{SymbolService.SymwebSymbolServer}")); | ||
string testpath1 = $"Cache: c:\\localsymbolcache\r\nServer: {SymbolService.SymwebSymbolServer}\r\n"; | ||
Assert.Equal(testpath1, symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath("cache*c:\\localsymbolcache;srv*")); | ||
string testpath2 = $"Cache: c:\\localsymbolcache\r\nServer: {SymbolService.MsdlSymbolServer}\r\n"; | ||
Assert.Equal(testpath2, symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath("symsrv*symsrv.dll*c:\\localsymbolcache*\\\\server\\share")); | ||
Assert.Equal("Cache: c:\\localsymbolcache\r\nCache: \\\\server\\share\r\n", symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath("srv**c:\\localsymbolcache*http://msdl.microsoft.com/download/symbols/")); | ||
Assert.Equal($"Cache: {symbolService.DefaultSymbolCache}\r\nCache: c:\\localsymbolcache\r\nServer: http://msdl.microsoft.com/download/symbols/\r\n", symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath("symsrv*symsrv.dll*d:\\data\\SYM\\symcache*\\\\aw0eus0symcache.file.core.windows.net\\Symbols*http://localhost/remote200/30e07e1454924e55901d7f693f7eddf1/0/x64/4542784547/remote")); | ||
Assert.Equal("Cache: d:\\data\\SYM\\symcache\r\nCache: \\\\aw0eus0symcache.file.core.windows.net\\Symbols\r\nServer: http://localhost/remote200/30e07e1454924e55901d7f693f7eddf1/0/x64/4542784547/remote/\r\n", symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath("c:\\symbols\\")); | ||
Assert.Equal("Directory: c:\\symbols\\\r\n", symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
|
||
Assert.True(symbolService.ParseSymbolPath("c:\\symbols\\;c:\\foo\\bar;srv*")); | ||
Assert.Equal("Directory: c:\\symbols\\\r\nDirectory: c:\\foo\\bar\r\n" + defaultServer, symbolService.ToString()); | ||
symbolService.DisableSymbolStore(); | ||
} | ||
|
||
#region IHost | ||
|
||
public IServiceEvent OnShutdownEvent { get; } = new ServiceEvent(); | ||
|
||
HostType IHost.HostType => HostType.DotnetDump; | ||
|
||
IServiceProvider IHost.Services => throw new NotImplementedException(); | ||
|
||
IEnumerable<ITarget> IHost.EnumerateTargets() => throw new NotImplementedException(); | ||
|
||
void IHost.DestroyTarget(ITarget target) => throw new NotImplementedException(); | ||
|
||
#endregion | ||
} | ||
} |