@@ -15,20 +15,38 @@ import (
15
15
)
16
16
17
17
func TestNetTraceDecoding (t * testing.T ) {
18
- t .Run (".Net 5.0 SampleProfiler Web app" , func (t * testing.T ) {
19
- requireEqual (t ,
20
- "testdata/dotnet-5.0-SampleProfiler-webapp.golden.nettrace" ,
21
- "testdata/dotnet-5.0-SampleProfiler-webapp.txt" )
22
- })
18
+ t .Run (".Net 5.0 SampleProfiler" , func (t * testing.T ) {
19
+ t .Run ("Web app" , func (t * testing.T ) {
20
+ t .Run ("Managed code only" , func (t * testing.T ) {
21
+ requireEqual (t ,
22
+ "testdata/dotnet-5.0-SampleProfiler-webapp.golden.nettrace" ,
23
+ "testdata/dotnet-5.0-SampleProfiler-webapp-managed-only.txt" ,
24
+ profiler .WithManagedCodeOnly ())
25
+ })
26
+ t .Run ("Managed and native code" , func (t * testing.T ) {
27
+ requireEqual (t ,
28
+ "testdata/dotnet-5.0-SampleProfiler-webapp.golden.nettrace" ,
29
+ "testdata/dotnet-5.0-SampleProfiler-webapp.txt" )
30
+ })
31
+ })
23
32
24
- t .Run (".Net 5.0 SampleProfiler Simple single thread app" , func (t * testing.T ) {
25
- requireEqual (t ,
26
- "testdata/dotnet-5.0-SampleProfiler-single-thread.golden.nettrace" ,
27
- "testdata/dotnet-5.0-SampleProfiler-single-thread.txt" )
33
+ t .Run ("Simple single thread app" , func (t * testing.T ) {
34
+ t .Run ("Managed code only" , func (t * testing.T ) {
35
+ requireEqual (t ,
36
+ "testdata/dotnet-5.0-SampleProfiler-single-thread.golden.nettrace" ,
37
+ "testdata/dotnet-5.0-SampleProfiler-single-thread-managed-only.txt" ,
38
+ profiler .WithManagedCodeOnly ())
39
+ })
40
+ t .Run ("Managed and native code" , func (t * testing.T ) {
41
+ requireEqual (t ,
42
+ "testdata/dotnet-5.0-SampleProfiler-single-thread.golden.nettrace" ,
43
+ "testdata/dotnet-5.0-SampleProfiler-single-thread.txt" )
44
+ })
45
+ })
28
46
})
29
47
}
30
48
31
- func requireEqual (t * testing.T , sample , expected string ) {
49
+ func requireEqual (t * testing.T , sample , expected string , options ... profiler. Option ) {
32
50
t .Helper ()
33
51
34
52
s , err := os .Open (sample )
@@ -40,7 +58,7 @@ func requireEqual(t *testing.T, sample, expected string) {
40
58
trace , err := stream .Open ()
41
59
requireNoError (t , err )
42
60
43
- p := profiler .NewSampleProfiler (trace )
61
+ p := profiler .NewSampleProfiler (trace , options ... )
44
62
stream .EventHandler = p .EventHandler
45
63
stream .MetadataHandler = p .MetadataHandler
46
64
stream .StackBlockHandler = p .StackBlockHandler
0 commit comments