Skip to content

Commit

Permalink
Handle integration tests and nightly build testing (#5509)
Browse files Browse the repository at this point in the history
* Make -integrationTests work

* Update .yml file

* Added the TargetArchitecture properties

* Try out -integrationTest

* Missed -integrationTest flag

* Renamed FunctionalTestBaseClass to IntegrationTestBaseClass

* Missed rename

* Modified tests to make them more stable
  • Loading branch information
antoniovs1029 authored Dec 2, 2020
1 parent 8e84aa3 commit c9ec20b
Show file tree
Hide file tree
Showing 30 changed files with 79 additions and 70 deletions.
2 changes: 1 addition & 1 deletion Microsoft.ML.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.TestFramework"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Predictor.Tests", "test\Microsoft.ML.Predictor.Tests\Microsoft.ML.Predictor.Tests.csproj", "{6B047E09-39C9-4583-96F3-685D84CA4117}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Functional.Tests", "test\Microsoft.ML.Functional.Tests\Microsoft.ML.Functional.Tests.csproj", "{CFED9F0C-FF81-4C96-8D5E-0436264CA7B5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.IntegrationTests", "test\Microsoft.ML.IntegrationTests\Microsoft.ML.IntegrationTests.csproj", "{CFED9F0C-FF81-4C96-8D5E-0436264CA7B5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.ResultProcessor", "src\Microsoft.ML.ResultProcessor\Microsoft.ML.ResultProcessor.csproj", "{3769FCC3-9AFF-4C37-97E9-6854324681DF}"
EndProject
Expand Down
17 changes: 9 additions & 8 deletions build/ci/job-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
dotnetPath: $(Build.SourcesDirectory)/.dotnet/dotnet
nugetFeed: https://pkgs.dev.azure.com/dnceng/public/_packaging/MachineLearning/nuget/v3/index.json
nightlyBuildProjPath: $(Build.SourcesDirectory)/test/Microsoft.ML.NightlyBuild.Tests/Microsoft.ML.NightlyBuild.Tests.csproj
nightlyBuildRunPath: $(Build.SourcesDirectory)/bin/AnyCPU.$(_configuration)/Microsoft.ML.NightlyBuild.Tests/$(_targetFramework)
nightlyBuildRunPath: $(Build.SourcesDirectory)/artifacts/bin/Microsoft.ML.NightlyBuild.Tests/$(_configuration)/$(_targetFramework)
runNightlyBuildProj: $(Build.SourcesDirectory)/test/run-night-build-tests.proj
packageUpdaterProjPath: $(Build.SourcesDirectory)/test/Microsoft.ML.NugetPackageVersionUpdater/Microsoft.ML.NugetPackageVersionUpdater.csproj
versionFilePath: $(Build.SourcesDirectory)/test/Microsoft.ML.NugetPackageVersionUpdater/latest_versions.txt
PROCDUMP_PATH: '$(Build.SourcesDirectory)/Tools/ProcDump/'
Expand Down Expand Up @@ -100,25 +101,25 @@ jobs:
displayName: Update package versions for nightly build
- ${{ if eq(parameters.buildScript, 'build.cmd') }}:
- powershell: |
Get-ChildItem -Path '.\bin\AnyCPU.*' -Recurse |
Get-ChildItem -Path '.\artifacts\bin\*' -Recurse |
Select -ExpandProperty FullName |
Where {$_ -notlike '*\Microsoft.ML.NightlyBuild.Tests*'} |
Where {$_ -NotMatch '.*\\Microsoft\.ML\.NightlyBuild\.Tests.*|.*\\Native.*'} |
sort length -Descending |
Remove-Item -force
Write-Output "Done cleaning up usless project..."
displayName: Clean up useless project
- script: $(dotnetPath) msbuild -restore $(nightlyBuildProjPath) /p:ReferenceTypeForTestFramework="Nuget" -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }}
- script: $(dotnetPath) msbuild -restore $(nightlyBuildProjPath) /p:ReferenceTypeForTestFramework="Nuget" /p:Configuration=$(_configuration) /p:TargetArchitecture=${{ parameters.architecture }}
displayName: Build Nightly-Build Project with latest package versions
- script: ${{ parameters.buildScript }} /p:Build=false -$(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} -runnightlybuildtests /p:RestorePackagesPath=$(Build.SourcesDirectory)\packages /p:NUGET_PACKAGES=$(Build.SourcesDirectory)\packages
- script: $(dotnetPath) msbuild $(runNightlyBuildProj) /t:RunNightlyBuildTests /p:Configuration=$(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }}
displayName: Run Nightly Build Tests
- ${{ if eq(parameters.nightlyBuild, 'false') }}:
- ${{ if eq(parameters.innerLoop, 'false') }}:
- ${{ if and(eq(parameters.runSpecific, 'false'), eq(parameters.useVSTestTask, 'false')) }}:
# TODO: Code coverage needs to be fixed.
- script: ${{ parameters.buildScript }} /p:Build=false -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} -test -ci #-coverage=${{ parameters.codeCoverage }}
- script: ${{ parameters.buildScript }} /p:Build=false -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} -test -integrationTest -ci #-coverage=${{ parameters.codeCoverage }}
displayName: Run All Tests.
- ${{ if and(eq(parameters.runSpecific, 'true'), eq(parameters.useVSTestTask, 'false')) }}:
- script: ${{ parameters.buildScript }} /p:Build=false -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} -test -ci /p:TestRunnerAdditionalArguments='-trait$(spaceValue)Category=RunSpecificTest' /p:RestorePackagesPath=$(Build.SourcesDirectory)\packages /p:NUGET_PACKAGES=$(Build.SourcesDirectory)\packages #-coverage=${{ parameters.codeCoverage }}
- script: ${{ parameters.buildScript }} /p:Build=false -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} -test -integrationTest -ci /p:TestRunnerAdditionalArguments='-trait$(spaceValue)Category=RunSpecificTest' /p:RestorePackagesPath=$(Build.SourcesDirectory)\packages /p:NUGET_PACKAGES=$(Build.SourcesDirectory)\packages #-coverage=${{ parameters.codeCoverage }}
displayName: Run Specific Tests.
- ${{ if and(eq(parameters.buildScript, 'build.cmd'), eq(parameters.useVSTestTask, 'true')) }}:
- task: VSTest@2
Expand All @@ -142,7 +143,7 @@ jobs:
collectDumpOn: onAbortOnly
publishRunAttachments: true
- ${{ if eq(parameters.innerLoop, 'true') }}:
- script: ${{ parameters.buildScript }} /p:Build=false -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} -test -ci /p:TestRunnerAdditionalArguments='-notrait$(spaceValue)Category=SkipInCI' /p:RestorePackagesPath=$(Build.SourcesDirectory)\packages /p:NUGET_PACKAGES=$(Build.SourcesDirectory)\packages #-coverage=${{ parameters.codeCoverage }}
- script: ${{ parameters.buildScript }} /p:Build=false -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} -test -integrationTest -ci /p:TestRunnerAdditionalArguments='-notrait$(spaceValue)Category=SkipInCI' /p:RestorePackagesPath=$(Build.SourcesDirectory)\packages /p:NUGET_PACKAGES=$(Build.SourcesDirectory)\packages #-coverage=${{ parameters.codeCoverage }}
displayName: Run CI Tests.
- script: $(dotnetPath) msbuild -restore build/Codecoverage.proj
displayName: Upload coverage to codecov.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)" -->
</Target>

