Browse Source

cleanup ProfilingSandbox

af/octree-no-pixelmap
Anton Firszov 6 years ago
parent
commit
aa576e8532
  1. 6
      tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj
  2. 14
      tests/ImageSharp.Tests.ProfilingSandbox/Program.cs
  3. 26
      tests/ImageSharp.Tests.ProfilingSandbox/README.md
  4. 3
      tests/ImageSharp.Tests/AssemblyInfo.cs
  5. 3
      tests/ImageSharp.Tests/TestUtilities/BasicSerializer.cs

6
tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj

@ -2,14 +2,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<AssemblyName>SixLabors.ImageSharp.Sandbox46</AssemblyName> <AssemblyName>ImageSharp.Tests.ProfilingSandbox</AssemblyName>
<Description>A cross-platform library for processing of image files written in C#</Description> <Description>A cross-platform library for processing of image files written in C#</Description>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<RootNamespace>SixLabors.ImageSharp.Sandbox46</RootNamespace> <RootNamespace>SixLabors.ImageSharp.Tests.ProfilingSandbox</RootNamespace>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier> <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net472</TargetFrameworks> <TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net472</TargetFrameworks>
<StartupObject>SixLabors.ImageSharp.Sandbox46.Program</StartupObject> <StartupObject>SixLabors.ImageSharp.Tests.ProfilingSandbox.Program</StartupObject>
<!--Used to hide test project from dotnet test--> <!--Used to hide test project from dotnet test-->
<IsTestProject>false</IsTestProject> <IsTestProject>false</IsTestProject>
</PropertyGroup> </PropertyGroup>

14
tests/ImageSharp.Tests.ProfilingSandbox/Program.cs

@ -1,18 +1,14 @@
// <copyright file="Program.cs" company="James Jackson-South"> // Copyright (c) Six Labors and contributors.
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
// </copyright>
using System;
using SixLabors.ImageSharp.Tests.Formats.Jpg;
using SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations; using SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations;
using SixLabors.ImageSharp.Tests.ProfilingBenchmarks; using SixLabors.ImageSharp.Tests.ProfilingBenchmarks;
using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Sandbox46 namespace SixLabors.ImageSharp.Tests.ProfilingSandbox
{ {
using System;
using SixLabors.ImageSharp.Tests.Formats.Jpg;
using Xunit.Abstractions;
public class Program public class Program
{ {
private class ConsoleOutput : ITestOutputHelper private class ConsoleOutput : ITestOutputHelper

26
tests/ImageSharp.Tests.ProfilingSandbox/README.md

@ -1,24 +1,2 @@
## Purpose ## ImageSharp.Tests.ProfilingSandbox
This project aims to workaround certain .NET Core tooling issues in Visual Studio based developer workflow at the time of it's creation (January 2017): Helper project to run and profile unit tests or other "sandbox" code from a single .exe entry point.
- .NET Core Performance profiling is not possible neither with Visual Studio nor with JetBrains profilers
- ~~JetBrains Unit Test explorer does not work with .NET Core projects~~
## How does it work?
- By referencing .NET 4.5 dll-s created by net45 target's of ImageSharp projects. NOTE: These are not project references!
- By including test classes (and utility classes) of the `ImageSharp.Tests` project using MSBUILD `<Link>`
- Compiling `ImageSharp.Sandbox46` should trigger the compilation of ImageSharp subprojects using a manually defined solution dependencies
## How to profile unit tests
#### 1. With Visual Studio 2015 Test Runner
- **Do not** build `ImageSharp.Tests`
- Build `ImageSharp.Sandbox46`
- Use the [context menu in Test Explorer](https://adamprescott.net/2012/12/12/performance-profiling-for-unit-tests/)
NOTE:
There was no *Profile test* option in my VS Professional. Maybe things were messed by VS2017 RC installation. [This post suggests](http://stackoverflow.com/questions/32034375/profiling-tests-in-visual-studio-community-2015) it's necessary to own Premium or Ultimate edition of Visual Studio to profile tests.
#### 2. With JetBrains ReSharper Ultimate
- The `Sandbox46` project is no longer needed here. The classic `ImageSharp.Tests` project can be discovered by Unit Test Explorer.
- You can use [context menus](https://www.jetbrains.com/resharper/features/unit_testing.html) from your test class, or from unit Test Exporer/Unit Test Sessions windows.
![Context Menu](https://www.jetbrains.com/resharper/features/screenshots/100/unit_testing_profiling.png)

3
tests/ImageSharp.Tests/AssemblyInfo.cs

@ -1,3 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
[assembly:InternalsVisibleTo("SixLabors.ImageSharp.Sandbox46")] [assembly:InternalsVisibleTo("SixLabors.ImageSharp.Sandbox46")]

3
tests/ImageSharp.Tests/TestUtilities/BasicSerializer.cs

@ -1,3 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;

Loading…
Cancel
Save