Skip to content

Commit

Permalink
Add new setting RunnerExtraArguments to runsettings (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes authored Sep 20, 2024
1 parent 5b9d556 commit 619c107
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion poc/TestOfTestFramework/nano.runsettings
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
<IsRealHardware>False</IsRealHardware><!--Set to true to run tests on real hardware. -->
<CLRVersion></CLRVersion><!--Specify the nanoCLR version to use. If not specified, the latest available will be used. -->
<PathToLocalCLRInstance></PathToLocalCLRInstance><!--Specify the path to a local nanoCLR instance. If not specified, the default one installed with nanoclr CLR witll be used. -->
<RunnerExtraArguments></RunnerExtraArguments><!--Specify extra arguments to pass to the test runner. -->
</nanoFrameworkAdapter>
</RunSettings>
</RunSettings>
3 changes: 2 additions & 1 deletion poc/TestOfTestFrameworkByReference/nano.runsettings
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
<nanoFrameworkAdapter>
<Logging>None</Logging>
<IsRealHardware>False</IsRealHardware>
<RunnerExtraArguments></RunnerExtraArguments><!--Specify extra arguments to pass to the test runner. -->
</nanoFrameworkAdapter>
</RunSettings>
</RunSettings>
6 changes: 6 additions & 0 deletions source/TestAdapter/Executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,12 @@ private async Task<List<TestResult>> 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);
Expand Down
11 changes: 11 additions & 0 deletions source/TestAdapter/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public class Settings
/// </summary>
public LoggingLevel Logging { get; set; } = LoggingLevel.None;

/// <summary>
/// Extra arguments to pass to the test runner.
/// </summary>
public string RunnerExtraArguments { get; set; } = string.Empty;

/// <summary>
/// Get settings from an XML node
/// </summary>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 619c107

Please sign in to comment.