Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update tests to use new config switches
* small bug fixes in config parsing code
  • Loading branch information
John Salem committed Aug 7, 2020
commit 000142d2876d424ad9e7b0e1f67f4fb5ca4d5a69
2 changes: 1 addition & 1 deletion src/coreclr/src/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_EventPipeProcNumbers, W("EventPipeProcNumbers"
//
// Diagnostics Ports
//
RRETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_DOTNET_DiagnosticPortSuspend, W("DOTNET_DiagnosticPortSuspend"), 1, "This will cause the runtime to pause during startup before major subsystems are started. Resume using the Diagnostics IPC ResumeStartup command.", CLRConfig::DontPrependCOMPlus_);
RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_DOTNET_DiagnosticPortSuspend, W("DOTNET_DiagnosticPortSuspend"), 0, "This will cause the runtime to pause during startup before major subsystems are started. Resume using the Diagnostics IPC ResumeStartup command.", CLRConfig::DontPrependCOMPlus_);
RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_DOTNET_DiagnosticPorts, W("DOTNET_DiagnosticPorts"), "A semicolon delimited list of additional Diagnostic Ports, where a Diagnostic Port is a NamedPipe path without '\\\\.\\pipe\\' on Windows or the full path of Unix Domain Socket on Linux/Unix followed by optional tags, e.g., '<path>,listen,nosuspend;<path>,connect'", CLRConfig::DontPrependCOMPlus_);