<!-- The targets below are needed for arcade -->

<Target Name="Build"
DependsOnTargets="CopyDnnModelFiles" />

Expand All @@ -125,4 +127,6 @@

<Target Name="PerformanceTest"/>

<Target Name="IntegrationTest"/>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.ML.Data;
using Microsoft.ML.Functional.Tests.Datasets;
using Microsoft.ML.IntegrationTests.Datasets;
using Xunit;
using Xunit.Sdk;

namespace Microsoft.ML.Functional.Tests
namespace Microsoft.ML.IntegrationTests
{
internal static class Common
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
// See the LICENSE file in the project root for more information.

using System.IO;
using Microsoft.ML.Functional.Tests.Datasets;
using Microsoft.ML.IntegrationTests.Datasets;
using Microsoft.ML.TestFrameworkCommon;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.ML.Functional.Tests
namespace Microsoft.ML.IntegrationTests
{
/// <summary>
/// Test data input and output formats.
/// </summary>
public class DataIO : FunctionalTestBaseClass
public class DataIO : IntegrationTestBaseClass
{
// Separators to test
private readonly char[] _separators;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
// See the LICENSE file in the project root for more information.

using System;
using Microsoft.ML.Functional.Tests.Datasets;
using Microsoft.ML.IntegrationTests.Datasets;
using Microsoft.ML.TestFrameworkCommon;
using Microsoft.ML.Trainers;
using Microsoft.ML.Transforms.Text;
using Xunit;
using Xunit.Abstractions;
using static Microsoft.ML.Transforms.HashingEstimator;

namespace Microsoft.ML.Functional.Tests
namespace Microsoft.ML.IntegrationTests
{
public class DataTransformation : FunctionalTestBaseClass
public class DataTransformation : IntegrationTestBaseClass
{
public DataTransformation(ITestOutputHelper output) : base(output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using Microsoft.ML.Data;

namespace Microsoft.ML.Functional.Tests.Datasets
namespace Microsoft.ML.IntegrationTests.Datasets
{
/// <summary>
/// A class for the Adult test dataset.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace Microsoft.ML.Functional.Tests.Datasets
namespace Microsoft.ML.IntegrationTests.Datasets
{
/// <summary>
/// A class to hold a feature column.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using Microsoft.ML.Data;

namespace Microsoft.ML.Functional.Tests.Datasets
namespace Microsoft.ML.IntegrationTests.Datasets
{
/// <summary>
/// A schematized class for loading the HousingRegression dataset.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System;
using Microsoft.ML.Data;

namespace Microsoft.ML.Functional.Tests.Datasets
namespace Microsoft.ML.IntegrationTests.Datasets
{
/// <summary>
/// A class for the Iris test dataset.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using Microsoft.ML.Data;

namespace Microsoft.ML.Functional.Tests.Datasets
namespace Microsoft.ML.IntegrationTests.Datasets
{
internal sealed class MnistOneClass
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using Microsoft.ML.Data;

namespace Microsoft.ML.Functional.Tests.Datasets
namespace Microsoft.ML.IntegrationTests.Datasets
{
/// <summary>
/// A class for reading in the Sentiment test dataset.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

using Microsoft.ML.Data;

namespace Microsoft.ML.Functional.Tests.Datasets
namespace Microsoft.ML.IntegrationTests.Datasets
{
/// <summary>
/// A class describing the TrivialMatrixFactorization test dataset.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Collections.Generic;
using Microsoft.ML.Data;

namespace Microsoft.ML.Functional.Tests.Datasets
namespace Microsoft.ML.IntegrationTests.Datasets
{
/// <summary>
/// A class containing one property per <see cref="DataKind"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using Microsoft.ML.Data;
using Microsoft.ML.Functional.Tests.Datasets;
using Microsoft.ML.IntegrationTests.Datasets;
using Microsoft.ML.TestFrameworkCommon;
using Microsoft.ML.Trainers;
using Microsoft.ML.Transforms.Text;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.ML.Functional.Tests
namespace Microsoft.ML.IntegrationTests
{
public class Debugging : FunctionalTestBaseClass
public class Debugging : IntegrationTestBaseClass
{
public Debugging(ITestOutputHelper output) : base(output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
// See the LICENSE file in the project root for more information.

using Microsoft.ML.Data;
using Microsoft.ML.Functional.Tests.Datasets;
using Microsoft.ML.IntegrationTests.Datasets;
using Microsoft.ML.TestFrameworkCommon;
using Microsoft.ML.TestFrameworkCommon.Attributes;
using Microsoft.ML.Trainers;
using Microsoft.ML.Trainers.FastTree;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.ML.Functional.Tests
namespace Microsoft.ML.IntegrationTests
{
public class Evaluation : FunctionalTestBaseClass
public class Evaluation : IntegrationTestBaseClass
{
public Evaluation(ITestOutputHelper output): base(output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
// See the LICENSE file in the project root for more information.

using Microsoft.ML.Data;
using Microsoft.ML.Functional.Tests.Datasets;
using Microsoft.ML.IntegrationTests.Datasets;
using Microsoft.ML.TestFrameworkCommon;
using Microsoft.ML.Trainers;
using Microsoft.ML.Trainers.FastTree;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.ML.Functional.Tests
namespace Microsoft.ML.IntegrationTests
{
/// <summary>
/// Test explainability features.
/// </summary>
public class Explainability : FunctionalTestBaseClass
public class Explainability : IntegrationTestBaseClass
{
public Explainability(ITestOutputHelper output) : base(output)
{
Expand All @@ -36,13 +36,13 @@ public void GlobalFeatureImportanceWithPermutationFeatureImportance(bool saveMod

// Create a pipeline to train on the housing data.
var pipeline = mlContext.Transforms.Concatenate("Features", HousingRegression.Features)
.Append(mlContext.Regression.Trainers.Sdca());
.Append(mlContext.Regression.Trainers.FastTree());

// Fit the pipeline
var model = pipeline.Fit(data);

IDataView transformedData;
RegressionPredictionTransformer<LinearRegressionModelParameters> linearPredictor;
RegressionPredictionTransformer<FastTreeRegressionModelParameters> linearPredictor;

if(saveModel)
{
Expand All @@ -57,7 +57,7 @@ public void GlobalFeatureImportanceWithPermutationFeatureImportance(bool saveMod
transformedData = loadedModel.Transform(data);

// Extract linear predictor
linearPredictor = (loadedModel as TransformerChain<ITransformer>).LastTransformer as RegressionPredictionTransformer<LinearRegressionModelParameters>;
linearPredictor = (loadedModel as TransformerChain<ITransformer>).LastTransformer as RegressionPredictionTransformer<FastTreeRegressionModelParameters>;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
using Microsoft.ML.TestFrameworkCommon.Attributes;
using Xunit.Abstractions;

namespace Microsoft.ML.Functional.Tests
namespace Microsoft.ML.IntegrationTests
{
public class FunctionalTestBaseClass : IDisposable
public class IntegrationTestBaseClass : IDisposable
{
static FunctionalTestBaseClass()
static IntegrationTestBaseClass()
{
RootDir = TestCommon.GetRepoRoot();
DataDir = Path.Combine(RootDir, "test", "data");
Expand All @@ -31,20 +31,20 @@ static FunctionalTestBaseClass()
protected static string DataDir { get; }
protected ITestOutputHelper Output { get; }

public FunctionalTestBaseClass(ITestOutputHelper output)
public IntegrationTestBaseClass(ITestOutputHelper output)
{
//This locale is currently set for tests only so that the produced output
//files can be compared on systems with other locales to give set of known
//correct results that are on en-US locale.
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

#if NETFRAMEWORK
string codeBaseUri = typeof(FunctionalTestBaseClass).Assembly.CodeBase;
string codeBaseUri = typeof(IntegrationTestBaseClass).Assembly.CodeBase;
string path = new Uri(codeBaseUri).AbsolutePath;
var currentAssemblyLocation = new FileInfo(Directory.GetParent(path).FullName);
#else
// There is an extra folder in the netfx path representing the runtime identifier.
var currentAssemblyLocation = new FileInfo(typeof(FunctionalTestBaseClass).Assembly.Location);
var currentAssemblyLocation = new FileInfo(typeof(IntegrationTestBaseClass).Assembly.Location);
#endif
OutDir = Path.Combine(currentAssemblyLocation.Directory.FullName, "TestOutput");
Directory.CreateDirectory(OutDir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
using System.Collections.Immutable;
using System.Linq;
using Microsoft.ML.Data;
using Microsoft.ML.Functional.Tests.Datasets;
using Microsoft.ML.IntegrationTests.Datasets;
using Microsoft.ML.TestFrameworkCommon;
using Microsoft.ML.Trainers;
using Microsoft.ML.Trainers.FastTree;
using Microsoft.ML.Transforms;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.ML.Functional.Tests
namespace Microsoft.ML.IntegrationTests
{
public class IntrospectiveTraining : FunctionalTestBaseClass
public class IntrospectiveTraining : IntegrationTestBaseClass
{
public IntrospectiveTraining(ITestOutputHelper output) : base(output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<!-- DON'T CHANGE THIS!!! We are turning off strong naming to ensure we never add `InternalsVisibleTo` for these tests -->
<PublicSign>false</PublicSign>
<ReferenceTypeForTestFramework>Project</ReferenceTypeForTestFramework>

<IsUnitTestProject>false</IsUnitTestProject>
<IsIntegrationTestProject>true</IsIntegrationTestProject>

</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
using System.Text.RegularExpressions;
using Microsoft.ML.Calibrators;
using Microsoft.ML.Data;
using Microsoft.ML.Functional.Tests.Datasets;
using Microsoft.ML.IntegrationTests.Datasets;
using Microsoft.ML.TestFrameworkCommon;
using Microsoft.ML.Trainers.FastTree;
using Microsoft.ML.Transforms;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.ML.Functional.Tests
namespace Microsoft.ML.IntegrationTests
{
public partial class ModelFiles : FunctionalTestBaseClass
public partial class ModelFiles : IntegrationTestBaseClass
{
public ModelFiles(ITestOutputHelper output) : base(output)
{
Expand Down
Loading

0 comments on commit c9ec20b

Please sign in to comment.