Skip to content

Commit

Permalink
Merge branch 'master' into release/Fukurou
Browse files Browse the repository at this point in the history
# Conflicts:
#	appveyor.yml
  • Loading branch information
SteveGilham committed Sep 18, 2019
2 parents 4f4891a + ca6cac5 commit b3a6215
Show file tree
Hide file tree
Showing 106 changed files with 2,786 additions and 648 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: csharp
mono: latest
dist: xenial
dotnet: 2.1.701
dotnet: 2.1.801
addons:
apt:
sources:
Expand Down
5 changes: 4 additions & 1 deletion AltCover.CSApi/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public interface IPrepareArgs
bool SourceLink { get; }
bool Defer { get; }
bool LocalSource { get; }
bool VisibleBranches { get; }

string[] CommandLine { get; }

Expand Down Expand Up @@ -166,6 +167,7 @@ public class PrepareArgs : IPrepareArgs
public bool SourceLink { get; set; }
public bool Defer { get; set; }
public bool LocalSource { get; set; }
public bool VisibleBranches { get; set; }

public string[] CommandLine { get; set; }

Expand Down Expand Up @@ -198,7 +200,8 @@ public FSApi.PrepareParams ToParameters()
ExposeReturnCode,
SourceLink,
Defer,
LocalSource
LocalSource,
VisibleBranches
);
return FSApi.PrepareParams.NewPrimitive(primitive);
}
Expand Down
1 change: 1 addition & 0 deletions AltCover.FSApi/Definitions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module internal Internals =
FromList "MethodFilter" prepare.MethodFilter
FromList "AttributeFilter" prepare.AttributeFilter
(Arg "LocalSource" "true", prepare.LocalSource)
(Arg "VisibleBranches" "true", prepare.VisibleBranches)
FromList "CallContext" prepare.CallContext
FromList "DependencyList" prepare.Dependencies
FromArg "LcovReport" collect.LcovReport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
<RootNamespace>AltCover.Fake.DotNet.Testing.AltCover</RootNamespace>
<AssemblyName>AltCover.Fake.DotNet.Testing.AltCover</AssemblyName>
<UseStandardResourceNames>true</UseStandardResourceNames>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Name>AltCover.Fake.DotNet.Testing.AltCover</Name>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<ResolveNuGetPackages>false</ResolveNuGetPackages>
<GlobalDefineConstants>
</GlobalDefineConstants>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
7 changes: 6 additions & 1 deletion AltCover.PowerShell/Command.fs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ type InvokeAltCoverCommand(runner : bool) =
ValueFromPipeline = false, ValueFromPipelineByPropertyName = false)>]
member val LocalSource : SwitchParameter = SwitchParameter(false) with get, set

[<Parameter(ParameterSetName = "Instrument", Mandatory = false,
ValueFromPipeline = false, ValueFromPipelineByPropertyName = false)>]
member val VisibleBranches : SwitchParameter = SwitchParameter(false) with get, set

[<Parameter(ParameterSetName = "Runner", Mandatory = false, ValueFromPipeline = false,
ValueFromPipelineByPropertyName = false)>]
member val SummaryFormat : Summary = Summary.Default with get, set
Expand Down Expand Up @@ -214,7 +218,8 @@ type InvokeAltCoverCommand(runner : bool) =
ExposeReturnCode = not self.DropReturnCode.IsPresent
SourceLink = self.SourceLink.IsPresent
Defer = self.Defer.IsPresent
LocalSource = self.LocalSource.IsPresent}
LocalSource = self.LocalSource.IsPresent
VisibleBranches = self.VisibleBranches.IsPresent}

