Skip to content

Commit 5a7a85d

Browse files
author
David Kline
authored
Merge pull request #223 from Microsoft/master
V0.9.3 release - ETW streaming and refactoring of aync usage
2 parents 0f7f95c + 4fd8709 commit 5a7a85d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1336
-714
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ Address any review comments, force push to your topic branch, and post a comment
7171

7272
If the pull request review goes well, a project maintainer will merge your changes. Thank you for helping improve the Windows Device Portal Wrapper!
7373

74+
# NuGet release and versioning
75+
76+
**For maintainers**
77+
78+
When creating a new NuGet and GitHub release, the following steps should be taken:
79+
1. Bump the version number as appropriate in master (after 1.0, WDP Wrapper will correctly use semver)
80+
2. Merge from Master to Release, with a PR appropriately named ("v1.2.3 release")
81+
3. Squash and merge commits, leaving major feature entries and fixes in the description.
82+
4. Compile release builds of the .NET and UWP libraries, sign them, and upload to NuGet
83+
5. Cut a new release on GitHub using the same version number ("v1.2.3") and attach the signed libraries to the release.
84+
6. Update code documentation.
7485

7586
# Updating code documentation
7687

Samples/SampleWdpClient.UniversalWindows/MainPage.xaml.cs

Lines changed: 146 additions & 259 deletions
Large diffs are not rendered by default.

WindowsDevicePortalWrapper/MockDataGenerator/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ public class Program
4040
new Endpoint(HttpMethods.Get, DevicePortal.IpConfigApi),
4141
new Endpoint(HttpMethods.Get, DevicePortal.SystemPerfApi),
4242
new Endpoint(HttpMethods.Get, DevicePortal.RunningProcessApi),
43+
new Endpoint(HttpMethods.Get, DevicePortal.CustomEtwProvidersApi),
44+
new Endpoint(HttpMethods.Get, DevicePortal.EtwProvidersApi),
4345
new Endpoint(HttpMethods.WebSocket, DevicePortal.SystemPerfApi),
4446
new Endpoint(HttpMethods.WebSocket, DevicePortal.RunningProcessApi),
47+
new Endpoint(HttpMethods.WebSocket, DevicePortal.RealtimeEtwSessionApi),
4548

