From 619c107fc6f4325f0bc01e54c0fc2b3c450b4f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Fri, 20 Sep 2024 14:18:02 +0100 Subject: [PATCH] Add new setting RunnerExtraArguments to runsettings (#270) --- poc/TestOfTestFramework/nano.runsettings | 3 ++- poc/TestOfTestFrameworkByReference/nano.runsettings | 3 ++- source/TestAdapter/Executor.cs | 6 ++++++ source/TestAdapter/Settings.cs | 11 +++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/poc/TestOfTestFramework/nano.runsettings b/poc/TestOfTestFramework/nano.runsettings index cb44fca..50f06a7 100644 --- a/poc/TestOfTestFramework/nano.runsettings +++ b/poc/TestOfTestFramework/nano.runsettings @@ -12,5 +12,6 @@ False + - \ No newline at end of file + diff --git a/poc/TestOfTestFrameworkByReference/nano.runsettings b/poc/TestOfTestFrameworkByReference/nano.runsettings index 55f3a7b..ee2f395 100644 --- a/poc/TestOfTestFrameworkByReference/nano.runsettings +++ b/poc/TestOfTestFrameworkByReference/nano.runsettings @@ -13,5 +13,6 @@ None False + - \ No newline at end of file + diff --git a/source/TestAdapter/Executor.cs b/source/TestAdapter/Executor.cs index 2767e12..601d650 100644 --- a/source/TestAdapter/Executor.cs +++ b/source/TestAdapter/Executor.cs @@ -670,6 +670,12 @@ private async Task> RunTestOnEmulatorAsync( arguments.Append(" -v diag"); } + // add any extra arguments + if (!string.IsNullOrEmpty(_settings.RunnerExtraArguments)) + { + arguments.Append($" {_settings.RunnerExtraArguments} "); + } + _logger.LogMessage( $"Launching nanoCLR with these arguments: '{arguments}'", Settings.LoggingLevel.Verbose); diff --git a/source/TestAdapter/Settings.cs b/source/TestAdapter/Settings.cs index ec4f3a1..6cb3443 100644 --- a/source/TestAdapter/Settings.cs +++ b/source/TestAdapter/Settings.cs @@ -39,6 +39,11 @@ public class Settings /// public LoggingLevel Logging { get; set; } = LoggingLevel.None; + /// + /// Extra arguments to pass to the test runner. + /// + public string RunnerExtraArguments { get; set; } = string.Empty; + /// /// Get settings from an XML node /// @@ -82,6 +87,12 @@ public static Settings Extract(XmlNode node) { settings.PathToLocalCLRInstance = pathtolocalclrinstance.Value; } + + var runnerExtraArguments = node.SelectSingleNode(nameof(RunnerExtraArguments))?.FirstChild; + if (runnerExtraArguments != null && runnerExtraArguments.NodeType == XmlNodeType.Text) + { + settings.RunnerExtraArguments = runnerExtraArguments.Value; + } } return settings;