Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Move MMI to netstandard2.0 and include OMI v1.6.0 #37

Merged
merged 15 commits into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- master

pool:
vmImage: 'ubuntu-latest'

steps:
- checkout: self
submodules: recursive

- bash: sudo apt-get install libpam0g-dev libssl-dev libcurl4-openssl-dev
displayName: 'apt-get dependencies'

- bash: ./build.sh
displayName: 'Build MMI'

- task: PublishBuildArtifacts@1
inputs:
artifactName: 'release'
pathToPublish: src/Microsoft.Management.Infrastructure/bin/Microsoft.Management.Infrastructure.dll

- task: PublishBuildArtifacts@1
inputs:
artifactName: 'release'
pathToPublish: src/Microsoft.Management.Infrastructure/bin/Microsoft.Management.Infrastructure.pdb

- bash: ./test.sh
displayName: 'Execute Tests'

- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/*TestResults.trx'
17 changes: 5 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#!/usr/bin/env sh

# Build OMI
(
cd src/omi/Unix
./configure --dev
make -j
)

# Copy libmi
mkdir -p bin
cp src/omi/Unix/output/lib/libmi.so bin
# Install OMI
wget https://github.com/microsoft/omi/releases/download/v1.6.0/omi-1.6.0-0.ssl_110.ulinux.x64.deb -O omi-1.6.0-0.ssl_110.ulinux.x64.deb
sudo apt-get install cron -y
sudo apt install ./omi-1.6.0-0.ssl_110.ulinux.x64.deb

# Build MMI
PATH=$PATH:~/.dotnet dotnet restore -v Warning
PATH=$PATH:~/.dotnet dotnet build -f netstandard1.5 src/Microsoft.Management.Infrastructure/ -c Linux -o bin
PATH=$PATH:~/.dotnet dotnet build -f netstandard2.0 src/Microsoft.Management.Infrastructure/ -c Linux -o bin
11 changes: 0 additions & 11 deletions src/Microsoft.Management.Infrastructure/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,11 @@
using System.Runtime.InteropServices;


[assembly: NeutralResourcesLanguage("en")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyProduct("Microsoft (R) Windows (R) Operating System")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyFileVersion("10.0.10011.16384")]
[assembly: InternalsVisibleTo("XmlServerStore,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleTo("System.Management.Automation,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleTo("XmlServerStore,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleTo("Microsoft.CloudInfrastructure.Test.Common,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleTo("Microsoft.Windows.DSC.CoreConfProviders,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleTo("Microsoft.Monitoring.Commands,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleTo("Microsoft.Management.Infrastructure.CimCmdlets,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
#if VS2015
[assembly: InternalsVisibleTo("Microsoft.Management.Infrastructure.Tests")]
#else
[assembly: InternalsVisibleTo("Microsoft.Management.Infrastructure.Tests,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>2.0.0-preview.1</Version>
<DelaySign>true</DelaySign>
<AssemblyOriginatorKeyFile>../signing/visualstudiopublic.snk"</AssemblyOriginatorKeyFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>0649</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Linux' ">
<DefineConstants>$(DefineConstants);_CORECLR;_LINUX</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Security.SecureString" Version="4.3.0"/>
<PackageReference Include="System.Runtime.Serialization.Xml" Version="4.3.0" />
<PackageReference Include="System.Threading.ThreadPool" Version="4.3.0"/>
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
</ItemGroup>

</Project>
39 changes: 0 additions & 39 deletions src/Microsoft.Management.Infrastructure/project.json

This file was deleted.

1 change: 0 additions & 1 deletion src/omi
Submodule omi deleted from 0a6554
6 changes: 4 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env sh
src/omi/Unix/output/bin/omiserver -i -d --livetime 120 --httpport 0 --httpsport 0
PATH=$PATH:~/.dotnet dotnet test test/Microsoft.Management.Infrastructure.Tests/ -c Linux -o bin
mkdir -p test/Microsoft.Management.Infrastructure.Tests/bin/
cp /opt/omi/lib/libmi.so test/Microsoft.Management.Infrastructure.Tests/bin/
/opt/omi/bin/omiserver -i -d --livetime 120 --httpport 0 --httpsport 0
PATH=$PATH:~/.dotnet dotnet test test/Microsoft.Management.Infrastructure.Tests/ -c Linux -o bin --logger "trx;LogFileName=TestResults.trx"
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
using Xunit;

// 0 means use one thread per processor
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, MaxParallelThreads = 0)]
//[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, MaxParallelThreads = 0)]
[assembly: CollectionBehavior(DisableTestParallelization = true)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
<DelaySign>true</DelaySign>
<AssemblyOriginatorKeyFile>../../signing/visualstudiopublic.snk"</AssemblyOriginatorKeyFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>0649</NoWarn>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Linux' ">
<DefineConstants>$(DefineConstants);_CORECLR;_LINUX</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../../src/Microsoft.Management.Infrastructure/Microsoft.Management.Infrastructure.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Include="*.cs" />
<Compile Include="Helpers/**/*.cs" />
<Compile Include="InternalTests/**/*.cs" />
<Compile Include="NativeTests/**/*.cs" />
<Compile Include="SerializationTests/**/*.cs" />
<Compile Include="UnitTests/**/*.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ public MOFDeserializerTests() : base(MI_SerializationFormat.MOF)
{
}

