undo gcname while running crossgen2 within standalone CI (#56361)
authorManish Godse <61718172+mangod9@users.noreply.github.com>
Thu, 29 Jul 2021 17:56:07 +0000 (10:56 -0700)
committerGitHub <noreply@github.com>
Thu, 29 Jul 2021 17:56:07 +0000 (10:56 -0700)
* undo gcname while running crossgen2

* Fix couple more R2R tests to ignore standalone gc

* Fix comments based on CR

src/tests/Common/CLRTest.CrossGen.targets
src/tests/readytorun/multifolder/multifolder.csproj
src/tests/readytorun/r2rdump/FrameworkTests/R2RDumpTester.cs

index 8557a71..9c5ad60 100644 (file)
@@ -82,9 +82,11 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
         local gcStressModeToRestore=$COMPlus_GCStress;
         local heapVerifyModeToRestore=$COMPlus_HeapVerify;
         local readyToRunModeToRestore=$COMPlus_ReadyToRun;
+        local gcstandaloneModeToRestore=$COMPlus_GCName;
         export COMPlus_GCStress=
         export COMPlus_HeapVerify=
         export COMPlus_ReadyToRun=
+        unset COMPlus_GCName
 
         __Command=$_DebuggerFullPath
         # Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
@@ -113,6 +115,7 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
         $__Command
         __cg2ExitCode=$?
 
+        export COMPlus_GCName=$gcstandaloneModeToRestore
         export COMPlus_GCStress=$gcStressModeToRestore
         export COMPlus_HeapVerify=$heapVerifyModeToRestore
         export COMPlus_ReadyToRun=$readyToRunModeToRestore
@@ -219,6 +222,8 @@ if defined RunCrossGen2 (
     set COMPlus_HeapVerify=
     set __readyToRunModeToRestore=!COMPlus_ReadyToRun!
     set COMPlus_ReadyToRun=
+    set __gcStandaloneModeToRestore=!COMPlus_GCName!
+    set COMPlus_GCName=
 
     set __Command=!_DebuggerFullPath!
     REM Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
@@ -253,6 +258,7 @@ if defined RunCrossGen2 (
     set COMPlus_GCStress=!__gcStressModeToRestore!
     set COMPlus_HeapVerify=!__heapVerifyModeToRestore!
     set COMPlus_ReadyToRun=!__readyToRunModeToRestore!
+    set COMPlus_GCName=!__gcStandaloneModeToRestore!
 
     Exit /b 0
 
index 6b73ae6..4013343 100644 (file)
@@ -40,6 +40,10 @@ $(CLRTestBatchPreCommands)
     echo %scriptPath%\..\FolderA\FolderA\FolderA.dll>>%__ResponseFile%
     echo %scriptPath%\..\FolderB\FolderB\FolderB.dll>>%__ResponseFile%
 
+    REM Suppress GC stand alone mode for the duration of Crossgen2 execution
+    set __gcStandaloneModeToRestore=!COMPlus_GCName!
+    set COMPlus_GCName=
+
     set __Command=%_DebuggerFullPath%
     REM Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
     if defined __TestDotNetCmd (
@@ -61,6 +65,7 @@ $(CLRTestBatchPreCommands)
 
     set ExePath=multifolder\multifolder.dll
     set COMPlus_NativeImageSearchPaths=%scriptPath%
+    set COMPlus_GCName=!__gcStandaloneModeToRestore!
 
 ]]></CLRTestBatchPreCommands>
     <BashCLRTestPreCommands><![CDATA[
@@ -81,6 +86,10 @@ $(BashCLRTestPreCommands)
     echo $__OutputDir/../FolderA/FolderA/FolderA.dll>>$__ResponseFile
     echo $__OutputDir/../FolderB/FolderB/FolderB.dll>>$__ResponseFile
 
+    # Suppress GC standalone mode for the duration of Crossgen2 execution
+    local gcstandaloneModeToRestore=$COMPlus_GCName;
+    unset COMPlus_GCName
+
     __Command=$_DebuggerFullPath
     # Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
     if [ ! -z ${__TestDotNetCmd+x} ] %3B then
@@ -99,6 +108,7 @@ $(BashCLRTestPreCommands)
 
     ExePath=multifolder/multifolder.dll
     export COMPlus_NativeImageSearchPaths=$__OutputDir
+    export COMPlus_GCName=$gcstandaloneModeToRestore
 
 ]]></BashCLRTestPreCommands>
   </PropertyGroup>
index 18c1f0c..155fd38 100644 (file)
@@ -46,6 +46,8 @@ namespace R2RDumpTests
             string CoreLibAbsolutePath = Path.Combine(CoreRootVar, CoreLibFile);
             string OutputFile = Path.GetTempFileName();
             string TestDotNetCmdVar = Environment.GetEnvironmentVariable("__TestDotNetCmd");
+            // Unset COMPlus_GCName since standalone GC doesnt exist in official "dotnet" deployment
+            Environment.SetEnvironmentVariable("COMPlus_GCName", String.Empty);
             string DotNetAbsolutePath = string.IsNullOrEmpty(TestDotNetCmdVar) ? FindExePath("dotnet") : TestDotNetCmdVar;
 
             ProcessStartInfo processStartInfo = new ProcessStartInfo