mirror of
https://github.com/Smaug123/unofficial-nunit-runner
synced 2025-10-07 10:18:38 +00:00
Compare commits
7 Commits
WoofWare.N
...
WoofWare.N
Author | SHA1 | Date | |
---|---|---|---|
|
eb4dfae8f4 | ||
|
78f51d127c | ||
|
3866823ccd | ||
|
b600fab887 | ||
|
8dc23d5b38 | ||
|
fb9c041959 | ||
|
4ab66204c4 |
1
.github/workflows/dotnet.yaml
vendored
1
.github/workflows/dotnet.yaml
vendored
@@ -74,6 +74,7 @@ jobs:
|
|||||||
run: 'nix develop --command dotnet exec ./TestRunner/bin/Release/net8.0/TestRunner.dll ./Consumer/bin/Release/net8.0/Consumer.dll --trx TrxOut/out.trx'
|
run: 'nix develop --command dotnet exec ./TestRunner/bin/Release/net8.0/TestRunner.dll ./Consumer/bin/Release/net8.0/Consumer.dll --trx TrxOut/out.trx'
|
||||||
- name: Parse Trx files
|
- name: Parse Trx files
|
||||||
uses: NasAmin/trx-parser@v0.6.0
|
uses: NasAmin/trx-parser@v0.6.0
|
||||||
|
if: always()
|
||||||
id: trx-parser
|
id: trx-parser
|
||||||
with:
|
with:
|
||||||
TRX_PATH: ${{ github.workspace }}/TrxOut
|
TRX_PATH: ${{ github.workspace }}/TrxOut
|
||||||
|
@@ -25,10 +25,15 @@ module TestCaseData =
|
|||||||
let ``Consume test data from multiple sources`` (i : int, s : string, arr : float[]) =
|
let ``Consume test data from multiple sources`` (i : int, s : string, arr : float[]) =
|
||||||
lock multipleSources (fun () -> multipleSources.Add (i, s, arr))
|
lock multipleSources (fun () -> multipleSources.Add (i, s, arr))
|
||||||
|
|
||||||
let optional = [ Some "hi" ; None ] |> List.map TestCaseData
|
let optionalData = [ Some "hi" ; None ] |> List.map TestCaseData
|
||||||
|
|
||||||
[<TestCaseSource(nameof optional)>]
|
[<TestCaseSource(nameof optionalData)>]
|
||||||
let ``Consume options`` (s : string option) : unit = s |> shouldEqual s
|
let ``Consume options, TestCaseData`` (s : string option) : unit = s |> shouldEqual s
|
||||||
|
|
||||||
|
let optionalRaw = [ Some "hi" ; None ]
|
||||||
|
|
||||||
|
[<TestCaseSource(nameof optionalRaw)>]
|
||||||
|
let ``Consume options, raw`` (s : string option) : unit = s |> shouldEqual s
|
||||||
|
|
||||||
[<OneTimeTearDown>]
|
[<OneTimeTearDown>]
|
||||||
let tearDown () =
|
let tearDown () =
|
||||||
|
@@ -12,4 +12,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.139" PrivateAssets="all"/>
|
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.139" PrivateAssets="all"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<PropertyGroup Condition="'$(GITHUB_ACTION)' != ''">
|
||||||
|
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@@ -291,9 +291,10 @@ module Filter =
|
|||||||
fun a b -> inner1 a b || inner2 a b
|
fun a b -> inner1 a b || inner2 a b
|
||||||
| Filter.Name (Match.Exact m) -> fun _fixture method -> method.Method.Name = m
|
| Filter.Name (Match.Exact m) -> fun _fixture method -> method.Method.Name = m
|
||||||
| Filter.Name (Match.Contains m) -> fun _fixture method -> method.Method.Name.Contains m
|
| Filter.Name (Match.Contains m) -> fun _fixture method -> method.Method.Name.Contains m
|
||||||
| Filter.FullyQualifiedName (Match.Exact m) -> fun fixture method -> (fixture.Name + method.Method.Name) = m
|
| Filter.FullyQualifiedName (Match.Exact m) ->
|
||||||
|
fun _fixture method -> (method.Method.DeclaringType.FullName + "." + method.Method.Name) = m
|
||||||
| Filter.FullyQualifiedName (Match.Contains m) ->
|
| Filter.FullyQualifiedName (Match.Contains m) ->
|
||||||
fun fixture method -> (fixture.Name + method.Method.Name).Contains m
|
fun _fixture method -> (method.Method.DeclaringType.FullName + "." + method.Method.Name).Contains m
|
||||||
| Filter.TestCategory (Match.Contains m) ->
|
| Filter.TestCategory (Match.Contains m) ->
|
||||||
fun _fixture method -> method.Categories |> List.exists (fun cat -> cat.Contains m)
|
fun _fixture method -> method.Categories |> List.exists (fun cat -> cat.Contains m)
|
||||||
| Filter.TestCategory (Match.Exact m) -> fun _fixture method -> method.Categories |> List.contains m
|
| Filter.TestCategory (Match.Exact m) -> fun _fixture method -> method.Categories |> List.contains m
|
||||||
|
@@ -230,6 +230,27 @@ module TestFixture =
|
|||||||
(test : SingleTestMethod)
|
(test : SingleTestMethod)
|
||||||
: (Result<TestMemberSuccess, TestMemberFailure> * IndividualTestRunMetadata) list
|
: (Result<TestMemberSuccess, TestMemberFailure> * IndividualTestRunMetadata) list
|
||||||
=
|
=
|
||||||
|
if test.Method.ContainsGenericParameters then
|
||||||
|
let failureMetadata =
|
||||||
|
{
|
||||||
|
Total = TimeSpan.Zero
|
||||||
|
Start = DateTimeOffset.Now
|
||||||
|
End = DateTimeOffset.Now
|
||||||
|
ComputerName = Environment.MachineName
|
||||||
|
ExecutionId = Guid.NewGuid ()
|
||||||
|
TestId = Guid.NewGuid ()
|
||||||
|
TestName = test.Name
|
||||||
|
ClassName = test.Method.DeclaringType.FullName
|
||||||
|
StdErr = None
|
||||||
|
StdOut = None
|
||||||
|
}
|
||||||
|
|
||||||
|
let error =
|
||||||
|
TestMemberFailure.Malformed [ "Test contained generic parameters; generics are not supported." ]
|
||||||
|
|
||||||
|
(Error error, failureMetadata) |> List.singleton
|
||||||
|
else
|
||||||
|
|
||||||
let resultPreRun =
|
let resultPreRun =
|
||||||
(None, test.Modifiers)
|
(None, test.Modifiers)
|
||||||
||> List.fold (fun _result modifier ->
|
||> List.fold (fun _result modifier ->
|
||||||
@@ -332,6 +353,7 @@ module TestFixture =
|
|||||||
yield
|
yield
|
||||||
Guid.NewGuid (),
|
Guid.NewGuid (),
|
||||||
match arg with
|
match arg with
|
||||||
|
| null -> [| (null : obj) |]
|
||||||
| :? Tuple<obj, obj> as (a, b) -> [| a ; b |]
|
| :? Tuple<obj, obj> as (a, b) -> [| a ; b |]
|
||||||
| :? Tuple<obj, obj, obj> as (a, b, c) -> [| a ; b ; c |]
|
| :? Tuple<obj, obj, obj> as (a, b, c) -> [| a ; b ; c |]
|
||||||
| :? Tuple<obj, obj, obj, obj> as (a, b, c, d) -> [| a ; b ; c ; d |]
|
| :? Tuple<obj, obj, obj, obj> as (a, b, c, d) -> [| a ; b ; c ; d |]
|
||||||
|
@@ -54,23 +54,57 @@ module Program =
|
|||||||
|> Option.defaultValue RollForward.Minor
|
|> Option.defaultValue RollForward.Minor
|
||||||
| s -> RollForward.Parse s
|
| s -> RollForward.Parse s
|
||||||
|
|
||||||
let desired = Version config.Framework.Version
|
let desiredVersions =
|
||||||
|
match config.Framework with
|
||||||
|
| Some f -> [ Version f.Version, f.Name ]
|
||||||
|
| None ->
|
||||||
|
|
||||||
|
match config.Frameworks with
|
||||||
|
| Some f -> f |> List.map (fun f -> Version f.Version, f.Name)
|
||||||
|
| None ->
|
||||||
|
failwith
|
||||||
|
"Could not deduce a framework version due to lack of either Framework or Frameworks in runtimeconfig"
|
||||||
|
|
||||||
|
let compatiblyNamedRuntimes =
|
||||||
|
f.Frameworks
|
||||||
|
|> Seq.collect (fun availableFramework ->
|
||||||
|
desiredVersions
|
||||||
|
|> List.choose (fun (desiredVersion, desiredName) ->
|
||||||
|
if desiredName = availableFramework.Name then
|
||||||
|
Some
|
||||||
|
{|
|
||||||
|
Desired = desiredVersion
|
||||||
|
Name = desiredName
|
||||||
|
Installed = availableFramework
|
||||||
|
InstalledVersion = Version availableFramework.Version
|
||||||
|
|}
|
||||||
|
else
|
||||||
|
None
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|> Seq.toList
|
||||||
|
|
||||||
match rollForward with
|
match rollForward with
|
||||||
| RollForward.Minor ->
|
| RollForward.Minor ->
|
||||||
let available =
|
let available =
|
||||||
f.Frameworks
|
compatiblyNamedRuntimes
|
||||||
|> Seq.choose (fun fi ->
|
|> Seq.filter (fun data ->
|
||||||
if fi.Name = config.Framework.Name then
|
data.InstalledVersion.Major = data.Desired.Major
|
||||||
Some (fi, Version fi.Version)
|
&& data.InstalledVersion.Minor >= data.Desired.Minor
|
||||||
else
|
|
||||||
None
|
|
||||||
)
|
)
|
||||||
|> Seq.filter (fun (_, version) -> version.Major = desired.Major && version.Minor >= desired.Minor)
|
|> Seq.groupBy (fun data -> data.Name)
|
||||||
|> Seq.tryMinBy (fun (_, version) -> version.Minor, version.Build)
|
|> Seq.map (fun (name, data) ->
|
||||||
|
let data =
|
||||||
|
data
|
||||||
|
|> Seq.minBy (fun data -> data.InstalledVersion.Minor, data.InstalledVersion.Build)
|
||||||
|
|
||||||
|
name, data.Installed
|
||||||
|
)
|
||||||
|
// TODO: how do we select between many available frameworks?
|
||||||
|
|> Seq.tryHead
|
||||||
|
|
||||||
match available with
|
match available with
|
||||||
| Some (f, _) -> Some (Choice1Of2 f)
|
| Some (_, f) -> Some (Choice1Of2 f)
|
||||||
| None ->
|
| None ->
|
||||||
// TODO: maybe we can ask the SDK. But we keep on trucking: maybe we're self-contained,
|
// TODO: maybe we can ask the SDK. But we keep on trucking: maybe we're self-contained,
|
||||||
// and we'll actually find all the runtime next to the DLL.
|
// and we'll actually find all the runtime next to the DLL.
|
||||||
@@ -99,7 +133,7 @@ module Program =
|
|||||||
| None ->
|
| None ->
|
||||||
// Keep on trucking: let's be optimistic and hope that we're self-contained.
|
// Keep on trucking: let's be optimistic and hope that we're self-contained.
|
||||||
[ dll.Directory ]
|
[ dll.Directory ]
|
||||||
| Some (Choice1Of2 runtime) -> [ dll.Directory ; DirectoryInfo runtime.Path ]
|
| Some (Choice1Of2 runtime) -> [ dll.Directory ; DirectoryInfo $"%s{runtime.Path}/%s{runtime.Version}" ]
|
||||||
| Some (Choice2Of2 sdk) -> [ dll.Directory ; DirectoryInfo sdk.Path ]
|
| Some (Choice2Of2 sdk) -> [ dll.Directory ; DirectoryInfo sdk.Path ]
|
||||||
|
|
||||||
let main argv =
|
let main argv =
|
||||||
@@ -367,6 +401,7 @@ module Program =
|
|||||||
let contents = TrxReport.toXml report |> fun d -> d.OuterXml
|
let contents = TrxReport.toXml report |> fun d -> d.OuterXml
|
||||||
trxPath.Directory.Create ()
|
trxPath.Directory.Create ()
|
||||||
File.WriteAllText (trxPath.FullName, contents)
|
File.WriteAllText (trxPath.FullName, contents)
|
||||||
|
Console.Error.WriteLine $"Written TRX file: %s{trxPath.FullName}"
|
||||||
| None -> ()
|
| None -> ()
|
||||||
|
|
||||||
match outcome with
|
match outcome with
|
||||||
|
@@ -14,7 +14,8 @@ type FrameworkDescription =
|
|||||||
type RuntimeOptions =
|
type RuntimeOptions =
|
||||||
{
|
{
|
||||||
Tfm : string
|
Tfm : string
|
||||||
Framework : FrameworkDescription
|
Framework : FrameworkDescription option
|
||||||
|
Frameworks : FrameworkDescription list option
|
||||||
RollForward : string option
|
RollForward : string option
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Spectre.Console" Version="0.49.1" />
|
<PackageReference Include="Spectre.Console" Version="0.49.1" />
|
||||||
<PackageReference Include="WoofWare.DotnetRuntimeLocator" Version="0.1.2" />
|
<PackageReference Include="WoofWare.DotnetRuntimeLocator" Version="0.1.3" />
|
||||||
<PackageReference Include="WoofWare.Myriad.Plugins.Attributes" Version="3.1.4" />
|
<PackageReference Include="WoofWare.Myriad.Plugins.Attributes" Version="3.1.4" />
|
||||||
<PackageReference Include="Myriad.SDK" Version="0.8.3" />
|
<PackageReference Include="Myriad.SDK" Version="0.8.3" />
|
||||||
<PackageReference Include="WoofWare.Myriad.Plugins" Version="$(WoofWareMyriadPluginVersion)" PrivateAssets="all" />
|
<PackageReference Include="WoofWare.Myriad.Plugins" Version="$(WoofWareMyriadPluginVersion)" PrivateAssets="all" />
|
||||||
|
@@ -183,8 +183,8 @@
|
|||||||
})
|
})
|
||||||
(fetchNuGet {
|
(fetchNuGet {
|
||||||
pname = "WoofWare.DotnetRuntimeLocator";
|
pname = "WoofWare.DotnetRuntimeLocator";
|
||||||
version = "0.1.2";
|
version = "0.1.3";
|
||||||
sha256 = "0kwkq28ddzc0bpr22jmgcl8dhnhg776gf6l054rsxw8lrvpwhmv9";
|
sha256 = "0qw41mcvx4qy012pj1dlpdfwsz036qrx7xnzsirk5fz715f1a45m";
|
||||||
})
|
})
|
||||||
(fetchNuGet {
|
(fetchNuGet {
|
||||||
pname = "WoofWare.Myriad.Plugins";
|
pname = "WoofWare.Myriad.Plugins";
|
||||||
|
Reference in New Issue
Block a user