Cleanup work (#89976)
authorLakshan Fernando <lakshanf@hotmail.com>
Tue, 8 Aug 2023 13:35:41 +0000 (06:35 -0700)
committerGitHub <noreply@github.com>
Tue, 8 Aug 2023 13:35:41 +0000 (06:35 -0700)
* Cleanup work

* FB

* test fix

* Implement per-thread activity_id

* FB

* Update src/coreclr/nativeaot/Runtime/eventpipeinternal.cpp

Co-authored-by: Elinor Fung <elfung@microsoft.com>
* replace pThread with activityIdHandle

* increase helix timeout for checked aot run

---------

Co-authored-by: Elinor Fung <elfung@microsoft.com>
13 files changed:
eng/pipelines/runtime.yml
src/coreclr/nativeaot/Runtime/eventpipe/dotnetruntime.cpp
src/coreclr/nativeaot/Runtime/eventpipe/ep-rt-aot.cpp
src/coreclr/nativeaot/Runtime/eventpipe/ep-rt-aot.h
src/coreclr/nativeaot/Runtime/eventpipeinternal.cpp
src/coreclr/nativeaot/Runtime/eventtrace_gcheap.cpp
src/tests/issues.targets
src/tests/tracing/eventactivityidcontrol/eventactivityidcontrol.csproj
src/tests/tracing/eventactivityidcontrol/rd.xml [new file with mode: 0644]
src/tests/tracing/eventpipe/pauseonstart/pauseonstart.cs
src/tests/tracing/eventpipe/pauseonstart/pauseonstart.csproj
src/tests/tracing/eventpipe/processinfo3/processinfo3.cs
src/tests/tracing/eventpipe/processinfo3/processinfo3.csproj

index 7c138e3..0f1cc60 100644 (file)
@@ -243,13 +243,13 @@ extends:
           - name: timeoutPerTestCollectionInMinutes
             value: 180
           jobParameters:
-            timeoutInMinutes: 120
+            timeoutInMinutes: 180
             nameSuffix: NativeAOT
             buildArgs: -s clr.aot+host.native+libs -rc $(_BuildConfig) -lc Release -hc Release
             extraStepsTemplate: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml
             extraStepsParameters:
               creator: dotnet-bot
-              testBuildArgs: 'nativeaot tree ";nativeaot;Loader;Interop;tracing/eventpipe/config;tracing/eventpipe/diagnosticport;tracing/eventpipe/reverse;tracing/eventpipe/processenvironment;tracing/eventpipe/simpleruntimeeventvalidation;tracing/eventpipe/processinfo2;" test tracing/eventcounter/runtimecounters.csproj /p:BuildNativeAotFrameworkObjects=true'
+              testBuildArgs: 'nativeaot tree ";nativeaot;Loader;Interop;tracing;" /p:BuildNativeAotFrameworkObjects=true'
               liveLibrariesBuildConfig: Release
             testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
             extraVariablesTemplates:
index eea3489..0bf1eee 100644 (file)
@@ -2993,6 +2993,7 @@ void InitDotNETRuntime(void)
     EventPipeEventThreadPoolWorkerThreadAdjustmentStats = EventPipeAdapter::AddEvent(EventPipeProviderDotNETRuntime,56,65536,0,EP_EVENT_LEVEL_VERBOSE,true);
     EventPipeEventThreadPoolIOEnqueue = EventPipeAdapter::AddEvent(EventPipeProviderDotNETRuntime,63,2147549184,0,EP_EVENT_LEVEL_VERBOSE,true);
     EventPipeEventThreadPoolIODequeue = EventPipeAdapter::AddEvent(EventPipeProviderDotNETRuntime,64,2147549184,0,EP_EVENT_LEVEL_VERBOSE,true);
+    EventPipeEventThreadPoolIOPack = EventPipeAdapter::AddEvent(EventPipeProviderDotNETRuntime,65,65536,0,EP_EVENT_LEVEL_VERBOSE,true);
     EventPipeEventThreadPoolWorkingThreadCount = EventPipeAdapter::AddEvent(EventPipeProviderDotNETRuntime,60,65536,0,EP_EVENT_LEVEL_VERBOSE,true);
     EventPipeEventGCAllocationTick_V4 = EventPipeAdapter::AddEvent(EventPipeProviderDotNETRuntime,10,1,4,EP_EVENT_LEVEL_VERBOSE,true);
     EventPipeEventGCHeapStats_V2 = EventPipeAdapter::AddEvent(EventPipeProviderDotNETRuntime,4,1,2,EP_EVENT_LEVEL_INFORMATIONAL,false);
index d7e3460..43fad22 100644 (file)
@@ -817,6 +817,13 @@ ep_rt_thread_handle_t ep_rt_aot_thread_get_handle (void)
     return ThreadStore::GetCurrentThreadIfAvailable();
 }
 