member private self.Log() =
FSApi.Logging.Primitive { Primitive.Logging.Create() with Error = (fun s -> self.Fail <- s :: self.Fail)
Expand Down
99 changes: 99 additions & 0 deletions AltCover.Recorder/Adapter.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
namespace AltCover.Recorder

open System.Collections.Generic

#if DEBUG
module Adapter =
let DoPause() = Instance.DoPause null
let DoResume() = Instance.DoResume null
let VisitsClear() = Instance.Visits.Clear()
let SamplesClear() = Instance.Samples.Clear()
let FlushAll() = Instance.FlushFinish ()
let Reset () =
Instance.IsRunner <- false
Instance.Visits.Clear()
Instance.Samples.Clear()

let internal prepareName name =
if name
|> Instance.Visits.ContainsKey
|> not
then
let entry = Dictionary<int, PointVisit>()
Instance.Visits.Add(name, entry)

let VisitsAdd name line number =
prepareName name
let v = PointVisit.Init number []
Instance.Visits.[name].Add(line, v)

let VisitsAddTrack name line number =
prepareName name
let v1 = PointVisit.Init number [ Call 17
Call 42 ]
Instance.Visits.[name].Add(line, v1)

let v2 = PointVisit.Init (number + 1L) [ Time 17L
Both(42L, 23) ]
Instance.Visits.[name].Add(line + 1, v2)

let VisitsSeq() = Instance.Visits |> Seq.cast<obj>
let VisitsEntrySeq key = Instance.Visits.[key] |> Seq.cast<obj>
let VisitCount key key2 = (Instance.Visits.[key].[key2]).Count
let Lock = Instance.Visits :> obj

let VisitImplNone moduleId hitPointId =
Instance.VisitImpl moduleId hitPointId Track.Null
let VisitImplMethod moduleId hitPointId mId =
Instance.VisitImpl moduleId hitPointId (Call mId)

let AddSample moduleId hitPointId =
Instance.TakeSample Sampling.Single moduleId hitPointId
let AddSampleUnconditional moduleId hitPointId =
Instance.TakeSample Sampling.All moduleId hitPointId
let internal NewBoth time track = Both(time, track)
let internal Call track = Call track
let internal Time at = Time at
let internal untime at =
let r = List<System.Int64>()
match at with
| Time t ->r.Add(t)
| _ -> ()
r
let internal Null () = Null
let internal Table t = Table t
let internal untable t =
let r = List<System.Object>()
match t with
| (n, p, Table d) -> r.Add(n)
r.Add(p)
r.Add(d)
| _ -> ()
r

let internal DoFlush visits format report output =
let output' = //if System.String.IsNullOrEmpty output
//then None // this case gets tested elsewhere
(*else*) Some output
Counter.DoFlush ignore (fun _ _ -> ()) true visits format report output'
let internal UpdateReport counts format coverageFile outputFile =
Counter.UpdateReport ignore (fun _ _ -> ()) true counts format coverageFile outputFile
let internal PayloadSelector x = Instance.PayloadSelector (fun _ -> x)
let internal PayloadControl x y = Instance.PayloadControl (fun _ -> x) (fun _ -> y)
let internal PayloadSelection x y z = Instance.PayloadSelection (fun _ -> x) (fun _ -> y) (fun _ -> z)

let internal ProcessExit() = ProcessExit

#if MONO
let internal MakeNullTrace name = { Tracer = name
Stream = null
Formatter = null
Runner = false
Definitive = false }
let internal MakeStreamTrace s1 = { Tracer = null
Stream = new System.IO.MemoryStream()
Formatter = new System.IO.BinaryWriter(s1)
Runner = true
Definitive = false }
#endif
#endif
26 changes: 12 additions & 14 deletions AltCover.Recorder/AltCover.Recorder.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@
<Compile Include="Recorder.fs" />
<EmbeddedResource Include="Strings.resx" />
<Content Include="packages.config" />
<Compile Include="Adapter.fs" />
</ItemGroup>
<ItemGroup>
<Reference Condition="'$(OS)' == 'Windows_NT'" Include="FSharp.Core, Version=2.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>True</Private>
<HintPath>..\packages\FSharp.Core.3.0.2\lib\net35\FSharp.Core.dll</HintPath>
</Reference>
<Reference Condition="'$(OS)' != 'Windows_NT'" Include="FSharp.Core">
<HintPath>..\packages\FSharp.Core.4.5.2\lib\net45\FSharp.Core.dll</HintPath>
Expand All @@ -108,18 +109,15 @@
<Target Name="AfterBuild">
</Target>
-->
<Target Name="StaticLink" BeforeTargets="AfterBuild" Condition="'$(OS)' == 'Windows_NT'" >
<PropertyGroup>
<WorkDirectory>$(OutDir)Raw</WorkDirectory>
<Target Name="StaticLink" BeforeTargets="AfterBuild" Condition="'$(OS)' == 'Windows_NT'">
<PropertyGroup>
<WorkDirectory>$(OutDir)Raw</WorkDirectory>
</PropertyGroup>
<ItemGroup>
<BuiltFiles Include="$(OutDir)*.*"/>
</ItemGroup>

<MakeDir Directories="$(WorkDirectory)"/>
<Move SourceFiles="@(BuiltFiles)"
DestinationFolder="$(WorkDirectory)" />
<Exec WorkingDirectory="$(WorkDirectory)"
Command="$(ILMergeConsolePath) /out:$(TargetPath) /v2 /attr=$(TargetFileName) /keyfile=$(SolutionDir)\Build\Infrastructure.snk /target:library /internalize $(TargetFileName) FSharp.Core.dll" />
</Target>
<ItemGroup>
<BuiltFiles Include="$(OutDir)*.*" />
</ItemGroup>
<MakeDir Directories="$(WorkDirectory)" />
<Move SourceFiles="@(BuiltFiles)" DestinationFolder="$(WorkDirectory)" />
<Exec WorkingDirectory="$(WorkDirectory)" Command="$(ILMergeConsolePath) /out:$(TargetPath) /v2 /attr=$(TargetFileName) /keyfile=$(SolutionDir)\Build\Infrastructure.snk /target:library /internalize $(TargetFileName) FSharp.Core.dll" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion AltCover.Recorder/AltCover.Shadow.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Condition="'$(OS)' == 'Windows_NT'" Include="FSharp.Core, Version=2.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>True</Private>
<HintPath>..\packages\FSharp.Core.3.0.2\lib\net35\FSharp.Core.dll</HintPath>
</Reference>
<Reference Condition="'$(OS)' != 'Windows_NT'" Include="FSharp.Core">
<HintPath>..\packages\FSharp.Core.4.5.2\lib\net45\FSharp.Core.dll</HintPath>
Expand Down
27 changes: 19 additions & 8 deletions AltCover.Recorder/Base.fs
Original file line number Diff line number Diff line change
Expand Up @@ -290,20 +290,31 @@ module internal Counter =

let internal AddSingleVisit (counts : Dictionary<string, Dictionary<int, PointVisit>>)
moduleId hitPointId context =
EnsureModule counts moduleId
let next = counts.[moduleId]
EnsurePoint next hitPointId
try
EnsureModule counts moduleId
let next = counts.[moduleId]
EnsurePoint next hitPointId

let v = next.[hitPointId]
match context with
| Null -> v.Step()
| something -> v.Track something
let v = next.[hitPointId]
match context with
| Null -> v.Step()
| something -> v.Track something
#if RUNNER
1L
#endif
with
| :? NullReferenceException
| :? ArgumentNullException ->
#if RUNNER
0L
#else
()
#endif

#if RUNNER
let internal AddVisit (counts : Dictionary<string, Dictionary<int, PointVisit>>)
moduleId hitPointId context =
match context with
| Table t -> AddTable counts t
| _ -> AddSingleVisit counts moduleId hitPointId context
1L
#endif
20 changes: 20 additions & 0 deletions AltCover.Recorder/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -119,62 +119,82 @@
</resheader>
<data name="Coverage statistics flushing took {0:N} seconds.en" xml:space="preserve">
<value>Coverage statistics flushing took {0:N} seconds</value>
<comment>@Invariant</comment>
</data>
<data name="Coverage statistics flushing took {0:N} seconds.eo" xml:space="preserve">
<value>Kovraj statistika skribado prenis {0:N} sekundojn</value>
<comment>@Invariant</comment>
</data>
<data name="DomainUnload.en" xml:space="preserve">
<value>AppDomain shutdown started</value>
<comment>@Invariant</comment>
</data>
<data name="DomainUnload.eo" xml:space="preserve">
<value>AppDomain sistemfermo komenciĝis</value>
<comment>@Invariant</comment>
</data>
<data name="DomainUnloadHandler.en" xml:space="preserve">
<value>Finalizing AppDomain coverage report</value>
<comment>@Invariant</comment>
</data>
<data name="DomainUnloadHandler.eo" xml:space="preserve">
<value>Finante AppDomain kovraj raporto</value>
<comment>@Invariant</comment>
</data>
<data name="Pause.en" xml:space="preserve">
<value>Pause command received</value>
<comment>@Invariant</comment>
</data>
<data name="Pause.eo" xml:space="preserve">
<value>Paŭzo komandon ricevita</value>
<comment>@Invariant</comment>
</data>
<data name="PauseHandler.en" xml:space="preserve">
<value>Pausing...</value>
<comment>@Invariant</comment>
</data>
<data name="PauseHandler.eo" xml:space="preserve">
<value>Paŭzante ...</value>
<comment>@Invariant</comment>
</data>
<data name="ProcessExit.en" xml:space="preserve">
<value>Shutdown started</value>
<comment>@Invariant</comment>
</data>
<data name="ProcessExit.eo" xml:space="preserve">
<value>Sistemfermo komenciĝis</value>
<comment>@Invariant</comment>
</data>
<data name="ProcessExitHandler.en" xml:space="preserve">
<value>Finalizing overall coverage report</value>
<comment>@Invariant</comment>
</data>
<data name="ProcessExitHandler.eo" xml:space="preserve">
<value>Finante totala kovraj raporto</value>
<comment>@Invariant</comment>
</data>
<data name="Resume.en" xml:space="preserve">
<value>Resume command received</value>
<comment>@Invariant</comment>
</data>
<data name="Resume.eo" xml:space="preserve">
<value>Rekomenci komandon ricevita</value>
<comment>@Invariant</comment>
</data>
<data name="ResumeHandler.en" xml:space="preserve">
<value>Resuming...</value>
<comment>@Invariant</comment>
</data>
<data name="ResumeHandler.eo" xml:space="preserve">
<value>Resumante...</value>
<comment>@Invariant</comment>
</data>
<data name="Recorder error.en" xml:space="preserve">
<value>Recorder error</value>
<comment>@Invariant</comment>
</data>
<data name="Recorder error.eo" xml:space="preserve">
<value>Registra eraro</value>
<comment>@Invariant</comment>
</data>
</root>
1 change: 1 addition & 0 deletions AltCover.Recorder/altcover.recorder.core.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<Compile Include="Base.fs" />
<Compile Include="Tracer.fs" />
<Compile Include="Recorder.fs" />
<Compile Include="Adapter.fs" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions AltCover.Recorder/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ILMerge" version="3.0.29" targetFramework="net452" />
<package id="FSharp.Core" version="3.0.2" targetFramework="net35" />
</packages>
2 changes: 1 addition & 1 deletion AltCover.Visualizer/AltCover.Visualizer.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<Private>False</Private>
</Reference>
<Reference Include="FSharp.Core">
<HintPath>..\packages\FSharp.Core.4.7.0\lib\net45\FSharp.Core.dll</HintPath>
<HintPath>..\packages\FSharp.Core.4.5.2\lib\net45\FSharp.Core.dll</HintPath>
</Reference>
<Reference Include="gdk-sharp">
<Private>False</Private>
Expand Down
Loading

0 comments on commit b3a6215

Please sign in to comment.