Skip to content

Commit f087eb2

Browse files
authored
Merge pull request #630 from GameTechDev/tests/fix-timing-sysdep
Merge testing enhancements, related bugfixes, etc.
2 parents b9a906d + e4dba9f commit f087eb2

91 files changed

Lines changed: 5035 additions & 2789 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,6 @@ PresentMon/ddETWExternalEventsTEMP.BIN
6868

6969
# Local runsettings files (user-specific test configurations)
7070
*.local.runsettings
71+
machine_expectations.json
7172

7273
Directory.Build.props

BUILDING.md

Lines changed: 35 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,36 @@
44

55
- Visual Studio 2022
66

7+
- [vcpkg](https://github.com/microsoft/vcpkg)
8+
79
- [CMake](https://cmake.org)
810

911
- [Node.js / NPM](https://nodejs.org/en/download)
1012

11-
- [v3 of the WiX toolset and VS extension](https://wixtoolset.org/docs/wix3/)
13+
- [v3 of the WiX toolset AND VS extension](https://wixtoolset.org/docs/wix3/)
1214

1315
Note: if you only want to build the PresentData library, or the PresentMon Console application
1416
you only need Visual Studio. Ignore the other build and source dependency instructions and build
1517
`PresentData\PresentData.vcxproj` or `PresentMon\ConsoleApplication.sln`.
1618

1719
## Install Source Dependencies
1820

19-
1. Download and install *vcpkg*, which will be used to obtain source package dependencies during the build:
21+
1. Run the repository bootstrap script:
2022

21-
```bat
23+
```powershell
2224
> cd PresentMonRepoDir
23-
> git clone https://github.com/Microsoft/vcpkg.git build\vcpkg
24-
> build\vcpkg\bootstrap-vcpkg.bat
25-
> build\vcpkg\vcpkg.exe integrate install
26-
> build\vcpkg\vcpkg.exe install
25+
> .\bootstrap.ps1
2726
```
2827
29-
2. Build the Chromium Embedded Framework (CEF)
30-
31-
1. Download the CEF distribution and extract it to a local folder (e.g. C:\cef_133): https://cef-builds.spotifycdn.com/index.html
32-
33-
- Most recently tested release is version 136
34-
35-
- Proximal versions will most likely be compatible, but are not officially supported.
36-
37-
- The "Minimal Distribution" is sufficient.
38-
39-
2. Build 64-bit Debug and Release configurations (replace "CefDir" with the full path to the directory you downloaded into):
28+
The bootstrap script:
4029
41-
```bat
42-
> cmake -G "Visual Studio 17" -A x64 -DUSE_SANDBOX=OFF -S CefDir -B CefDir\build
43-
> cmake --build CefDir\build --config Debug
44-
> cmake --build CefDir\build --config Release
45-
```
30+
- Restores the locked Chromium Embedded Framework (CEF) payload.
31+
- Pulls the pinned auxiliary test data.
32+
- Installs and builds the AppCef web UI.
4633
47-
3. Copy the required build outputs into AppCef by running the following:
34+
See the detailed guides for [CEF lock management](IntelPresentMon/AppCef/ceflock.md), [AppCef web UI setup](IntelPresentMon/AppCef/webui.md), and [auxiliary test data](Tests/auxdata.md).
4835
49-
```bat
50-
> IntelPresentMon\AppCef\Batch\pull-cef.bat CefDir
51-
```
52-
53-
4. You can now delete the local cef directory if you wish.
54-
55-
3. Download and build the web asset dependencies via NPM. This only needs to be run once on fresh clone, or after new packages are added:
56-
57-
```bat
58-
> pushd IntelPresentMon\AppCef\ipm-ui-vue
59-
> npm ci
60-
> npm run build
61-
> popd
62-
```
63-
64-
Note: instead of using the production build as described above, you can use a development process with a local server with hotloading support. To do this, use `npm run dev` instead, and use the `--ui-option url "http://localhost:5173/"` command line argument when running the *PresentMon Capture Application*. This causes the app to load web content from localhost rather than the files in ipm-ui-vue/.
65-
66-
4. Create and install a trusted test certificate. This is only required for the Release build. Open a command shell as administrator and run the following:
36+
2. Create and install a trusted test certificate. This is only required for the Release build. Open a command shell as administrator and run the following:
6737
6838
```bat
6939
> makecert -r -pe -n "CN=Test Certificate - For Internal Use Only" -ss PrivateCertStore testcert.cer
@@ -80,13 +50,21 @@ Build `PresentMon.sln` in Visual Studio or msbuild. e.g.:
8050

8151
## Running PresentMon
8252

83-
- PresentMon Console Application: `build\Release\PresentMon-dev-x64.exe`
53+
### Intel PresentMon
54+
55+
Intel PresentMon is the UI application, `PresentMon.exe`.
56+
57+
For Debug builds, the easiest IDE workflow is to set `Client/KernelProcess` as the startup project and launch `PresentMon.exe` with the service running as a child process:
8458

85-
- PresentMon Console Tests: `build\Release\PresentMonTests-dev-x64.exe`
59+
```bat
60+
> --svc-as-child --files-working --log-level verbose --middleware-dll-path .\PresentMonAPI2.dll --log-middleware-copy
61+
```
8662

87-
- PresentMon Service Command Line Interface: `build\Release\PresentMonCli.exe`
63+
For Release builds, either move the full Release output payload to a secure directory such as "Program Files" or "System32", or disable the secure directory check for local development. You cannot run release builds from the IDE typically. The installer is often the easier path for Release validation:
8864

89-
- PresentMon Installer: `build\Release\en-us\PresentMon.msi`
65+
```bat
66+
> build\Release\en-us\PresentMon.msi
67+
```
9068

9169
### PresentMon Service
9270

@@ -104,34 +82,26 @@ When you are finished, stop and remove the service with:
10482
> sc.exe delete PresentMonService
10583
```
10684

107-
### PresentMon Capture Application
85+
### PresentMon Standalone Console
10886

109-
You must run the PresentMon Capture Application from its directory, with the *PresentMon Service* already running. e.g.:
87+
The standalone console application is `PresentMon-dev-x64.exe`:
11088

11189
```bat
112-
> cd build\Debug
113-
> PresentMon.exe
90+
> build\Release\PresentMon-dev-x64.exe
11491
```
11592

116-
Further, for the Release build, the application must be run from a secure location (e.g. "Program Files" or "System32") so it will need to be copied there first. The Release build also cannot be started from Visual Studio, irregardless of whether the debugger is attached, and even if VS is running with admin privilege.
11793

11894
## Troubleshooting
11995

120-
- If you are seeing vcpkg errors when updating to a new version of PresentMon (e.g., "error: while checking out baseline from commit...") then try updating or removing and re-adding vcpkg:
96+
- If you are seeing vcpkg errors when updating to a new version of PresentMon (e.g., "error: while checking out baseline from commit...") then try updating your vcpkg checkout.
97+
98+
- Make sure vcpkg is using the same Visual Studio installation as the solution build. If needed, set `VCPKG_VISUAL_STUDIO_PATH` before running vcpkg.
12199

122-
```bat
123-
> cd PresentMonRepoDir
124-
> build\vcpkg\vcpkg.exe remove
125-
> build\vcpkg\vcpkg.exe integrate remove
126-
> rmdir /s /q build\vcpkg
127-
> git clone https://github.com/Microsoft/vcpkg.git build\vcpkg
128-
> build\vcpkg\bootstrap-vcpkg.bat
129-
> build\vcpkg\vcpkg.exe integrate install
130-
> build\vcpkg\vcpkg.exe install
131-
```
132100

133101
- If you get an error dialog from PresentMon.exe stating "A referral was returned form the server."
134102
you most likely do not have the certificate that the PresentMon service was signed with installed
135-
into your trusted root. Ensure that the above step 4 completed successfully. If you built the
136-
installer on another PC or received it from a trusted third party, you need to install the
137-
certificate on the target PC as well.
103+
into your trusted root. Ensure that the trusted test certificate setup completed successfully. If
104+
you built the installer on another PC or received it from a trusted third party, you need to
105+
install the certificate on the target PC as well.
106+
107+
- Add the development user to the Performance Log Users group to run from the IDE, run tests, etc. without launching the IDE as administrator.

IntelPresentMon/AppCef/Batch/cef-build-wrapper.ps1

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616

1717
param(
1818
[Parameter(Mandatory=$true, Position=0)]
19-
[string]$RedistPath
19+
[string]$RedistPath,
20+
21+
[Parameter()]
22+
[switch]$Clean
2023
)
2124

2225
# Resolve & verify
@@ -27,12 +30,23 @@ if (-not (Test-Path $RedistPath -PathType Container)) {
2730
Write-Error "Not a valid directory: $RedistPath"; exit 1
2831
}
2932

30-
# Skip if already built
33+
# Skip if already built, unless the caller requested a clean wrapper build.
3134
$buildDir = Join-Path $RedistPath "build"
3235
if (Test-Path $buildDir) {
33-
Write-Host "Found existing build directory: $buildDir"
34-
Write-Host "→ Skipping configuration & build."
35-
exit 0
36+
if ($Clean) {
37+
$resolvedBuildDir = (Resolve-Path $buildDir).ProviderPath
38+
$resolvedRedistPath = (Resolve-Path $RedistPath).ProviderPath
39+
if (-not $resolvedBuildDir.StartsWith($resolvedRedistPath, [System.StringComparison]::OrdinalIgnoreCase)) {
40+
Write-Error "Refusing to clean unexpected build directory: $resolvedBuildDir"
41+
exit 1
42+
}
43+
Write-Host "Removing existing CEF wrapper build directory: $buildDir"
44+
Remove-Item -LiteralPath $buildDir -Recurse -Force
45+
} else {
46+
Write-Host "Found existing build directory: $buildDir"
47+
Write-Host "Skipping configuration and build."
48+
exit 0
49+
}
3650
}
3751

3852
# Locate VS / vcvarsall
@@ -56,25 +70,25 @@ $Generator = "Visual Studio 17"
5670
$Solution = Join-Path $buildDir "cef.sln"
5771

5872
# 1) Configure with CMake (no vcvars needed)
59-
Write-Host "Running CMake configure..."
73+
Write-Host "Running CMake configure..."
6074
cmake -G "$Generator" -A $Platform -DUSE_SANDBOX=OFF "$RedistPath"
6175
if ($LASTEXITCODE -ne 0) {
6276
Write-Error "CMake configuration failed (exit code $LASTEXITCODE)"; Pop-Location; exit $LASTEXITCODE
6377
}
6478

6579
# 2) Build Release
66-
Write-Host "`n→ Building Release..."
80+
Write-Host "`nBuilding Release..."
6781
& cmd.exe /c "`"$vcvars`" $Arch && msbuild `"$Solution`" /m /p:Configuration=Release;Platform=$Platform"
6882
if ($LASTEXITCODE -ne 0) {
6983
Write-Error "Release build failed (exit code $LASTEXITCODE)"; Pop-Location; exit $LASTEXITCODE
7084
}
7185

7286
# 3) Build Debug
73-
Write-Host "`n→ Building Debug..."
87+
Write-Host "`nBuilding Debug..."
7488
& cmd.exe /c "`"$vcvars`" $Arch && msbuild `"$Solution`" /m /p:Configuration=Debug;Platform=$Platform"
7589
if ($LASTEXITCODE -ne 0) {
7690
Write-Error "Debug build failed (exit code $LASTEXITCODE)"; Pop-Location; exit $LASTEXITCODE
7791
}
7892

7993
Pop-Location
80-
Write-Host "`n✅ All done: CEF wrapper built in $buildDir"
94+
Write-Host "`nAll done: CEF wrapper built in $buildDir"

0 commit comments

Comments
 (0)