Skip to content

Commit

Permalink
[Harness] Remove not needed classes from the BCLTestImporter.
Browse files Browse the repository at this point in the history
Remove two classes that are not really needed and a method. We moved to
named tuples to make things simpler. Unfortunally C# does not support:

```csharp
using MyNamedTuple = (string Name, double value, bool answer);
```

But we have to live with this. Makes the namespace simpler and removes
confusion with the already present project classes that are more widely
used.
  • Loading branch information
mandel-macaque committed Mar 28, 2020
1 parent 29a530c commit a150c95
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 65 deletions.
28 changes: 12 additions & 16 deletions tests/xharness/BCLTestImporter/BCLTestProjectGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ namespace Xharness.BCLTestImporter {
/// </summary>
public class BCLTestProjectGenerator {

static string NUnitPattern = "monotouch_*_test.dll";
static string xUnitPattern = "monotouch_*_xunit-test.dll";

// we have two different types of list, those that are for the iOS like projects (ios, tvos and watch os) and those
// for mac
static readonly List<BclTestProjectInfo> commoniOSTestProjects = new List<BclTestProjectInfo> {
Expand Down Expand Up @@ -201,7 +198,7 @@ public BCLTestProjectGenerator (string outputDirectory, string monoRootPath) : t
/// has its own details.</param>
/// <param name="generatedDir">The dir where the projects will be saved.</param>
/// <returns></returns>
public Task<List<BclTestProject>> GenerateTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects, Platform platform)
public Task<GeneratedProjects> GenerateTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects, Platform platform)
=> TemplatedProject.GenerateTestProjectsAsync (projects, platform);

List<BclTestProjectInfo> GetProjectDefinitions (List<BclTestProjectInfo> definitions, Platform platform)
Expand Down Expand Up @@ -242,35 +239,34 @@ List<BclTestProjectInfo> GetProjectDefinitions (List<BclTestProjectInfo> definit
return testProjects;
}

async Task<List<iOSBclTestProject>> GenerateAllCommonTestProjectsAsync ()
async Task<List<(string Name, string Path, bool XUnit, string ExtraArgs, List<Platform> Platforms, string Failure, double TimeoutMultiplier)>> GenerateAlliOSTestProjectsAsync ()
{
var projectPaths = new List<iOSBclTestProject> ();
var projects = new Dictionary<string, iOSBclTestProject> ();
var projectPaths = new List<(string Name, string Path, bool XUnit, string ExtraArgs, List<Platform> Platforms, string Failure, double TimeoutMultiplier)> ();
var projects = new Dictionary<string, (string Path, bool XUnit, string ExtraArgs, List<Platform> Platforms, string Failure, double TimeoutMultiplier)> ();
foreach (var platform in new [] { Platform.iOS, Platform.TvOS, Platform.WatchOS }) {
var generated = await GenerateTestProjectsAsync (GetProjectDefinitions (commoniOSTestProjects, platform), platform);
foreach (var tp in generated) {
if (!projects.ContainsKey (tp.Name)) {
projects [tp.Name] = new iOSBclTestProject { Path = tp.Path, XUnit = tp.XUnit, ExtraArgs = tp.ExtraArgs, Platforms = new List<Platform> { platform }, Failure = tp.Failure, TimeoutMultiplier = tp.TimeoutMultiplier };
projects [tp.Name] = (tp.Path, tp.XUnit, tp.ExtraArgs, new List<Platform> { platform }, tp.Failure, tp.TimeoutMultiplier);
} else {
projects [tp.Name].Platforms.Add (platform);
projects [tp.Name].TimeoutMultiplier += (tp.TimeoutMultiplier - 1);
var project = projects [tp.Name];
project.Platforms.Add (platform);
project.TimeoutMultiplier += (tp.TimeoutMultiplier - 1);
}
}
} // foreach platform

// return the grouped projects
foreach (var name in projects.Keys) {
projectPaths.Add (new iOSBclTestProject { Name = name, Path = projects [name].Path, XUnit = projects [name].XUnit, ExtraArgs = projects [name].ExtraArgs, Platforms = projects [name].Platforms, Failure = projects [name].Failure, TimeoutMultiplier = projects [name].TimeoutMultiplier });
projectPaths.Add ((name, projects [name].Path, projects [name].XUnit, projects [name].ExtraArgs, projects [name].Platforms, projects [name].Failure, projects [name].TimeoutMultiplier));
}
return projectPaths;
}

public Task<List<iOSBclTestProject>> GenerateAlliOSTestProjectsAsync () => GenerateAllCommonTestProjectsAsync ();

public List<iOSBclTestProject> GenerateAlliOSTestProjects () => GenerateAlliOSTestProjectsAsync ().Result;
public List<(string Name, string Path, bool XUnit, string ExtraArgs, List<Platform> Platforms, string Failure, double TimeoutMultiplier)> GenerateAlliOSTestProjects () => GenerateAlliOSTestProjectsAsync ().Result;

public Task<List<BclTestProject>> GenerateAllMacTestProjectsAsync (Platform platform) => GenerateTestProjectsAsync (GetProjectDefinitions (macTestProjects, platform), platform);
public Task<GeneratedProjects> GenerateAllMacTestProjectsAsync (Platform platform) => GenerateTestProjectsAsync (GetProjectDefinitions (macTestProjects, platform), platform);

public List<BclTestProject> GenerateAllMacTestProjects (Platform platform) => GenerateAllMacTestProjectsAsync (platform).Result;
public GeneratedProjects GenerateAllMacTestProjects (Platform platform) => GenerateAllMacTestProjectsAsync (platform).Result;
}
}
11 changes: 0 additions & 11 deletions tests/xharness/BCLTestImporter/BclTestProject.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
using System.Threading.Tasks;

