-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Conversation
TODO: - Need to add tests Porting Notes: - Excludes EventLog dependency - Removes latebound dependency on messagebox Doesn't include ServiceInstaller but for testing purposes ported parts of it into TestServiceInstaller class that will be used for testing ServiceBase.
The managed TestService now has a simple ServiceBase TestService that logs all the events it recieves to a file. The project also as a simple TestServiceInstaller that will allow for programatic install and removal of a service. The main entry point provides a simple way to create/remove/run the TestService.
Update test project to use the new managed TestService instead of the old native test service and adjust the existing tests to account for those changes. Add basic ServiceBase tests. It isn't possible to test all the different events so only test the ones that we can reliably tests. The communication between the service and the tests is via a text file which isn't ideal but it is the simpliest option of the various options to work. All the tests need to call Stop to ensure the log file is flushed to disk and we have all the content we need in it.
test Outerloop NETFX x86 Release Build |
public struct SERVICE_DELAYED_AUTOSTART_INFO | ||
{ | ||
public bool fDelayedAutostart; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Unnecessary semicolon
public struct SERVICE_DESCRIPTION | ||
{ | ||
public IntPtr description; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Unnecessary semicolon
return false; | ||
|
||
// no slashes or backslash allowed | ||
foreach (char c in serviceName.ToCharArray()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ToCharArray()
unnecessarily allocates a char array
Initialize(true); | ||
} | ||
|
||
if (Environment.OSVersion.Version.Major >= 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check still needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
_status.controlsAccepted = _status.controlsAccepted | AcceptOptions.ACCEPT_SHUTDOWN; | ||
} | ||
|
||
if (Environment.OSVersion.Version.Major < 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
set | ||
{ | ||
if (value == null) | ||
throw new ArgumentNullException("value"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nameof(value)
if (value == null) | ||
throw new ArgumentNullException("value"); | ||
|
||
if (string.Compare(value, _name, StringComparison.OrdinalIgnoreCase) == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string.Equals
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// </copyright> | ||
//------------------------------------------------------------------------------ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect license header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out. I decided to not include this file at all but I forget to remove it from my original commit.
|
||
|
||
using System; | ||
using System.ComponentModel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run the codeformatter? Usings shouldn't be nested.
public struct SessionChangeDescription | ||
{ | ||
private SessionChangeReason _reason; | ||
private int _id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: readonly
} | ||
} | ||
} | ||
//catch { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should be removed or commented back in (along with //try
)
@dotnet/dnceng what is the best way to determine which tests failed? I see https://mc.dot.net/#/user/weshaggard/pr~2Fjenkins~2Fdotnet~2Fcorefx~2Fmaster~2F/test~2Ffunctional~2Fcli~2F/57c16a39b435caccc19aa518ab8b527d98da83e9 but don't see any failures just some "Unknown" blocks. This is from https://ci3.dot.net/job/dotnet_corefx/job/master/job/windows-TGroup_netcoreapp+CGroup_Debug+AGroup_x64+TestOuter_true_prtest/24/. |
@weshaggard the ?s are actually tests that didn't run at all for that configuration (no matching work item) but til recently we had a bug that showed them as ?. (@ChadNedzlek I believe has already fixed this but it hasn't been rolled out) I'll take a look since it's definitely showing runs that I'd label as complete and passed as failures, then hand off to the FR team as needed. |
@weshaggard this is freaky, there's some kind of MC bug. The failing test in all cases of those 4 runs is System.Runtime.Performance.Tests, which is timing out. Example log here. I will raid a FR issue and tag you / Chad. There's something definitely wrong about how this is getting rendered (I'm guessing there have been several builds of this, one of which succeeded, and stomped finding that) edit - these comments were before I realized job restarting had happened |
Yes that is why I have an open request to split the results across the different legs. |
test Linux x64 Release Build |
We have always had a "not supported" netstandard fallback but we put the real implementation in a netstandard windows build but that is also a little bit of a lie because we don't support it on things like UWP. So instead the real implementation should be under netcoreapp windows which is the only one we really support.
We no longer need to skip because the tests are now netcoreapp and netfx specific so we won't try to run them on uap now.
@@ -2,8 +2,9 @@ | |||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<PropertyGroup> | |||
<BuildConfigurations> | |||
netstandard; | |||
netcoreapp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I will remove it and just leave netstandard and netfx given we have to have a netstandard ref now for compat with the older package.
@@ -2,7 +2,7 @@ | |||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<PropertyGroup> | |||
<BuildConfigurations> | |||
netstandard-Windows_NT; | |||
netcoreapp-Windows_NT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means UWP no longer gets a valid impl. I guess that's OK. I doubt any of the API would work from appcontainer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct UWP isn't supporting these. On top of the win32 APIs it requires admin access for most of these actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo the extraneous netcoreapp ref config
We only need a netsteandard ref that can be shared between netcoreapp and netstandard.
Add ServiceBase Commit migrated from dotnet/corefx@bdb9164
This change add ServiceBase and some of the missing ServiceController APIs that are in .NET Framework.
resolves https://github.com/dotnet/corefx/issues/6024
The ported ServiceBase matches desktop except the dependency on EventLog is removed as we don't have EventLog support in .NET Core (at least not yet).
The port doesn't include ServiceInstaller or ServiceProcessInstaller as we don't want to pull forward the entire Installer abstraction into .NET Core. So while we have ServiceBase a .NET Core hosted service will need to be installed/removed using other methods (sc.exe, installers, or via code like our test service).
As part of the testing work I removed our dependency on the old native service and started using our new managed service which uses ServiceBase.
PTAL @stephentoub @ericstj
@TravisTheTechie @dasMulli it would be great if you guys could take a look as well.