//
Expand Down
13 changes: 8 additions & 5 deletions src/coreclr/src/vm/ipcstreamfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ CQuickArrayList<LPSTR> split(LPSTR string, LPCSTR delimiters)
{
CQuickArrayList<LPSTR> parts;
char *context;
char *portConfig = nullptr;
char *part = nullptr;
for (char *cursor = string; ; cursor = nullptr)
{
if ((portConfig = strtok_s(cursor, delimiters, &context)) != nullptr)
parts.Push(portConfig);
if ((part = strtok_s(cursor, delimiters, &context)) != nullptr)
parts.Push(part);
else
break;
}
Expand Down Expand Up @@ -110,11 +110,14 @@ bool IpcStreamFactory::Configure(ErrorCallback callback)

ASSERT(portConfigParts.Size() >= 1);
if (portConfigParts.Size() == 0)
{
fSuccess &= false;
continue;
}

builder.WithPath(portConfigParts.Pop());
while (portConfigParts.Size() > 0)
while (portConfigParts.Size() > 1)
builder.WithTag(portConfigParts.Pop());
builder.WithPath(portConfigParts.Pop());

const bool fBuildSuccess = BuildAndAddPort(builder, callback);
STRESS_LOG1(LF_DIAGNOSTICS_PORT, LL_INFO10, "IpcStreamFactory::Configure - Diagnostic Port creation succeeded? %d \n", fBuildSuccess);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/vm/ipcstreamfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class IpcStreamFactory
DiagnosticPortType Type = DiagnosticPortType::LISTEN;
DiagnosticPortSuspendMode SuspendMode = DiagnosticPortSuspendMode::NOSUSPEND;

DiagnosticPortBuilder WithPath(LPSTR path) { Path = _strdup(path); return *this; }
DiagnosticPortBuilder WithPath(LPSTR path) { Path = path != nullptr ? _strdup(path) : nullptr; return *this; }
DiagnosticPortBuilder WithType(DiagnosticPortType type) { Type = type; return *this; }
DiagnosticPortBuilder WithSuspendMode(DiagnosticPortSuspendMode mode) { SuspendMode = mode; return *this; }
DiagnosticPortBuilder WithTag(LPSTR tag)
Expand Down
4 changes: 2 additions & 2 deletions src/tests/tracing/eventpipe/common/IpcUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace Tracing.Tests.Common
{
public static class Utils
{
public static readonly string DiagnosticsMonitorAddressEnvKey = "DOTNET_DiagnosticsMonitorAddress";
public static readonly string DiagnosticsMonitorPauseOnStartEnvKey = "DOTNET_DiagnosticsMonitorPauseOnStart";
public static readonly string DiagnosticPortsEnvKey = "DOTNET_DiagnosticPorts";
public static readonly string DiagnosticPortSuspend = "DOTNET_DiagnosticPortSuspend";

public static async Task<T> WaitTillTimeout<T>(Task<T> task, TimeSpan timeout)
{
Expand Down
10 changes: 5 additions & 5 deletions src/tests/tracing/eventpipe/pauseonstart/pauseonstart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static async Task<bool> TEST_RuntimeResumesExecutionWithCommand()
var server = new ReverseServer(serverName);
Task<bool> subprocessTask = Utils.RunSubprocess(
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string> { { Utils.DiagnosticsMonitorAddressEnvKey, serverName } },
environment: new Dictionary<string,string> { { Utils.DiagnosticPortsEnvKey, $"{serverName},connect,suspend" } },
duringExecution: async (_) =>
{
Stream stream = await server.AcceptAsync();
Expand Down Expand Up @@ -56,7 +56,7 @@ public static async Task<bool> TEST_TracesHaveRelevantEvents()
using var memoryStream = new MemoryStream();
Task<bool> subprocessTask = Utils.RunSubprocess(
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string> { { Utils.DiagnosticsMonitorAddressEnvKey, serverName } },
environment: new Dictionary<string,string> { { Utils.DiagnosticPortsEnvKey, $"{serverName},connect,suspend" } },
duringExecution: async (pid) =>
{
Stream stream = await server.AcceptAsync();
Expand Down Expand Up @@ -114,7 +114,7 @@ public static async Task<bool> TEST_MultipleSessionsCanBeStartedWhilepaused()
using var memoryStream3 = new MemoryStream();
Task<bool> subprocessTask = Utils.RunSubprocess(
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string> { { Utils.DiagnosticsMonitorAddressEnvKey, serverName } },
environment: new Dictionary<string,string> { { Utils.DiagnosticPortsEnvKey, $"{serverName},connect,suspend" } },
duringExecution: async (pid) =>
{
Stream stream = await server.AcceptAsync();
Expand Down Expand Up @@ -207,7 +207,7 @@ public static async Task<bool> TEST_CanStartAndStopSessionWhilepaused()
using var memoryStream3 = new MemoryStream();
Task<bool> subprocessTask = Utils.RunSubprocess(
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string> { { Utils.DiagnosticsMonitorAddressEnvKey, serverName } },
environment: new Dictionary<string,string> { { Utils.DiagnosticPortsEnvKey, $"{serverName},connect,suspend" } },
duringExecution: async (pid) =>
{
Stream stream = await server.AcceptAsync();
Expand Down Expand Up @@ -271,7 +271,7 @@ public static async Task<bool> TEST_DisabledCommandsError()
using var memoryStream3 = new MemoryStream();
Task<bool> subprocessTask = Utils.RunSubprocess(
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string> { { Utils.DiagnosticsMonitorAddressEnvKey, serverName } },
environment: new Dictionary<string,string> { { Utils.DiagnosticPortsEnvKey, $"{serverName},connect,suspend" } },
duringExecution: async (pid) =>
{
Stream stream = await server.AcceptAsync();
Expand Down
18 changes: 6 additions & 12 deletions src/tests/tracing/eventpipe/reverse/reverse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public static async Task<bool> TEST_RuntimeIsResilientToServerClosing()
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string>
{
{ Utils.DiagnosticsMonitorAddressEnvKey, serverName },
{ Utils.DiagnosticsMonitorPauseOnStartEnvKey, "0" }
{ Utils.DiagnosticPortsEnvKey, $"{serverName},connect,nosuspend" }
},
duringExecution: async (_) =>
{
Expand Down Expand Up @@ -59,8 +58,7 @@ public static async Task<bool> TEST_RuntimeConnectsToExistingServer()
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string>
{
{ Utils.DiagnosticsMonitorAddressEnvKey, serverName },
{ Utils.DiagnosticsMonitorPauseOnStartEnvKey, "0" }
{ Utils.DiagnosticPortsEnvKey, $"{serverName},connect,nosuspend" }
},
duringExecution: async (_) =>
{
Expand All @@ -85,8 +83,7 @@ public static async Task<bool> TEST_CanConnectServerAndClientAtSameTime()
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string>
{
{ Utils.DiagnosticsMonitorAddressEnvKey, serverName },
{ Utils.DiagnosticsMonitorPauseOnStartEnvKey, "0" }
{ Utils.DiagnosticPortsEnvKey, $"{serverName},connect,nosuspend" }
},
duringExecution: async (int pid) =>
{
Expand Down Expand Up @@ -139,8 +136,7 @@ public static async Task<bool> TEST_ServerWorksIfClientDoesntAccept()
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string>
{
{ Utils.DiagnosticsMonitorAddressEnvKey, serverName },
{ Utils.DiagnosticsMonitorPauseOnStartEnvKey, "0" }
{ Utils.DiagnosticPortsEnvKey, $"{serverName},connect,nosuspend" }
},
duringExecution: async (int pid) =>
{
Expand Down Expand Up @@ -181,8 +177,7 @@ public static async Task<bool> TEST_ServerIsResilientToNoBufferAgent()
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string>
{
{ Utils.DiagnosticsMonitorAddressEnvKey, serverName },
{ Utils.DiagnosticsMonitorPauseOnStartEnvKey, "0" }
{ Utils.DiagnosticPortsEnvKey, $"{serverName},connect,nosuspend" }
},
duringExecution: async (int pid) =>
{
Expand Down Expand Up @@ -220,8 +215,7 @@ public static async Task<bool> TEST_StandardConnectionStillWorksIfReverseConnect
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string>
{
{ Utils.DiagnosticsMonitorAddressEnvKey, serverName },
{ Utils.DiagnosticsMonitorPauseOnStartEnvKey, "0" }
{ Utils.DiagnosticPortsEnvKey, $"{serverName},connect,nosuspend" }
},
duringExecution: async (int pid) =>
{
Expand Down
3 changes: 1 addition & 2 deletions src/tests/tracing/eventpipe/reverseouter/reverseouter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public static async Task<bool> TEST_ReverseConnectionCanRecycleWhileTracing()
currentAssembly: Assembly.GetExecutingAssembly(),
environment: new Dictionary<string,string>
{
{ Utils.DiagnosticsMonitorAddressEnvKey, serverName },
{ Utils.DiagnosticsMonitorPauseOnStartEnvKey, "0" }
{ Utils.DiagnosticPortsEnvKey, $"{serverName},connect,nosuspend" }
},
duringExecution: async (int pid) =>
{
Expand Down