namespace Xharness.BCLTestImporter.Templates {

// less typing
public class GeneratedProjects : List<(string Name, string Path, bool XUnit, string ExtraArgs, string Failure, double TimeoutMultiplier)> {
}

// interface that represent a project that is created from a template.
// The interface should be able to generate a project that will later be
// used by the AppRunner to execute tests.
Expand All @@ -24,6 +29,6 @@ public interface ITemplatedProject {
/// has its own details.</param>
/// <param name="generatedDir">The dir where the projects will be saved.</param>
/// <returns></returns>
Task<List<BclTestProject>> GenerateTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects, Platform platform);
Task<GeneratedProjects> GenerateTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects, Platform platform);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,11 @@ string GenerateIncludeFilesNode (string projectName, (string FailureMessage, Lis
return contentFiles.ToString ();
}

public async Task<List<BclTestProject>> GenerateTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects, Platform platform)
public async Task<GeneratedProjects> GenerateTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects, Platform platform)
{
// generate the template c# code before we create the diff projects
await GenerateSource (Path.Combine (OutputDirectoryPath, "templates"));
var result = new List<BclTestProject> ();
var result = new GeneratedProjects ();
switch (platform) {
case Platform.WatchOS:
result = await GenerateWatchOSTestProjectsAsync (projects);
Expand Down Expand Up @@ -382,9 +382,9 @@ async Task<string> GenerateWatchExtensionAsync (string projectName, Stream templ
}

// internal implementations that generate each of the diff projects
async Task<List<BclTestProject>> GenerateWatchOSTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects)
async Task<GeneratedProjects> GenerateWatchOSTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects)
{
var projectPaths = new List<BclTestProject> ();
var projectPaths = new GeneratedProjects ();
foreach (var def in projects) {
// each watch os project requires 3 different ones:
// 1. The app
Expand Down Expand Up @@ -458,7 +458,7 @@ async Task<List<BclTestProject>> GenerateWatchOSTestProjectsAsync (IEnumerable<B
failure = e.Message;
}
// we have the 3 projects we depend on, we need the root one, the one that will be used by harness
projectPaths.Add (new BclTestProject { Name = projectDefinition.Name, Path = rootProjectPath, XUnit = projectDefinition.IsXUnit, ExtraArgs = projectDefinition.ExtraArgs, Failure = failure, TimeoutMultiplier = def.TimeoutMultiplier });
projectPaths.Add ((projectDefinition.Name, rootProjectPath, projectDefinition.IsXUnit, projectDefinition.ExtraArgs, failure, def.TimeoutMultiplier));
} // foreach project

return projectPaths;
Expand Down Expand Up @@ -507,13 +507,13 @@ async Task<string> GenerateAsync (string projectName, string registerPath, (stri
}
}

async Task<List<BclTestProject>> GenerateiOSTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects, Platform platform)
async Task<GeneratedProjects> GenerateiOSTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects, Platform platform)
{
if (platform == Platform.WatchOS)
throw new ArgumentException (nameof (platform));
if (!projects.Any ()) // return an empty list
return new List<BclTestProject> ();
var projectPaths = new List<BclTestProject> ();
return new GeneratedProjects ();
var projectPaths = new GeneratedProjects ();
foreach (var def in projects) {
if (def.assemblies.Length == 0)
continue;
Expand Down Expand Up @@ -557,7 +557,7 @@ async Task<List<BclTestProject>> GenerateiOSTestProjectsAsync (IEnumerable<BclTe
} catch (Exception e) {
failure = e.Message;
}
projectPaths.Add (new BclTestProject { Name = projectDefinition.Name, Path = projectPath, XUnit = projectDefinition.IsXUnit, ExtraArgs = projectDefinition.ExtraArgs, Failure = failure, TimeoutMultiplier = def.TimeoutMultiplier });
projectPaths.Add ((projectDefinition.Name, projectPath, projectDefinition.IsXUnit, projectDefinition.ExtraArgs, failure, def.TimeoutMultiplier));
} // foreach project

return projectPaths;
Expand Down Expand Up @@ -608,9 +608,9 @@ async Task<string> GenerateMacAsync (string projectName, string registerPath, (s
}
}

async Task<List<BclTestProject>> GenerateMacTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects, Platform platform)
async Task<GeneratedProjects> GenerateMacTestProjectsAsync (IEnumerable<BclTestProjectInfo> projects, Platform platform)
{
var projectPaths = new List<BclTestProject> ();
var projectPaths = new GeneratedProjects ();
foreach (var def in projects) {
if (!def.assemblies.Any ())
continue;
Expand Down Expand Up @@ -652,7 +652,7 @@ async Task<List<BclTestProject>> GenerateMacTestProjectsAsync (IEnumerable<BclTe
} catch (Exception e) {
failure = e.Message;
}
projectPaths.Add (new BclTestProject { Name = projectDefinition.Name, Path = projectPath, XUnit = projectDefinition.IsXUnit, ExtraArgs = projectDefinition.ExtraArgs, Failure = failure, TimeoutMultiplier = def.TimeoutMultiplier });
projectPaths.Add ((projectDefinition.Name, projectPath, projectDefinition.IsXUnit, projectDefinition.ExtraArgs, failure, def.TimeoutMultiplier));

}
return projectPaths;
Expand Down
14 changes: 0 additions & 14 deletions tests/xharness/BCLTestImporter/iOSBclTestProject.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,9 @@ public void MacMonoSDKPathSetterTest ()
[Test]
public async Task GenerateTestProjectsAsyncTest ()
{
var projects = new List<BclTestProject> () {
new BclTestProject {
Name = "First project",
XUnit = false,
},
new BclTestProject {
Name = "Second project",
XUnit = true,
},
var projects = new GeneratedProjects () {
( Name: "First project", Path: "", XUnit: false, ExtraArgs: "", Failure: "", TimeoutMultiplier: 1),
( Name: "Second project", Path: "", XUnit: true, ExtraArgs: "", Failure: "", TimeoutMultiplier: 1),
};
var infos = new List<BclTestProjectInfo> {
new BclTestProjectInfo {
Expand Down
2 changes: 0 additions & 2 deletions tests/xharness/xharness.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@
<Compile Include="BCLTestImporter\Templates\ITemplatedProject.cs" />
<Compile Include="BCLTestImporter\Templates\Managed\XamariniOSTemplate.cs" />
<Compile Include="BCLTestImporter\BclTestProjectInfo.cs" />
<Compile Include="BCLTestImporter\iOSBclTestProject.cs" />
<Compile Include="BCLTestImporter\IAssemblyLocator.cs" />
<Compile Include="BCLTestImporter\BclTestProject.cs" />
<Compile Include="BCLTestImporter\Templates\IProjectFilter.cs" />
<Compile Include="BCLTestImporter\Xamarin\AssemblyLocator.cs" />
<Compile Include="BCLTestImporter\Xamarin\ProjectFilter.cs" />
Expand Down

10 comments on commit a150c95

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Device tests passed on iOS on Azure DevOps(iOS): Html Report

🎉 All 150 tests passed 🎉

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Test run, Test run' 🔥

Build succeeded
✅ Packages:

API Diff (from stable)
API Diff (from PR only) (no change)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

5 tests failed, 180 tests passed.

Failed tests

  • xammac tests/Mac Modern/Debug: TimedOut (Execution timed out after 1200 seconds.)
  • xammac tests/Mac Modern/Debug: TimedOut (Execution timed out after 1200 seconds.)
  • xammac tests/Mac Modern/Release: TimedOut (Execution timed out after 1200 seconds.)
  • xammac tests/Mac Modern/Release: TimedOut (Execution timed out after 1200 seconds.)
  • mmptest/macOS/Debug: Failed (Execution failed with exit code 1)

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚧 Experimental DDFun pipeline

🔥 Device tests completed (Failed) on iOS-DDFun on Azure DevOps(iOS-DDFun) 🔥

Test results

1 tests failed, 149 tests passed.

Failed tests

  • [xUnit] Mono SystemCoreXunit Part 1/iOS Unified 64-bits - device/AssemblyBuildTarget: SDK framework (debug, profiling): TimedOut

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Device tests completed (Failed) on TvOS on Azure DevOps(TvOS): Html Report 🔥

Test results

16 tests failed, 134 tests passed.

Failed tests

  • dont link/tvOS - device/AssemblyBuildTarget: dylib (debug): Failed (Install failed, exit code: 137.)
  • dont link/tvOS - device/AssemblyBuildTarget: SDK framework (release): Failed (Install failed, exit code: 137.)
  • [NUnit] Mono BCL tests group 1/tvOS - device/Release: Failed (Install failed, exit code: 137.)
  • [NUnit] Mono BCL tests group 1/tvOS - device/AssemblyBuildTarget: SDK framework (release): Failed (Install failed, exit code: 137.)
  • [NUnit] Mono BCL tests group 2/tvOS - device/Release: Failed (Install failed, exit code: 137.)
  • [NUnit] Mono BCL tests group 2/tvOS - device/AssemblyBuildTarget: SDK framework (release): Failed (Install failed, exit code: 137.)
  • [xUnit] Mono BCL tests group 3/tvOS - device/Release: Failed (Install failed, exit code: 137.)
  • [xUnit] Mono BCL tests group 3/tvOS - device/AssemblyBuildTarget: SDK framework (release): Failed (Install failed, exit code: 137.)
  • [xUnit] Mono BCL tests group 4/tvOS - device/AssemblyBuildTarget: SDK framework (release): Failed (Install failed, exit code: 137.)
  • [xUnit] Mono BCL tests group 5/tvOS - device/AssemblyBuildTarget: SDK framework (release): Failed (Install failed, exit code: 137.)
  • mscorlib Part 1/tvOS - device/AssemblyBuildTarget: SDK framework (debug, profiling): Failed (Install failed, exit code: 137.)
  • mscorlib Part 1/tvOS - device/Release: Failed (Install failed, exit code: 137.)
  • mscorlib Part 1/tvOS - device/AssemblyBuildTarget: SDK framework (release): Failed (Install failed, exit code: 137.)
  • mscorlib Part 2/tvOS - device/Release: Failed (Install failed, exit code: 137.)
  • mscorlib Part 2/tvOS - device/AssemblyBuildTarget: SDK framework (release): Failed (Install failed, exit code: 137.)
  • [xUnit] Mono SystemCoreXunit Part 2/tvOS - device/AssemblyBuildTarget: SDK framework (release): Failed (Install failed, exit code: 137.)

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Device tests completed (Failed) on iOS32b on Azure DevOps(iOS32b): Html Report 🔥

Test results

20 tests failed, 141 tests passed.

Failed tests

  • [xUnit] Mono BCL tests group 4/iOS Unified 32-bits - device/Debug: Failed
  • mscorlib Part 2/iOS Unified 32-bits - device/Debug: Failed
  • [NUnit] Mono BCL tests group 2/iOS Unified 32-bits - device/Release: UseThumb: TimedOut
  • [xUnit] Mono BCL tests group 4/iOS Unified 32-bits - device/AssemblyBuildTarget: dylib (debug): Failed
  • [xUnit] Mono BCL tests group 4/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (debug): Failed
  • [xUnit] Mono BCL tests group 4/iOS Unified 32-bits - device/AssemblyBuildTarget: dylib (debug, profiling): Failed
  • [xUnit] Mono BCL tests group 4/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (debug, profiling): Failed
  • mscorlib Part 1/iOS Unified 32-bits - device/AssemblyBuildTarget: dylib (debug): TimedOut
  • mscorlib Part 1/iOS Unified 32-bits - device/Release: BuildFailure
  • mscorlib Part 1/iOS Unified 32-bits - device/Release: UseThumb: BuildFailure
  • mscorlib Part 1/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (release): BuildFailure
  • mscorlib Part 2/iOS Unified 32-bits - device/AssemblyBuildTarget: dylib (debug): Failed
  • mscorlib Part 2/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (debug): Failed
  • mscorlib Part 2/iOS Unified 32-bits - device/AssemblyBuildTarget: dylib (debug, profiling): Failed
  • mscorlib Part 2/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (debug, profiling): Failed
  • mscorlib Part 2/iOS Unified 32-bits - device/Release: Failed
  • mscorlib Part 2/iOS Unified 32-bits - device/Release: UseThumb: Failed
  • mscorlib Part 2/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (release): Failed
  • mscorlib Part 2/iOS Unified 32-bits - device/Debug: SGenConc: Failed
  • [xUnit] Mono SystemCoreXunit Part 2/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (release): TimedOut

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Device tests completed (Failed) on iOS on Azure DevOps(iOS): Html Report 🔥

Test results

150 tests' device not found, 0 tests passed.

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚧 Experimental DDFun pipeline

🔥 Device tests completed (Failed) on iOS-DDFun on Azure DevOps(iOS-DDFun) 🔥

Test results

150 tests' device not found, 0 tests passed.

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Device tests completed (Failed) on iOS32b on Azure DevOps(iOS32b): Html Report 🔥

Test results

161 tests' device not found, 0 tests passed.

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Test run, Test run' 🔥

Build succeeded
✅ Packages:

API Diff (from stable)
API Diff (from PR only) (no change)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

5 tests failed, 180 tests passed.

Failed tests

  • xammac tests/Mac Modern/Debug: TimedOut (Execution timed out after 1200 seconds.)
  • xammac tests/Mac Modern/Debug: TimedOut (Execution timed out after 1200 seconds.)
  • xammac tests/Mac Modern/Release: TimedOut (Execution timed out after 1200 seconds.)
  • xammac tests/Mac Modern/Release: TimedOut (Execution timed out after 1200 seconds.)
  • mmptest/macOS/Debug: Failed (Execution failed with exit code 1)

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Device tests completed (Failed) on TvOS on Azure DevOps(TvOS): Html Report 🔥

Test results

# Test run in progress: Building: 1, Running: 1, RunQueued: 123, Succeeded: 19, Ignored: 1113, TimedOut: 6

Failed tests

  • monotouch-test/tvOS - device/Debug: TimedOut
  • monotouch-test/tvOS - device/AssemblyBuildTarget: dylib (debug): TimedOut
  • monotouch-test/tvOS - device/AssemblyBuildTarget: SDK framework (debug): TimedOut
  • monotouch-test/tvOS - device/AssemblyBuildTarget: dylib (debug, profiling): TimedOut
  • monotouch-test/tvOS - device/AssemblyBuildTarget: SDK framework (debug, profiling): TimedOut
  • monotouch-test/tvOS - device/Release: TimedOut

Please sign in to comment.