Skip to content

Commit 494582b

Browse files
committed
Get benchmarking and profiling working again
Broken with the move to new new csproj
1 parent 7ec63a5 commit 494582b

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

build/scripts/Benchmarking.fsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,10 @@ module Benchmarker =
2121
let projectJson = testsProjectDirectory @@ "project.json"
2222
// running benchmarks can timeout so clean up any generated benchmark files
2323
try
24-
DotNetCli.Restore(fun p ->
25-
{ p with
26-
Project = projectJson
27-
})
28-
2924
DotNetCli.RunCommand(fun p ->
3025
{ p with
31-
WorkingDir = testsProjectDirectory
32-
}) "run Benchmark"
26+
WorkingDir = testsProjectDirectory
27+
}) "run -f net46 -c Release Benchmark"
3328
finally
3429
let benchmarkOutputFiles =
3530
let output = combinePaths testsProjectDirectory "BenchmarkDotNet.Artifacts"

build/scripts/Building.fsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#load @"Versioning.fsx"
1010

1111
open System
12+
open System.IO
1213
open Fake
1314
open FSharp.Data
1415

@@ -42,6 +43,7 @@ module Build =
4243
"CurrentAssemblyFileVersion", (Versioning.CurrentAssemblyFileVersion.ToString());
4344
"DoSourceLink", sourceLink;
4445
"DotNetCoreOnly", if buildingOnTravis then "1" else "";
46+
"OutputPathBaseDir", Path.GetFullPath Paths.BuildOutput;
4547
]
4648
|> List.map (fun (p,v) -> sprintf "%s=%s" p v)
4749
|> String.concat ";"
@@ -78,4 +80,4 @@ module Build =
7880
DotNetCli.RunCommand (fun p -> { p with TimeOut = TimeSpan.FromMinutes(3.) }) "clean src/Elasticsearch.sln -c Release" |> ignore
7981
DotNetProject.All |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p.Name))
8082
| (_, _) ->
81-
tracefn "Skiping clean target only run when calling 'release', 'canary', 'clean' as targets directly"
83+
tracefn "Skipping clean target only run when calling 'release', 'canary', 'clean' as targets directly"

build/scripts/Commandline.fsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,17 @@ module Commandline =
6767
setEnvironVar "FAKEBUILD" "1"
6868
printfn "%A" arguments
6969
match arguments with
70-
| [] | ["build"] | ["test"] | ["clean"] -> ignore()
70+
| [] | ["build"] | ["test"] | ["clean"] | ["benchmark"] | ["profile"] -> ignore()
7171
| ["release"; version] -> setBuildParam "version" version
7272

7373
| ["test"; testFilter] -> setBuildParam "testfilter" testFilter
7474

75-
| ["profile"; esVersions] -> setBuildParam "esversions" esVersions
75+
| ["profile"; esVersions] ->
76+
setBuildParam "esversions" esVersions
7677
| ["profile"; esVersions; testFilter] ->
7778
setBuildParam "esversions" esVersions
78-
setBuildParam "testfilter" testFilter
79-
79+
setBuildParam "testfilter" testFilter
80+
8081
| ["integrate"; esVersions] -> setBuildParam "esversions" esVersions
8182
| ["integrate"; esVersions; clusterFilter] ->
8283
setBuildParam "esversions" esVersions

build/scripts/Profiling.fsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ module Profiler =
4848
member val Commit = commit with get, set
4949
member val Functions = functions with get, set
5050

51-
let private project = "Tests"
52-
let private profiledApp = sprintf "%s/%s/%s.exe" (Paths.Output("v4.6")) project project
51+
let private project = PrivateProject(Tests).Name
52+
let private profiledApp = sprintf "%s/net46/%s.exe" (Paths.Output("Tests")) project
5353
let private snapShotOutput = Paths.Output("ProfilingSnapshot.dtp")
5454
let private snapShotStatsOutput = Paths.Output("ProfilingSnapshotStats.html")
5555
let private profileOutput = Paths.Output("ProfilingReport.xml")
@@ -63,7 +63,8 @@ module Profiler =
6363

