Browse Source

Decompile a single method in the slow Options tests

Two Options tests selected the whole System.Linq.Enumerable type and then
awaited WaitForDecompiledTextAsync. That decompile takes >15 s in headless and
overran the 60 s wait on a loaded CI runner, so the suite flaked intermittently
(green in one run of a commit, red in another). The behaviours under test --
that a re-decompile setting refreshes the active tab, and that the refresh does
not steal focus from the Options tab -- fire on whatever the tab shows, so a
single small method exercises them just as well and decompiles near-instantly.

Assisted-by: Claude:claude-opus-4-8:Claude Code
pull/3756/head
Siegfried Pammer 4 weeks ago
parent
commit
93db1041b1
  1. 9
      ILSpy.Tests/Options/DisplaySettingsReactionTests.cs
  2. 9
      ILSpy.Tests/Options/OptionsTabTests.cs

9
ILSpy.Tests/Options/DisplaySettingsReactionTests.cs

@ -59,9 +59,16 @@ public class DisplaySettingsReactionTests
public async Task Toggling_A_Decompiler_Output_Setting_Re_Decompiles_The_Active_Tab() public async Task Toggling_A_Decompiler_Output_Setting_Re_Decompiles_The_Active_Tab()
{ {
var (_, vm) = await TestHarness.BootAsync(); var (_, vm) = await TestHarness.BootAsync();
// Decompile a single small method rather than the whole Enumerable type: the full type
// takes >15 s in headless and times out WaitForDecompiledTextAsync under CI load. The
// re-decompile reaction under test fires on whatever the active tab shows, so one method
// exercises it just as well.
var typeNode = vm.AssemblyTreeModel.FindNode<TypeTreeNode>( var typeNode = vm.AssemblyTreeModel.FindNode<TypeTreeNode>(
"System.Linq", "System.Linq", "System.Linq.Enumerable"); "System.Linq", "System.Linq", "System.Linq.Enumerable");
vm.AssemblyTreeModel.SelectedItem = typeNode; typeNode.IsExpanded = true;
var method = typeNode.Children.OfType<MethodTreeNode>()
.First(m => m.MethodDefinition.Name == "Empty");
vm.AssemblyTreeModel.SelectNode(method);
var tab = await vm.DockWorkspace.WaitForDecompiledTextAsync(); var tab = await vm.DockWorkspace.WaitForDecompiledTextAsync();
int decompileStarts = 0; int decompileStarts = 0;

9
ILSpy.Tests/Options/OptionsTabTests.cs

@ -309,10 +309,15 @@ public class OptionsTabTests
// pull focus back to MainTab and yank the user off the Options page they are editing. // pull focus back to MainTab and yank the user off the Options page they are editing.
var (_, vm) = await TestHarness.BootAsync(3); var (_, vm) = await TestHarness.BootAsync(3);
// Show some decompiled content first, so there is a decompiler tab to refresh. // Show some decompiled content first, so there is a decompiler tab to refresh. Use a single
// small method, not the whole Enumerable type: the full type takes >15 s in headless and
// times out WaitForDecompiledTextAsync under CI load.
var typeNode = vm.AssemblyTreeModel.FindNode<TypeTreeNode>( var typeNode = vm.AssemblyTreeModel.FindNode<TypeTreeNode>(
"System.Linq", "System.Linq", "System.Linq.Enumerable"); "System.Linq", "System.Linq", "System.Linq.Enumerable");
vm.AssemblyTreeModel.SelectNode(typeNode); typeNode.IsExpanded = true;
var method = typeNode.Children.OfType<MethodTreeNode>()
.First(m => m.MethodDefinition.Name == "Empty");
vm.AssemblyTreeModel.SelectNode(method);
await vm.DockWorkspace.WaitForDecompiledTextAsync(); await vm.DockWorkspace.WaitForDecompiledTextAsync();
// Open Options and confirm it is the active document. // Open Options and confirm it is the active document.

Loading…
Cancel
Save