Browse Source

Stabilize the headless decompile-wait tests on slow CI runners

Keep the headless UI tests from timing out on the slow Windows runner:
decompile a small CoreLib type (System.Object) in the folding and
token-history tests instead of a large one, and raise the shared
decompile-wait timeout so a cold first decompile (JIT plus building a
CoreLib-scale type system) finishes in time.

Assisted-by: Claude:claude-opus-4-8:Claude Code
pull/3755/head
Siegfried Pammer 4 weeks ago
parent
commit
ddd7134e00
  1. 7
      ILSpy.Tests/Editor/FoldingContextMenuTests.cs
  2. 7
      ILSpy.Tests/Metadata/GoToTokenHistoryTests.cs
  3. 5
      ILSpy.Tests/Waiters.cs

7
ILSpy.Tests/Editor/FoldingContextMenuTests.cs

@ -44,8 +44,11 @@ public class FoldingContextMenuTests
// them all, then expand them all on a second invocation -- via DecompilerTextView.ToggleAllFoldings. // them all, then expand them all on a second invocation -- via DecompilerTextView.ToggleAllFoldings.
var (window, vm) = await TestHarness.BootAsync(3); var (window, vm) = await TestHarness.BootAsync(3);
var typeNode = vm.AssemblyTreeModel.FindNode<TypeTreeNode>( // A small CoreLib type still yields brace foldings (one per method body) but decompiles fast
"System.Linq", "System.Linq", "System.Linq.Enumerable"); // enough for the headless 15s wait on slow CI runners; a full System.Linq.Enumerable decompile
// does not.
var coreLibName = typeof(object).Assembly.GetName().Name!;
var typeNode = vm.AssemblyTreeModel.FindNode<TypeTreeNode>(coreLibName, "System", "System.Object");
vm.AssemblyTreeModel.SelectNode(typeNode); vm.AssemblyTreeModel.SelectNode(typeNode);
await vm.DockWorkspace.WaitForDecompiledTextAsync(); await vm.DockWorkspace.WaitForDecompiledTextAsync();

7
ILSpy.Tests/Metadata/GoToTokenHistoryTests.cs

@ -46,8 +46,11 @@ public class GoToTokenHistoryTests
var ws = vm.DockWorkspace; var ws = vm.DockWorkspace;
// Start somewhere concrete: a decompiled type. This becomes the entry Back should return to. // Start somewhere concrete: a decompiled type. This becomes the entry Back should return to.
var startNode = vm.AssemblyTreeModel.FindNode<TypeTreeNode>( // A small CoreLib type keeps the decompile inside the headless 15s wait on slow CI runners
"System.Linq", "System.Linq", "System.Linq.Enumerable"); // (a full System.Linq.Enumerable decompile overruns it); the token jump below lands on the
// metadata table, a distinct node either way.
var coreLibName = typeof(object).Assembly.GetName().Name!;
var startNode = vm.AssemblyTreeModel.FindNode<TypeTreeNode>(coreLibName, "System", "System.Object");
Assert.That(startNode, Is.Not.Null); Assert.That(startNode, Is.Not.Null);
vm.AssemblyTreeModel.SelectNode(startNode); vm.AssemblyTreeModel.SelectNode(startNode);
await ws.WaitForDecompiledTextAsync(); await ws.WaitForDecompiledTextAsync();

5
ILSpy.Tests/Waiters.cs

@ -34,7 +34,10 @@ namespace ICSharpCode.ILSpy.Tests;
public static class Waiters public static class Waiters
{ {
static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(15); // Generous so the slow Windows CI runner can finish a cold first decompile (JIT + building a
// CoreLib-scale type system) or a large/whole-assembly decompile. A fast machine completes well
// under this and never waits the full window; only a genuine hang pays the price.
static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(60);
static readonly TimeSpan PollInterval = TimeSpan.FromMilliseconds(25); static readonly TimeSpan PollInterval = TimeSpan.FromMilliseconds(25);
public static async Task WaitForAsync( public static async Task WaitForAsync(

Loading…
Cancel
Save