6464
let Run() =
6565
let date = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffz")
66-
Tooling.execProcessWithTimeout profiledApp ["Profile";"Class";getBuildParam "testfilter"] (TimeSpan.FromMinutes 30.) |> ignore
66+
trace profiledApp
67+
Tooling.execProcessWithTimeout profiledApp ["Profile";"Class";getBuildParam "testfilter"] (TimeSpan.FromMinutes 30.) "." |> ignore
6768
trace "Profiling finished."
6869

6970
let performanceOutput = Paths.Output("profiling/performance") |> directoryInfo

src/CodeGeneration/ApiGenerator/ApiGenerator.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616
<Folder Include="RestSpecification\XPack\Info" />
1717
</ItemGroup>
1818
<Import Project="..\..\..\.paket\Paket.Restore.targets" />
19+
<Import Project="..\..\outputpath.props" />
1920
</Project>

src/CodeGeneration/DocGenerator/DocGenerator.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@
1919
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
2020
</ItemGroup>
2121
<Import Project="..\..\..\.paket\Paket.Restore.targets" />
22+
<Import Project="..\..\outputpath.props" />
2223
</Project>

src/Elasticsearch.Net/Elasticsearch.Net.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
1818
</ItemGroup>
1919
<Import Project="..\..\.paket\Paket.Restore.targets" />
20+
<Import Project="..\outputpath.props" />
2021
</Project>

src/Nest/Nest.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@
3232
</ItemGroup>
3333
<!--<Import Project="..\..\.paket\Paket.Restore.targets" />-->
3434
<Import Project="..\..\.paket\Paket.Restore.targets" />
35+
<Import Project="..\outputpath.props" />
3536
</Project>

src/Tests/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static Program()
5959
// TODO: Renamed this from Main to TestMain because of a bug with Resharper and running unit tests
6060
// in Visual Studio with .NET Core: https://youtrack.jetbrains.com/issue/RSRP-464233
6161
// Once this is fixed, look at renaming back and removing additional packages. See https://github.com/elastic/elasticsearch-net/pull/2793
62-
public static void TestMain(string[] args)
62+
public static void Main(string[] args)
6363
{
6464
if (args.Length == 0)
6565
Console.WriteLine("Must specify at least one argument: TestAssemblyPath, Profile or Benchmark ");

src/Tests/Tests.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<PackageReference Include="BenchMarkDotNet" Version="0.10.0" />
2424
<PackageReference Include="DiffPlex" Version="1.4.1" />
2525
<PackageReference Include="System.Reactive" Version="3.1.1" />
26-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
2726
<!-- TODO only for Desktop CLR? -->
2827
<PackageReference Include="System.Buffers" Version="4.3.0" />
2928
<!-- TODO update -->
@@ -32,14 +31,12 @@
3231
<PackageReference Include="JetBrains.Profiler.Kernel.Windows.Api" Version="108.0.20170209.151431-eap01" />
3332
<Reference Include="..\..\build\profiling\JetBrains.Profiler.Windows.SelfApi.dll" />
3433
</ItemGroup>
35-
<ItemGroup Condition="'$(TargetFramework)'!='net45'">
36-
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
37-
</ItemGroup>
3834
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp1.1'">
3935
<PackageReference Include="System.Net.Http" Version="4.3.0" />
4036
<PackageReference Include="System.Diagnostics.FileVersionInfo" Version="4.3.0" />
4137
</ItemGroup>
4238
<ItemGroup>
4339
<EmbeddedResource Include="Document\Single\Index\Attachment_Test_Document.pdf" />
4440
</ItemGroup>
41+
<Import Project="..\outputpath.props" />
4542
</Project>

0 commit comments

Comments
 (0)