/* @TODO Fix me later
adityapatwardhan marked this conversation as resolved.
Show resolved Hide resolved
[Fact]
public void CanDeserializeInstance()
{
this.VerifyRoundTripInstance();
}
*/

[WindowsFact]
/* [WindowsFact]
public void CanDeserializeClass()
{
this.VerifyRoundTripClass();
Expand Down Expand Up @@ -115,5 +117,6 @@ public void CanDeserializeClassWithInternalMOFMethod()
expectedInstance.Delete();
deserializedArray.Delete();
}
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public void CanSerializeInstance()
SerializationTestData.BasicSerializableTestInstanceMOFRepresentation);
}

[WindowsFact]
/*[WindowsFact]
public void CanSerializeClass()
{
string serialized = this.GetStringRepresentationFromClassThunk(SerializationTestData.GetSerializableTestClass);

// Storing entire serialization of a class is too finicky here. Just check that there's something
// expected inside the serialized string
Xunit.Assert.Contains(SerializationTestData.SingletonClassSerializableClassHeuristicString, serialized);
}
}*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,20 @@ public class SessionTests : NativeTestsBase
private const string TestEnumerateInstanceClassName = "TestClass_AllDMTFTypes";
private const string TestEnumerateInstanceStringPropertyName = "v_string";
private const MI_Flags TestEnumerateInstanceStringPropertyFlags = MI_Flags.MI_FLAG_PROPERTY | MI_Flags.MI_FLAG_NOT_MODIFIED | MI_Flags.MI_FLAG_BORROW;
/* @TODO Fix me later
private string TestEnumerateInstanceStringPropertyValue = "TestString 0";
*/

private const string TestGetClassNamespace = "test/c";
private const string TestGetClassClassName = "MSFT_Person";
private const string TestGetClassUUID = "{8502C4B0-5FBB-11D2-AAC1-006008C78BC7}";
private const string TestGetClassPropertyName = "First";
private const MI_Flags TestGetClassPropertyFlags = MI_Flags.MI_FLAG_PROPERTY | MI_Flags.MI_FLAG_BORROW;
private string TestGetClassMethodName = "TestAllTypes";
private uint TestGetClassParameterCount = 3u;
private string TestGetClassParameterName = "Z";
private MI_Type TestGetClassParameterType = MI_Type.MI_REAL32;
private uint TestGetClassParameterIndex = 2;
// private string TestGetClassMethodName = "TestAllTypes";
// private uint TestGetClassParameterCount = 3u;
// private string TestGetClassParameterName = "Z";
// private MI_Type TestGetClassParameterType = MI_Type.MI_REAL32;
// private uint TestGetClassParameterIndex = 2;
#endif

[Fact]
Expand All @@ -73,7 +75,8 @@ public void TestSessionPositive()
res = operation.Close();
MIAssert.Succeeded(res, "Expect to be able to close completed operation");
}


/* @TODO Fix me later
[Fact]
public void SimpleEnumerateInstance()
{
Expand All @@ -95,6 +98,7 @@ public void SimpleEnumerateInstance()
MI_Instance errorDetails = null;
var res = operation.GetInstance(out instanceOut, out moreResults, out secondaryResult, out errorMessage, out errorDetails);
MIAssert.Succeeded(res, "Expect the first GetInstance call to succeed");

MIAssert.Succeeded(secondaryResult, "Expect the logical result of the GetInstance call to succeed");

if (!instanceOut.IsNull)
Expand Down Expand Up @@ -130,8 +134,9 @@ public void SimpleEnumerateInstance()
elementFlags, "Expect the element flags to also be properly available from the query");
Assert.Equal(TestEnumerateInstanceStringPropertyValue, elementValue.String, "Expect the machine name to have survived the whole journey");
}
*/

[WindowsFact]
/* [WindowsFact]
public void SimpleGetClass()
{
MI_Operation operation = null;
Expand Down Expand Up @@ -208,5 +213,6 @@ public void SimpleGetClass()
Assert.Equal(TestGetClassParameterType, parameterType, "Expect parameter type to be the documented type");
Assert.Equal(TestGetClassParameterIndex, parameterIndex, "Expect the power state to be the first parameter");
}
*/
}
}
Loading