+ep_rt_thread_handle_t ep_rt_aot_setup_thread (void)
+{
+    // This is expensive but need a valid thread that will only be used by EventPipe
+    ThreadStore::AttachCurrentThread();
+    return ThreadStore::GetCurrentThread();
+}
+
 ep_rt_thread_id_t ep_rt_aot_thread_get_id (ep_rt_thread_handle_t thread_handle)
 {
     return thread_handle->GetPalThreadIdForLogging();
index dcf0bff..ec315c0 100644 (file)
@@ -726,10 +726,9 @@ EP_RT_DEFINE_THREAD_FUNC (ep_rt_thread_aot_start_session_or_sampling_thread)
 
     ep_rt_thread_params_t* thread_params = reinterpret_cast<ep_rt_thread_params_t *>(data);
 
-    // The session and sampling threads both assert that the incoming thread handle is
-    // non-null, but do not necessarily rely on it otherwise; just pass a meaningless non-null
-    // value until testing shows that a meaningful value is needed.
-    thread_params->thread = reinterpret_cast<ep_rt_thread_handle_t>(1);
+    // We will create a new thread. cannot call ep_rt_aot_thread_get_handle since that will return null
+    extern ep_rt_thread_handle_t ep_rt_aot_setup_thread (void);
+    thread_params->thread = ep_rt_aot_setup_thread ();
 
     size_t result = thread_params->thread_func (thread_params);
     delete thread_params;
@@ -793,15 +792,7 @@ ep_rt_current_processor_get_number (void)
 {
     STATIC_CONTRACT_NOTHROW;
 
-#ifndef TARGET_UNIX
-    extern uint32_t *_ep_rt_aot_proc_group_offsets;
-    if (_ep_rt_aot_proc_group_offsets) {
-        // PROCESSOR_NUMBER proc;
-        // GetCurrentProcessorNumberEx (&proc);
-        // return _ep_rt_aot_proc_group_offsets [proc.Group] + proc.Number;
-        // PalDebugBreak();
-    }
-#endif
+    // Follows the mono implementation
     return 0xFFFFFFFF;
 }
 
@@ -1588,10 +1579,7 @@ bool
 ep_rt_thread_has_started (ep_rt_thread_handle_t thread_handle)
 {
     STATIC_CONTRACT_NOTHROW;
-    // shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
-    // TODO: Implement thread creation/management if needed
-    // return thread_handle != NULL && thread_handle->HasStarted ();
-    return true;
+    return thread_handle != NULL;
 }
 
 static
index d9e77f9..7cf502d 100644 (file)
@@ -148,9 +148,67 @@ EXTERN_C NATIVEAOT_API void __cdecl RhEventPipeInternal_DeleteProvider(intptr_t
     }
 }
 
