Skip to content

Commit dc6e876

Browse files
authored
LT-22425: Fix testSetTextEmpty for Release builds (#847)
* LT-22425: Add a 1ms sleep to fix a test for release builds Also: * Run tests in a separate step for Installers and Patches * Redirect all output to the log file, not just stdout * Allow skipping managed tests from build.ps1
1 parent 7b36c33 commit dc6e876

4 files changed

Lines changed: 26 additions & 6 deletions

File tree

.github/workflows/base-installer-cd.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,16 @@ jobs:
152152
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
153153
if: github.event_name != 'pull_request'
154154

155-
- name: Build and test
156-
id: build_and_test
155+
- name: Build
156+
id: build
157157
shell: powershell
158158
run: |
159-
.\build.ps1 -BuildInstaller -Configuration Release -Verbosity detailed -RunTests -SkipNativeTests -TestFilter 'TestCategory!=DesktopRequired' -MsBuildArgs @("/bl") | Tee-Object -FilePath build.log
159+
.\build.ps1 -BuildInstaller -Configuration Release -Verbosity detailed -BuildTests -MsBuildArgs @("/bl") *>&1 | Tee-Object -FilePath build.log
160+
161+
- name: Run tests
162+
shell: powershell
163+
run: |
164+
.\test.ps1 -Configuration Release -NoBuild -TestFilter 'TestCategory!=DesktopRequired' *>&1 | Tee-Object -FilePath test.log
160165
161166
- name: Scan Build Output
162167
shell: powershell

.github/workflows/patch-installer-cd.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,17 @@ jobs:
220220
New-ItemProperty -Path $path -Name $valueName -Value $expectedValue -Type String -Force
221221
}
222222
223-
- name: Build and test
224-
id: build_and_test
223+
- name: Build
224+
id: build
225225
shell: powershell
226226
run: |
227227
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework\AppContext"
228-
.\build.ps1 -BuildPatch -Configuration Release -Verbosity detailed -RunTests -SkipNativeTests -TestFilter 'TestCategory!=DesktopRequired' -MsBuildArgs @("/bl") | Tee-Object -FilePath build.log
228+
.\build.ps1 -BuildPatch -Configuration Release -Verbosity detailed -BuildTests -MsBuildArgs @("/bl") *>&1 | Tee-Object -FilePath build.log
229+
230+
- name: Run tests
231+
shell: powershell
232+
run: |
233+
.\test.ps1 -Configuration Release -NoBuild -TestFilter 'TestCategory!=DesktopRequired' *>&1 | Tee-Object -FilePath test.log
229234
230235
- name: Scan Build Output
231236
shell: powershell

Src/views/Test/TestVwTextStore.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Last reviewed:
2323

2424
#pragma once
2525

26+
#include <chrono>
27+
#include <thread>
28+
2629
#include "testViews.h"
2730

2831
#if defined(_WIN32) || defined(_M_X64)
@@ -123,6 +126,7 @@ namespace TestViews
123126
public:
124127
MockTextStoreACPSink(ITextStoreACP * ptsa, IUnknown * punkOldSink)
125128
{
129+
this_thread::sleep_for(1ms); // testSetTextEmpty fails without this on Release builds but not Debug builds (discovered by LT-22425)
126130
m_qtsa = ptsa;
127131
if (punkOldSink)
128132
CheckHr(ptsa->UnadviseSink(punkOldSink));
@@ -1834,7 +1838,9 @@ namespace TestViews
18341838
{
18351839
//_CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF );
18361840
if (!m_fTestable)
1841+
{
18371842
return;
1843+
}
18381844
MakeStringList2();
18391845
Make2ParaSel(1, s_cchPara2, 2, 0);
18401846
TS_TEXTCHANGE ttc1 = { 0 };

build.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ param(
165165
[switch]$SkipRestore,
166166
[switch]$SkipNative,
167167
[switch]$SkipNativeTests,
168+
[switch]$SkipManagedTests,
168169
[switch]$ForceBuildBuildTasks,
169170
[switch]$BuildInstaller,
170171
[switch]$BuildPatch,
@@ -718,6 +719,9 @@ try {
718719
if ($SkipNative -or $SkipNativeTests) {
719720
$testArgs["SkipNative"] = $true
720721
}
722+
if ($SkipManagedTests) {
723+
$testArgs["SkipManaged"] = $true
724+
}
721725

722726
Stop-ConflictingProcesses @cleanupArgs
723727
& "$PSScriptRoot\test.ps1" @testArgs

0 commit comments

Comments
 (0)