4649
// HoloLens specific endpoints
4750
new Endpoint(HttpMethods.Get, DevicePortal.HolographicIpdApi),
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
//----------------------------------------------------------------------------------------------
2+
// <copyright file="EtwTests.cs" company="Microsoft Corporation">
3+
// Licensed under the MIT License. See LICENSE.TXT in the project root license information.
4+
// </copyright>
5+
//----------------------------------------------------------------------------------------------
6+
7+
using System;
8+
using System.Collections.Generic;
9+
using System.Linq;
10+
using System.Threading;
11+
using System.Threading.Tasks;
12+
using Microsoft.VisualStudio.TestTools.UnitTesting;
13+
using static Microsoft.Tools.WindowsDevicePortal.DevicePortal;
14+
15+
namespace Microsoft.Tools.WindowsDevicePortal.Tests.Core
16+
{
17+
/// <summary>
18+
/// Test class for ETW APIs.
19+
/// </summary>
20+
[TestClass]
21+
public class EtwTests : BaseTests
22+
{
23+
/// <summary>
24+
/// Basic test of GET method for getting a list of custom registered ETW providers.
25+
/// </summary>
26+
[TestMethod]
27+
public void GetCustomEtwProvidersTest()
28+
{
29+
TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.CustomEtwProvidersApi, HttpMethods.Get);
30+
31+
Task<EtwProviders> getCustomEtwProvidersTask = TestHelpers.Portal.GetCustomEtwProvidersAsync();
32+
getCustomEtwProvidersTask.Wait();
33+
34+
Assert.AreEqual(TaskStatus.RanToCompletion, getCustomEtwProvidersTask.Status);
35+
36+
ValidateEtwProviders(getCustomEtwProvidersTask.Result);
37+
}
38+
39+
/// <summary>
40+
/// Basic test of GET method for getting a list of registered ETW providers.
41+
/// </summary>
42+
[TestMethod]
43+
public void GetEtwProvidersTest()
44+
{
45+
TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.EtwProvidersApi, HttpMethods.Get);
46+
47+
Task<EtwProviders> getEtwProvidersTask = TestHelpers.Portal.GetEtwProvidersAsync();
48+
getEtwProvidersTask.Wait();
49+
50+
Assert.AreEqual(TaskStatus.RanToCompletion, getEtwProvidersTask.Status);
51+
52+
ValidateEtwProviders(getEtwProvidersTask.Result);
53+
}
54+
55+
[TestMethod]
56+
public void GetEtwEventsTest()
57+
{
58+
TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.RealtimeEtwSessionApi, HttpMethods.WebSocket);
59+
60+
ManualResetEvent etwEventsReceived = new ManualResetEvent(false);
61+
EtwEvents etwEvents = null;
62+
63+
WindowsDevicePortal.WebSocketMessageReceivedEventHandler<EtwEvents> etwEventsReceivedHandler =
64+
delegate (DevicePortal sender, WebSocketMessageReceivedEventArgs<EtwEvents> args)
65+
{
66+
if (args.Message != null)
67+
{
68+
etwEvents = args.Message;
69+
etwEventsReceived.Set();
70+
}
71+
};
72+
73+
TestHelpers.Portal.RealtimeEventsMessageReceived += etwEventsReceivedHandler;
74+
75+
Task startListeningForEtwEventsTask = TestHelpers.Portal.StartListeningForEtwEventsAsync();
76+
startListeningForEtwEventsTask.Wait();
77+
Assert.AreEqual(TaskStatus.RanToCompletion, startListeningForEtwEventsTask.Status);
78+
79+
etwEventsReceived.WaitOne();
80+
81+
Task stopListeningForEtwEventsTask = TestHelpers.Portal.StopListeningForEtwEventsAsync();
82+
stopListeningForEtwEventsTask.Wait();
83+
Assert.AreEqual(TaskStatus.RanToCompletion, stopListeningForEtwEventsTask.Status);
84+
85+
TestHelpers.Portal.RealtimeEventsMessageReceived -= etwEventsReceivedHandler;
86+
87+
ValidateEtwEvents(etwEvents);
88+
}
89+
90+
/// <summary>
91+
/// Validate the <see cref="EtwEvents"/> returned from the tests.
92+
/// </summary>
93+
/// <param name="etwEvents">The <see cref="EtwEvents"/> to validate.</param>
94+
private static void ValidateEtwEvents(EtwEvents etwEvents)
95+
{
96+
Assert.IsNotNull(etwEvents);
97+
}
98+
99+
/// <summary>
100+
/// Validate the <see cref="EtwProviders"/> returned from the tests.
101+
/// </summary>
102+
/// <param name="etw">The <see cref="EtwProviders"/> to validate.</param>
103+
private static void ValidateEtwProviders(EtwProviders etw)
104+
{
105+
Assert.IsTrue(etw.Providers.Count > 0);
106+
Assert.IsTrue(etw.Providers.All(etwProvider => !string.IsNullOrEmpty(etwProvider.Name)));
107+
}
108+
}
109+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//----------------------------------------------------------------------------------------------
2+
// <copyright file="WindowsErrorReportingTests.cs" company="Microsoft Corporation">
3+
// Licensed under the MIT License. See LICENSE.TXT in the project root license information.
4+
// </copyright>
5+
//----------------------------------------------------------------------------------------------
6+
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using System.Threading.Tasks;
10+
using Microsoft.VisualStudio.TestTools.UnitTesting;
11+
using static Microsoft.Tools.WindowsDevicePortal.DevicePortal;
12+
13+
namespace Microsoft.Tools.WindowsDevicePortal.Tests.Core
14+
{
15+
/// <summary>
16+
/// Test class for Windows Error Reporting (WER) APIs.
17+
/// </summary>
18+
[TestClass]
19+
public class WindowsErrorReportingTests : BaseTests
20+
{
21+
/// <summary>
22+
/// Basic test of GET method for getting a list of Windows Error Reporting (WER) reports.
23+
/// </summary>
24+
[TestMethod]
25+
public void GetWindowsErrorReportsTest()
26+
{
27+
TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.WindowsErrorReportsApi, HttpMethods.Get);
28+
29+
Task<WerDeviceReports> getWerReportsTask = TestHelpers.Portal.GetWindowsErrorReportsAsync();
30+
getWerReportsTask.Wait();
31+
32+
Assert.AreEqual(TaskStatus.RanToCompletion, getWerReportsTask.Status);
33+
34+
List<WerUserReports> deviceReports = getWerReportsTask.Result.UserReports;
35+
Assert.AreEqual(6, deviceReports.Count);
36+
deviceReports.ForEach(userReport =>
37+
{
38+
Assert.IsFalse(string.IsNullOrWhiteSpace(userReport.UserName));
39+
userReport.Reports.ForEach(report =>
40+
{
41+
Assert.AreNotEqual(0, report.CreationTime);
42+
Assert.IsFalse(string.IsNullOrWhiteSpace(report.Name));
43+
switch (report.Type.ToLower())
44+
{
45+
case "queue":
46+
case "archive":
47+
break;
48+
default:
49+
Assert.Fail($"Expected the report type to be 'Queue' or 'Archive'. Actual value is '{report.Type}'.");
50+
break;
51+
}
52+
});
53+
});
54+
}
55+
56+
/// <summary>
57+
/// Basic test of GET method for getting a list of Windows Error Reporting (WER) report files.
58+
/// </summary>
59+
[TestMethod]
60+
public void GetWindowsErrorReportFilesTest()
61+
{
62+
TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.WindowsErrorReportingFilesApi, HttpMethods.Get);
63+
64+
Task<WerFiles> getWerReportingFilesTask = TestHelpers.Portal.GetWindowsErrorReportingFileListAsync(string.Empty, string.Empty, string.Empty);
65+
getWerReportingFilesTask.Wait();
66+
67+
Assert.AreEqual(TaskStatus.RanToCompletion, getWerReportingFilesTask.Status);
68+
69+
List<WerFileInformation> list = getWerReportingFilesTask.Result.Files;
70+
Assert.AreEqual(2, list.Count);
71+
list.ForEach(file =>
72+
{
73+
Assert.IsFalse(string.IsNullOrWhiteSpace(file.Name));
74+
Assert.AreNotEqual(0, file.Size);
75+
});
76+
}
77+
}
78+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Providers" : [{"GUID" : "3A43D90E-530E-41E5-A897-B555516070E2", "Name" : "Provider.One"},{"GUID" : "52B1715B-5AB6-4B48-A61A-A93EE8D4B5CD", "Name" : "Provider-Two"},{"GUID" : "698F02FF-2B63-4CBB-AB06-FEB88011347E", "Name" : "Provider.Three"}]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Providers" : [{"GUID" : "3A43D90E-530E-41E5-A897-B555516070E2", "Name" : "Provider.One"},{"GUID" : "52B1715B-5AB6-4B48-A61A-A93EE8D4B5CD", "Name" : "Provider-Two"},{"GUID" : "698F02FF-2B63-4CBB-AB06-FEB88011347E", "Name" : "Provider.Three"}]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Files" : [{"Name" : "DMI59C3.tmp.log.xml", "Size" : 17490},{"Name" : "Report.wer", "Size" : 2354}]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"WerReports" : [{"User" : "All Users", "Reports" : []},{"User" : "Default", "Reports" : []},{"User" : "Default User", "Reports" : []},{"User" : "defaultuser0", "Reports" : []},{"User" : "Public", "Reports" : []},{"User" : "SYSTEM", "Reports" : [{"CreationTime" : 131318340058889142, "Name" : "NonCritical_x64_7929388dba23a244febb598fddbb379b5a87d15_00000000_cab_03f96433", "Type" : "Queue"},{"CreationTime" : 131318340058732887, "Name" : "NonCritical_x64_bf8ef24cbbad37c50f759d68f2292f1f2b0e7df_00000000_cab_03f96423", "Type" : "Queue"},{"CreationTime" : 131318550054539960, "Name" : "NonCritical_x64_f52a5825f740cca45c7b0c8078746ec73beaac_00000000_18add298", "Type" : "Archive"},{"CreationTime" : 131318340063576709, "Name" : "NonCritical_x64_f728cd6f9e9f34997130a4d3dd3d855648a6f_00000000_0ca56608", "Type" : "Archive"}]}]}

0 commit comments

Comments
 (0)