From 3ddc86a42800e933dfc53f993e6afc43ba6fcbe9 Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Mon, 1 Oct 2018 08:00:44 -0700 Subject: [PATCH] Fix mof file (#1457) --- src/AspNetCoreModuleV2/AspNetCore/ancm.mof | 2 +- .../Utilities/IISCapability.cs | 3 ++- test/IIS.FunctionalTests/MofFileTests.cs | 26 +++++++++++++++++++ .../RequiresIISAttribute.cs | 12 +++++++++ .../WindowsAuthTests.cs | 2 -- 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 test/IIS.FunctionalTests/MofFileTests.cs diff --git a/src/AspNetCoreModuleV2/AspNetCore/ancm.mof b/src/AspNetCoreModuleV2/AspNetCore/ancm.mof index 5a50b19914..f3f7fcd15a 100644 --- a/src/AspNetCoreModuleV2/AspNetCore/ancm.mof +++ b/src/AspNetCoreModuleV2/AspNetCore/ancm.mof @@ -5,7 +5,7 @@ /* * AspNetCore module trace events layout * Uncomment the following class to run mof2trace to generate header file - * comment it back before checking it in */ + * comment it back before checking it in [Dynamic, Description("IIS: WWW Server"), Guid("{3a2a4e84-4c21-4981-ae10-3fda0d9b0f83}"), diff --git a/test/Common.FunctionalTests/Utilities/IISCapability.cs b/test/Common.FunctionalTests/Utilities/IISCapability.cs index 9550eac3e5..30c270fa77 100644 --- a/test/Common.FunctionalTests/Utilities/IISCapability.cs +++ b/test/Common.FunctionalTests/Utilities/IISCapability.cs @@ -14,6 +14,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests PoolEnvironmentVariables = 4, ShutdownToken = 8, DynamicCompression = 16, - ApplicationInitialization = 32 + ApplicationInitialization = 32, + TracingModule = 64 } } diff --git a/test/IIS.FunctionalTests/MofFileTests.cs b/test/IIS.FunctionalTests/MofFileTests.cs new file mode 100644 index 0000000000..a054225ac5 --- /dev/null +++ b/test/IIS.FunctionalTests/MofFileTests.cs @@ -0,0 +1,26 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Diagnostics; +using System.IO; +using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests; +using Microsoft.AspNetCore.Testing; +using Microsoft.AspNetCore.Testing.xunit; +using Xunit; + +namespace IIS.FunctionalTests +{ + public class MofFileTests + { + [ConditionalFact] + [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] + [RequiresIIS(IISCapability.TracingModule)] + public void CheckMofFile() + { + var path = Path.Combine(TestPathUtilities.GetSolutionRootDirectory("IISIntegration"), "src", "aspnetcoremodulev2", "aspnetcore", "ancm.mof"); + var process = Process.Start("mofcomp.exe", path); + process.WaitForExit(); + Assert.Equal(0, process.ExitCode); + } + } +} diff --git a/test/IIS.FunctionalTests/RequiresIISAttribute.cs b/test/IIS.FunctionalTests/RequiresIISAttribute.cs index 9fa3a7c502..f78de73d47 100644 --- a/test/IIS.FunctionalTests/RequiresIISAttribute.cs +++ b/test/IIS.FunctionalTests/RequiresIISAttribute.cs @@ -23,6 +23,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private static readonly bool _poolEnvironmentVariablesAvailable; private static readonly bool _dynamicCompressionAvailable; private static readonly bool _applicationInitializationModule; + private static readonly bool _tracingModuleAvailable; static RequiresIISAttribute() { @@ -87,6 +88,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests _applicationInitializationModule = File.Exists(Path.Combine(Environment.SystemDirectory, "inetsrv", "warmup.dll")); + _tracingModuleAvailable = File.Exists(Path.Combine(Environment.SystemDirectory, "inetsrv", "iisetw.dll")); + var iisRegistryKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\InetStp", writable: false); if (iisRegistryKey == null) { @@ -157,6 +160,15 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests SkipReason += "The machine does not have IIS ApplicationInitialization installed."; } } + + if (capabilities.HasFlag(IISCapability.TracingModule)) + { + IsMet &= _tracingModuleAvailable; + if (!_tracingModuleAvailable) + { + SkipReason += "The machine does not have IIS TracingModule installed."; + } + } } public bool IsMet { get; } diff --git a/test/IISExpress.FunctionalTests/WindowsAuthTests.cs b/test/IISExpress.FunctionalTests/WindowsAuthTests.cs index 3720385d4c..5511d017a1 100644 --- a/test/IISExpress.FunctionalTests/WindowsAuthTests.cs +++ b/test/IISExpress.FunctionalTests/WindowsAuthTests.cs @@ -1,14 +1,12 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Server.IntegrationTesting.IIS; using Microsoft.AspNetCore.Testing.xunit; using Xunit; -using Xunit.Abstractions; namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests {