File tree Expand file tree Collapse file tree 7 files changed +21
-5
lines changed
Expand file tree Collapse file tree 7 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,7 @@ jobs:
213213 Contents : |
214214 AppInstallerCLIE2ETests\**
215215 AppInstallerCLITests\**
216+ ComInprocTestbed\**
216217 Microsoft.Management.Configuration\**
217218 Microsoft.Management.Configuration.UnitTests\**
218219 Microsoft.Management.Configuration.OutOfProc\**
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ namespace AppInstaller::ShutdownMonitoring
7171 using ShutdownCompleteCallback = void (*)();
7272
7373 // Initializes the monitoring system and sets up a callback to be invoked when shutdown is completed.
74- static void Initialize (ShutdownCompleteCallback callback);
74+ static void Initialize (ShutdownCompleteCallback callback, bool createTerminationSignalHandler = true );
7575
7676 // "Interface" for a single component to synchronize with.
7777 struct ComponentSystem
Original file line number Diff line number Diff line change @@ -286,9 +286,16 @@ namespace AppInstaller::ShutdownMonitoring
286286 }
287287 }
288288
289- void ServerShutdownSynchronization::Initialize (ShutdownCompleteCallback callback)
289+ void ServerShutdownSynchronization::Initialize (ShutdownCompleteCallback callback, bool createTerminationSignalHandler )
290290 {
291291 Instance ().m_callback = callback;
292+
293+ // Force the creation of the TerminationSignalHandler singleton so that the process can listen for termination signals even if
294+ // it never attempts to run anything that explicitly registers for cancellation callbacks.
295+ if (createTerminationSignalHandler)
296+ {
297+ TerminationSignalHandler::Instance ();
298+ }
292299 }
293300
294301 void ServerShutdownSynchronization::AddComponent (const ComponentSystem& component)
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ public class Constants
3333 public const string SkipTestSourceParameter = "SkipTestSource" ;
3434 public const string ForcedExperimentalFeaturesParameter = "ForcedExperimentalFeatures" ;
3535 public const string InprocTestbedPathParameter = "InprocTestbedPath" ;
36+ public const string InprocTestbedUseTestPackageParameter = "InprocTestbedUseTestPackage" ;
3637
3738 // Test Sources
3839 public const string DefaultWingetSourceName = @"winget" ;
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ private TestSetup()
3131 this . VerboseLogging = this . InitializeBoolParam ( Constants . VerboseLoggingParameter , true ) ;
3232 this . LooseFileRegistration = this . InitializeBoolParam ( Constants . LooseFileRegistrationParameter ) ;
3333 this . SkipTestSource = this . InitializeBoolParam ( Constants . SkipTestSourceParameter , this . IsDefault ) ;
34+ this . InprocTestbedUseTestPackage = this . InitializeBoolParam ( Constants . InprocTestbedUseTestPackageParameter ) ;
3435
3536 // For packaged context, default to AppExecutionAlias
3637 this . AICLIPath = this . InitializeStringParam ( Constants . AICLIPathParameter , this . PackagedContext ? "WinGetDev.exe" : TestCommon . GetTestFile ( "winget.exe" ) ) ;
@@ -136,6 +137,11 @@ public static TestSetup Parameters
136137 /// </summary>
137138 public string InprocTestbedPath { get ; }
138139
140+ /// <summary>
141+ /// Gets a value indicating whether to use the test package or not.
142+ /// </summary>
143+ public bool InprocTestbedUseTestPackage { get ; }
144+
139145 /// <summary>
140146 /// Gets a value indicating whether to skip creating test source.
141147 /// </summary>
Original file line number Diff line number Diff line change @@ -75,11 +75,10 @@ public void OneTimeSetup()
7575 if ( string . IsNullOrWhiteSpace ( this . InprocTestbedPath ) )
7676 {
7777 string assemblyLocation = Assembly . GetExecutingAssembly ( ) . Location ;
78- this . InprocTestbedPath = Path . Combine ( Path . GetDirectoryName ( assemblyLocation ) , "..\\ ComInprocTestbed\\ ComInprocTestbed.exe" ) ;
78+ this . InprocTestbedPath = Path . Join ( Path . GetDirectoryName ( assemblyLocation ) , "..\\ ComInprocTestbed\\ ComInprocTestbed.exe" ) ;
7979 }
8080
81- // If we are using the test source, target a package in it
82- if ( ! TestSetup . Parameters . SkipTestSource )
81+ if ( TestSetup . Parameters . InprocTestbedUseTestPackage )
8382 {
8483 this . TargetPackageInformation = $ "-pkg { Constants . ExeInstallerPackageId } -src { Constants . TestSourceName } -url { Constants . TestSourceUrl } ";
8584 }
Original file line number Diff line number Diff line change 3333 -PowerShellModulePath $(buildOutDir)\PowerShell\Microsoft.WinGet.Client\Microsoft.WinGet.Client.psd1
3434 -LocalServerCertPath $(Agent.TempDirectory)\servercert.cer
3535 -SkipTestSource true
36+ -InprocTestbedUseTestPackage true
3637 -ForcedExperimentalFeatures ${{ parameters.experimentalFeatures }}'
3738 ${{ else }} :
3839 overrideTestrunParameters : ' -PackagedContext false
4142 -PowerShellModulePath $(buildOutDir)\PowerShell\Microsoft.WinGet.Client\Microsoft.WinGet.Client.psd1
4243 -LocalServerCertPath $(Agent.TempDirectory)\servercert.cer
4344 -SkipTestSource true
45+ -InprocTestbedUseTestPackage true
4446 -ForcedExperimentalFeatures ${{ parameters.experimentalFeatures }}'
4547
4648 - task : CmdLine@2
You can’t perform that action at this time.
0 commit comments