Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
30 changes: 29 additions & 1 deletion THIRD-PARTY-NOTICES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,32 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License notice for MTPSharding (YTest.MTP.PipeProtocol)
------------------------------------------------------
https://github.com/Youssef1313/MTPSharding

The MIT License (MIT)

Copyright (c) Youssef Victor Gerges Fahmy

All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,20 @@
namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.MTP;

/// <summary>
/// Constants for the Microsoft.Testing.Platform (MTP) server-mode JSON-RPC protocol.
/// See the MTP protocol docs in microsoft/testfx (ServerMode/JsonRpc).
/// Constants shared by the Microsoft.Testing.Platform (MTP) integration.
/// </summary>
internal static class MtpConstants
{
// Command line used to start an MTP application in JSON-RPC server mode. vstest opens a TCP
// listener and the application connects back to it (the application dials out to us).
public const string ServerArgument = "--server";
public const string ClientPortArgument = "--client-port";
public const string NoBannerArgument = "--no-banner";

// JSON-RPC method names.
public const string InitializeMethod = "initialize";
public const string DiscoverTestsMethod = "testing/discoverTests";
public const string RunTestsMethod = "testing/runTests";
public const string TestUpdatesTestsMethod = "testing/testUpdates/tests";
public const string TestUpdatesAttachmentsMethod = "testing/testUpdates/attachments";
public const string ClientLogMethod = "client/log";
public const string ExitMethod = "exit";

// Framing (LSP-like headers).
public const string ContentLengthHeader = "Content-Length:";
public const string ContentType = "application/testingplatform";

// Request/notification parameter keys.
public const string RunIdParameter = "runId";
public const string TestsParameter = "tests";
public const string ChangesProperty = "changes";
public const string NodeProperty = "node";
public const string AttachmentsProperty = "attachments";
public const string AttachmentUriProperty = "uri";
public const string AttachmentPathProperty = "path";

// TestNode wire property keys (pure MTP shape).
public const string Uid = "uid";
public const string DisplayName = "display-name";
public const string NodeType = "node-type";
public const string ExecutionState = "execution-state";
public const string TimeDurationMs = "time.duration-ms";
public const string ErrorMessage = "error.message";
public const string ErrorStackTrace = "error.stacktrace";
public const string StandardOutput = "standardOutput";
public const string StandardError = "standardError";
public const string LocationFile = "location.file";
public const string LocationLineStart = "location.line-start";
public const string Traits = "traits";

// Execution states.
public const string StateDiscovered = "discovered";
public const string StateInProgress = "in-progress";
public const string StatePassed = "passed";
public const string StateSkipped = "skipped";
public const string StateFailed = "failed";
public const string StateError = "error";
public const string StateTimedOut = "timed-out";
public const string StateCanceled = "canceled";

// Optional VSTest-provider properties (present only when the app still runs on the VSTestBridge).
// The converter treats these as best-effort enrichment and never requires them, so that a pure
// MTP app with no vstest dependency at all still converts correctly.
public const string VsTestFullyQualifiedName = "vstest.TestCase.FullyQualifiedName";
public const string VsTestId = "vstest.TestCase.Id";
public const string VsTestExecutorUri = "vstest.original-executor-uri";

// Synthetic executor URI used when the app does not expose the vstest provider properties.
/// <summary>
/// Synthetic executor URI reported for tests that run over the MTP protocol. MTP applications are
/// their own host and do not expose a vstest executor, so vstest attributes their results to this
/// well-known URI.
/// </summary>
public const string DefaultExecutorUri = "executor://MicrosoftTestingPlatform/v1";

// Property used to round-trip the MTP node uid on a vstest TestCase so we can request a
// filtered run by uid after discovery.
/// <summary>
/// Id of the <see cref="ObjectModel.TestProperty"/> used to round-trip the MTP test-node uid on a
/// vstest <see cref="ObjectModel.TestCase"/> so a discovered test can later be run by uid.
/// </summary>
public const string MtpUidPropertyId = "MTP.TestNode.Uid";
}
57 changes: 0 additions & 57 deletions src/Microsoft.TestPlatform.CrossPlatEngine/Client/MTP/MtpJson.cs

This file was deleted.

38 changes: 38 additions & 0 deletions src/Microsoft.TestPlatform.CrossPlatEngine/Client/MTP/MtpLaunch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.IO;

namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.MTP;

/// <summary>
/// Resolves how to launch a Microsoft.Testing.Platform (MTP) application from a test source path.
/// </summary>
internal static class MtpLaunch
{
/// <summary>
/// Determines the executable, base arguments and working directory used to start the MTP
/// application for the given source. A native <c>.exe</c> source is launched directly; a managed
/// <c>.dll</c> is launched through its sibling apphost <c>.exe</c> when present, otherwise via
/// <c>dotnet &lt;dll&gt;</c>. The MTP server-mode switches are appended later by
/// <see cref="PipeProtocol.TestApplication"/>.
/// </summary>
public static (string FileName, string Arguments, string WorkingDirectory) Resolve(string source)
{
string workingDirectory = Path.GetDirectoryName(source) ?? Directory.GetCurrentDirectory();
string extension = Path.GetExtension(source);

if (extension.Equals(".exe", StringComparison.OrdinalIgnoreCase))
{
return (source, string.Empty, workingDirectory);
}

// A .NET MTP app is typically shipped as a dll with a sibling apphost .exe. Prefer the apphost
// if present, otherwise fall back to `dotnet <dll>`.
string apphost = Path.ChangeExtension(source, ".exe");
return File.Exists(apphost)
? (apphost, string.Empty, workingDirectory)
: ("dotnet", $"\"{source}\"", workingDirectory);
}
}
Loading
Loading