+// All the runtime redefine this enum, should move to commmon code.
+// https://github.com/dotnet/runtime/issues/87069
+enum class ActivityControlCode
+{
+    EVENT_ACTIVITY_CONTROL_GET_ID = 1,
+    EVENT_ACTIVITY_CONTROL_SET_ID = 2,
+    EVENT_ACTIVITY_CONTROL_CREATE_ID = 3,
+    EVENT_ACTIVITY_CONTROL_GET_SET_ID = 4,
+    EVENT_ACTIVITY_CONTROL_CREATE_SET_ID = 5
+};
+
 EXTERN_C NATIVEAOT_API int __cdecl RhEventPipeInternal_EventActivityIdControl(uint32_t controlCode, GUID *pActivityId)
 {
-    return 0;
+    int retVal = 0;
+    ep_rt_thread_activity_id_handle_t activityIdHandle = ep_thread_get_activity_id_handle ();
+    if (activityIdHandle == NULL || pActivityId == NULL)
+    {
+        retVal = 1;
+    }
+    else
+    {
+        ActivityControlCode activityControlCode = (ActivityControlCode)controlCode;
+        GUID currentActivityId;
+        switch (activityControlCode)
+        {
+        case ActivityControlCode::EVENT_ACTIVITY_CONTROL_GET_ID:
+
+            ep_rt_thread_get_activity_id (activityIdHandle, reinterpret_cast<uint8_t *>(pActivityId), EP_ACTIVITY_ID_SIZE);
+            break;
+
+        case ActivityControlCode::EVENT_ACTIVITY_CONTROL_SET_ID:
+
+            ep_rt_thread_set_activity_id (activityIdHandle, reinterpret_cast<uint8_t *>(pActivityId), EP_ACTIVITY_ID_SIZE);
+            break;
+
+        case ActivityControlCode::EVENT_ACTIVITY_CONTROL_CREATE_ID:
+
+            ep_rt_create_activity_id(reinterpret_cast<uint8_t *>(pActivityId), EP_ACTIVITY_ID_SIZE);
+            break;
+
+        case ActivityControlCode::EVENT_ACTIVITY_CONTROL_GET_SET_ID:
+
+            ep_rt_thread_get_activity_id (activityIdHandle, reinterpret_cast<uint8_t *>(&currentActivityId), EP_ACTIVITY_ID_SIZE);
+            ep_rt_thread_set_activity_id (activityIdHandle, reinterpret_cast<uint8_t *>(pActivityId), EP_ACTIVITY_ID_SIZE);
+            *pActivityId = currentActivityId;
+
+            break;
+
+        case ActivityControlCode::EVENT_ACTIVITY_CONTROL_CREATE_SET_ID:
+
+            ep_rt_thread_get_activity_id (activityIdHandle, reinterpret_cast<uint8_t *>(pActivityId), EP_ACTIVITY_ID_SIZE);
+            ep_rt_create_activity_id(reinterpret_cast<uint8_t *>(&currentActivityId), EP_ACTIVITY_ID_SIZE);
+            ep_rt_thread_set_activity_id (activityIdHandle, reinterpret_cast<uint8_t *>(&currentActivityId), EP_ACTIVITY_ID_SIZE);
+            break;
+
+        default:
+            retVal = 1;
+        }
+    }
+
+    return retVal;
 }
 
 EXTERN_C NATIVEAOT_API void __cdecl RhEventPipeInternal_WriteEventData(
index 7ee7d56..db6adc3 100644 (file)
 
 BOOL ETW::GCLog::ShouldWalkHeapObjectsForEtw()
 {
-    LIMITED_METHOD_CONTRACT;
-    return RUNTIME_PROVIDER_CATEGORY_ENABLED(
-        TRACE_LEVEL_INFORMATION,
-        CLR_GCHEAPDUMP_KEYWORD);
+    // @TODO: until the below issue is fixed correctly
+    // https://github.com/dotnet/runtime/issues/88491
+    return FALSE;
 }
 
 BOOL ETW::GCLog::ShouldWalkHeapRootsForEtw()
 {
-    LIMITED_METHOD_CONTRACT;
-    return RUNTIME_PROVIDER_CATEGORY_ENABLED(
-        TRACE_LEVEL_INFORMATION,
-        CLR_GCHEAPDUMP_KEYWORD);
+    // @TODO: until the below issue is fixed correctly
+    // https://github.com/dotnet/runtime/issues/88491
+    return FALSE;
 }
 
 BOOL ETW::GCLog::ShouldTrackMovementForEtw()
index d1dc86c..3dd51b5 100644 (file)
         <ExcludeList Include="$(XunitTestBinBase)/reflection/SetValue/TrySetReadonlyStaticField/*">
             <Issue>https://github.com/dotnet/runtimelab/issues/200</Issue>
         </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventcounter/eventcounter/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventcounter/gh53564/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventcounter/incrementingeventcounter/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventcounter/incrementingpollingcounter/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventcounter/pollingcounter/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventcounter/regression-25709/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventcounter/regression-46938/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventactivityidcontrol/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventlistener/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/bigevent/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/buffersize/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/enabledisable/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/eventsourceerror/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
+        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventlistener/EventListenerThreadPool/**">
+            <Issue>https://github.com/dotnet/runtime/issues/83051: Waiting for PR_88894 to be merged</Issue>
         </ExcludeList>
         <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/gcdump/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/pauseonstart/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/processenvironment/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/processinfo/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/processinfo2/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/processinfo3/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/providervalidation/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/reverseouter/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
+            <Issue>https://github.com/dotnet/runtime/issues/83051: not supported in net8</Issue>
         </ExcludeList>
         <ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/rundownvalidation/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
+            <Issue>https://github.com/dotnet/runtime/issues/83051: not supported in net8</Issue>
         </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/tracing/runtimeeventsource/**">
-            <Issue>https://github.com/dotnet/runtime/issues/83051</Issue>
+        <ExcludeList Include="$(XunitTestBinBase)/tracing/runtimeeventsource/nativeruntimeeventsource/**">
+            <Issue>https://github.com/dotnet/runtime/issues/90021</Issue>
         </ExcludeList>
         <ExcludeList Include="$(XunitTestBinBase)/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b426654/b426654/*">
             <Issue>https://github.com/dotnet/runtimelab/issues/208</Issue>
index 737e816..8d08f43 100644 (file)
@@ -10,4 +10,7 @@
     <Compile Include="EventActivityIdControl.cs" />
     <ProjectReference Include="../common/common.csproj" />
   </ItemGroup>
+  <ItemGroup Condition="'$(TestBuildMode)' == 'nativeaot'">
+    <RdXmlFile Include="rd.xml" />
+  </ItemGroup>  
 </Project>
diff --git a/src/tests/tracing/eventactivityidcontrol/rd.xml b/src/tests/tracing/eventactivityidcontrol/rd.xml
new file mode 100644 (file)
index 0000000..0228bf1
--- /dev/null
@@ -0,0 +1,9 @@
+<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
+  <Application>
+    <Assembly Name="System.Private.CoreLib">
+      <Type Name="System.Diagnostics.Tracing.EventPipeEventProvider">
+        <Method Name="EventActivityIdControl" />
+      </Type>
+    </Assembly>
+  </Application>
+</Directives>
\ No newline at end of file
index 3ae5626..529589d 100644 (file)
@@ -64,12 +64,16 @@ namespace Tracing.Tests.PauseOnStartValidation
                     IpcAdvertise advertise = IpcAdvertise.Parse(stream);
                     Logger.logger.Log(advertise.ToString());
 
+                    // Native AOT doesn't use the private provider / EEStartupStart event, so the subprocess
+                    // writes a sentinel event to signal that the runtime has resumed and run the application 
+                    Provider provider = TestLibrary.Utilities.IsNativeAot ? new Provider(nameof(SentinelEventSource)) : new Provider("Microsoft-Windows-DotNETRuntimePrivate", 0x80000000, EventLevel.Verbose);
                     var config = new SessionConfiguration(
                         circularBufferSizeMB: 1000,
                         format: EventPipeSerializationFormat.NetTrace,
                         providers: new List<Provider> { 
-                            new Provider("Microsoft-Windows-DotNETRuntimePrivate", 0x80000000, EventLevel.Verbose)
+                            provider
                         });
+
                     Logger.logger.Log("Starting EventPipeSession over standard connection");
                     using Stream eventStream = EventPipeClient.CollectTracing(pid, config, out var sessionId);
                     Logger.logger.Log($"Started EventPipeSession over standard connection with session id: 0x{sessionId:x}");
@@ -96,7 +100,14 @@ namespace Tracing.Tests.PauseOnStartValidation
             using var source = new EventPipeEventSource(memoryStream);
             var parser = new ClrPrivateTraceEventParser(source);
             bool isStartupEventPresent= false;
-            parser.StartupEEStartupStart += (eventData) => isStartupEventPresent = true;
+            if (TestLibrary.Utilities.IsNativeAot)
+            {
+                source.Dynamic.All += (eventData) => isStartupEventPresent = true;
+            }
+            else
+            {
+                parser.StartupEEStartupStart += (eventData) => isStartupEventPresent = true;
+            }
             source.Process();
 
             Logger.logger.Log($"isStartupEventPresent: {isStartupEventPresent}");
@@ -122,11 +133,14 @@ namespace Tracing.Tests.PauseOnStartValidation
                     IpcAdvertise advertise = IpcAdvertise.Parse(stream);
                     Logger.logger.Log(advertise.ToString());
 
+                    // Native AOT doesn't use the private provider / EEStartupStart event, so the subprocess
+                    // writes a sentinel event to signal that the runtime has resumed and run the application 
+                    Provider provider = TestLibrary.Utilities.IsNativeAot ? new Provider(nameof(SentinelEventSource)) : new Provider("Microsoft-Windows-DotNETRuntimePrivate", 0x80000000, EventLevel.Verbose);
                     var config = new SessionConfiguration(
                         circularBufferSizeMB: 1000,
                         format: EventPipeSerializationFormat.NetTrace,
                         providers: new List<Provider> { 
-                            new Provider("Microsoft-Windows-DotNETRuntimePrivate", 0x80000000, EventLevel.Verbose)
+                            provider
                         });
 
                     Logger.logger.Log("Starting EventPipeSession over standard connection");
@@ -172,7 +186,18 @@ namespace Tracing.Tests.PauseOnStartValidation
             using (var source = new EventPipeEventSource(memoryStream1))
             {
                 var parser = new ClrPrivateTraceEventParser(source);
-                parser.StartupEEStartupStart += (eventData) => nStartupEventsSeen++;
+                if (TestLibrary.Utilities.IsNativeAot)
+                {
+                    source.Dynamic.All += (eventData) => 
+                    {
+                        if(eventData.EventName.Equals("SentinelEvent"))
+                            nStartupEventsSeen++;
+                    };
+                }
+                else
+                {
+                    parser.StartupEEStartupStart += (eventData) => nStartupEventsSeen++;
+                }
                 source.Process();
             }
 
@@ -180,7 +205,18 @@ namespace Tracing.Tests.PauseOnStartValidation
             using (var source = new EventPipeEventSource(memoryStream2))
             {
                 var parser = new ClrPrivateTraceEventParser(source);
-                parser.StartupEEStartupStart += (eventData) => nStartupEventsSeen++;
+                if (TestLibrary.Utilities.IsNativeAot)
+                {
+                    source.Dynamic.All += (eventData) => 
+                    {
+                        if(eventData.EventName.Equals("SentinelEvent"))
+                            nStartupEventsSeen++;
+                    };
+                }
+                else
+                {
+                    parser.StartupEEStartupStart += (eventData) => nStartupEventsSeen++;
+                }
                 source.Process();
             }
 
@@ -188,7 +224,18 @@ namespace Tracing.Tests.PauseOnStartValidation
             using (var source = new EventPipeEventSource(memoryStream3))
             {
                 var parser = new ClrPrivateTraceEventParser(source);
-                parser.StartupEEStartupStart += (eventData) => nStartupEventsSeen++;
+                if (TestLibrary.Utilities.IsNativeAot)
+                {
+                    source.Dynamic.All += (eventData) => 
+                    {
+                        if(eventData.EventName.Equals("SentinelEvent"))
+                            nStartupEventsSeen++;
+                    };
+                }
+                else
+                {
+                    parser.StartupEEStartupStart += (eventData) => nStartupEventsSeen++;
+                }
                 source.Process();
             }
 
@@ -306,10 +353,21 @@ namespace Tracing.Tests.PauseOnStartValidation
             return fSuccess;
         }
 
+        public sealed class SentinelEventSource : EventSource
+        {
+            private SentinelEventSource() {}
+            public static SentinelEventSource Log = new SentinelEventSource();
+            public void SentinelEvent() { WriteEvent(1, nameof(SentinelEvent)); }
+        }
+
         public static async Task<int> Main(string[] args)
         {
             if (args.Length >= 1)
             {
+                // Native AOT test uses this event source as a signal that the runtime has resumed and gone on to run the application 
+                if (TestLibrary.Utilities.IsNativeAot)
+                    SentinelEventSource.Log.SentinelEvent();
+
                 Console.Out.WriteLine("Subprocess started!  Waiting for input...");
                 var input = Console.In.ReadLine(); // will block until data is sent across stdin
                 Console.Out.WriteLine($"Received '{input}'.  Exiting...");
index c20471b..e266e49 100644 (file)
@@ -11,5 +11,6 @@
   <ItemGroup>
     <Compile Include="$(MSBuildProjectName).cs" />
     <ProjectReference Include="../common/common.csproj" />
+    <ProjectReference Include="$(TestSourceDir)Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj" />
   </ItemGroup>
 </Project>
index a17659f..ec6591e 100644 (file)
@@ -158,7 +158,9 @@ namespace Tracing.Tests.ProcessInfoValidation
                 // /path/to/corerun /path/to/processinfo.dll
                 // or
                 // "C:\path\to\CoreRun.exe" C:\path\to\processinfo.dll
-                string currentProcessCommandLine = $"{currentProcess.MainModule.FileName} {System.Reflection.Assembly.GetExecutingAssembly().Location}";
+                string currentProcessCommandLine = TestLibrary.Utilities.IsSingleFile
+                    ? currentProcess.MainModule.FileName
+                    : $"{currentProcess.MainModule.FileName} {System.Reflection.Assembly.GetExecutingAssembly().Location}";
                 string receivedCommandLine = NormalizeCommandLine(commandLine);
                 Utils.Assert(currentProcessCommandLine.Equals(receivedCommandLine, StringComparison.OrdinalIgnoreCase), $"CommandLine must match current process. Expected: {currentProcessCommandLine}, Received: {receivedCommandLine} (original: {commandLine})");
             }
index d4947c7..2c913f4 100644 (file)
@@ -15,5 +15,6 @@
   <ItemGroup>
     <Compile Include="$(MSBuildProjectName).cs" />
     <ProjectReference Include="../common/common.csproj" />
+    <ProjectReference Include="$(TestSourceDir)Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj" />
   </ItemGroup>
 </Project>