From 61c4e40ec1f23106c56f363967a0234afe49fa91 Mon Sep 17 00:00:00 2001 From: Miheichev Aleksandr Sergeevich Date: Tue, 6 Oct 2026 07:29:09 +0000 Subject: [PATCH] test(root): fix flaky RootProcessRunner inherited-stdout test (#6282) The test gave RootProcessRunner.run a 250 ms deadline. When sh takes longer than that to start and finish, the runner hits the deadline, destroys it and returns -1, and the test fails with "expected: <0> but was: <-1>". With the sh from Git for Windows this happened in 6 of 30 runs. The test's real guard is the 1500 ms elapsed bound against the background "sleep 5". A 3000 ms deadline leaves that bound alone to decide the result, so a runner that keeps a finished command open until its deadline now fails the test as well; with 250 ms it passed. --- .../src/test/java/com/v2ray/ang/root/RootProcessRunnerTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/V2rayNG/app/src/test/java/com/v2ray/ang/root/RootProcessRunnerTest.kt b/V2rayNG/app/src/test/java/com/v2ray/ang/root/RootProcessRunnerTest.kt index 8752795c8..d5bde7e05 100644 --- a/V2rayNG/app/src/test/java/com/v2ray/ang/root/RootProcessRunnerTest.kt +++ b/V2rayNG/app/src/test/java/com/v2ray/ang/root/RootProcessRunnerTest.kt @@ -13,7 +13,7 @@ class RootProcessRunnerTest { } @Test fun `inherited stdout cannot hold a completed command open`() { val start = System.nanoTime() - val result = RootProcessRunner.run(listOf("sh", "-c", "sleep 5 & echo complete"), 250) + val result = RootProcessRunner.run(listOf("sh", "-c", "sleep 5 & echo complete"), 3000) assertEquals(0, result.code) assertTrue(result.output.contains("complete")) assertTrue(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start) < 1500)