[tools 2/2] testbot/LibvirtTool: Reduce the Windows boot delay on live snapshots.

Francois Gouget fgouget at codeweavers.com
Mon Feb 21 11:33:12 CST 2022


Reducing the boot delay helps ensure there will be enough time for
Windows to complete the reboot before the task times out, which may
allow the TestBot to retrieve the report/logs/diagnostic information.
Note that on 64-bit Windows this requires a 64-bit TestAgentd in order
to be able to run bcdedit.exe.
Also this only works on recent versions of Windows which is okay since a
failure to change the boot delay will not prevent the tests from
running.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
64-bit Windows only has the 64-bit version of bcdedit.exe but it is not
in the %PATH% of 32-bit processes. Worse, Windows' path rewriting
prevents starting it even when specifying an absolute path... except if
using the c:\Windows\SysNative hack. But in turn that does not work if
there is no path rewriting such as on 32-bit Windows versions.
---
 testbot/bin/LibvirtTool.pl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index 00d1ce4f8e..ef662cdf19 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -651,6 +651,15 @@ sub CreateSnapshot($$$$)
     {
       FatalError("Could not reset the $VMKey Windows desktop background color\n");
     }
+
+    # Reduce the boot delay. The way to do this depends on the Windows
+    # version so this only works on recent ones :-(
+    my $PTA = GetPrivilegedTA($TA);
+    if (RunAndWait($PTA, ["bcdedit.exe", "/set", "{bootmgr}", "timeout", "1"]))
+    {
+      Error("Could not change the Windows boot delay on $VMKey\n");
+    }
+
     $Reboot = 1;
   }
 
-- 
2.30.2



More information about the wine-devel mailing list