[libc-commits] [libc] [libc] Increase test timeout (PR #99678)

Mikhail R. Gadelha via libc-commits libc-commits at lists.llvm.org
Fri Jul 19 11:21:49 PDT 2024


https://github.com/mikhailramalho updated https://github.com/llvm/llvm-project/pull/99678

>From a365a040783e74e6cde5f097fa71b01bfd8ac8cc Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Fri, 19 Jul 2024 15:15:52 -0300
Subject: [PATCH 1/2] [libc] Increase test timeout

This patch increases the timeout of the libc test from 1s to 10s, mostly
because rv32 runs in a qemu image and sometimes 1s is just not enough
for the test to finish when there are other tests running in parallel
---
 libc/test/UnitTest/LibcDeathTestExecutors.cpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libc/test/UnitTest/LibcDeathTestExecutors.cpp b/libc/test/UnitTest/LibcDeathTestExecutors.cpp
index e43dbb19ad152..cd632677f0386 100644
--- a/libc/test/UnitTest/LibcDeathTestExecutors.cpp
+++ b/libc/test/UnitTest/LibcDeathTestExecutors.cpp
@@ -14,13 +14,18 @@
 
 #include <cassert>
 
+namespace {
+constexpr unsigned timeout_ms = 10000;
+} // Anonymous namespace
+
 namespace LIBC_NAMESPACE_DECL {
 namespace testing {
 
 bool Test::testProcessKilled(testutils::FunctionCaller *Func, int Signal,
                              const char *LHSStr, const char *RHSStr,
                              internal::Location Loc) {
-  testutils::ProcessStatus Result = testutils::invoke_in_subprocess(Func, 1000);
+  testutils::ProcessStatus Result =
+      testutils::invoke_in_subprocess(Func, timeout_ms);
 
   if (const char *error = Result.get_error()) {
     Ctx->markFail();
@@ -32,7 +37,7 @@ bool Test::testProcessKilled(testutils::FunctionCaller *Func, int Signal,
   if (Result.timed_out()) {
     Ctx->markFail();
     tlog << Loc;
-    tlog << "Process timed out after " << 1000 << " milliseconds.\n";
+    tlog << "Process timed out after " << timeout_ms << " milliseconds.\n";
     return false;
   }
 
@@ -63,7 +68,8 @@ bool Test::testProcessKilled(testutils::FunctionCaller *Func, int Signal,
 bool Test::testProcessExits(testutils::FunctionCaller *Func, int ExitCode,
                             const char *LHSStr, const char *RHSStr,
                             internal::Location Loc) {
-  testutils::ProcessStatus Result = testutils::invoke_in_subprocess(Func, 1000);
+  testutils::ProcessStatus Result =
+      testutils::invoke_in_subprocess(Func, timeout_ms);
 
   if (const char *error = Result.get_error()) {
     Ctx->markFail();
@@ -75,7 +81,7 @@ bool Test::testProcessExits(testutils::FunctionCaller *Func, int ExitCode,
   if (Result.timed_out()) {
     Ctx->markFail();
     tlog << Loc;
-    tlog << "Process timed out after " << 1000 << " milliseconds.\n";
+    tlog << "Process timed out after " << timeout_ms << " milliseconds.\n";
     return false;
   }
 

>From eaf2204338a2162d14ad64c1d705dbdcf6be5a2d Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail.ramalho at gmail.com>
Date: Fri, 19 Jul 2024 15:21:40 -0300
Subject: [PATCH 2/2] Update LibcDeathTestExecutors.cpp

---
 libc/test/UnitTest/LibcDeathTestExecutors.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libc/test/UnitTest/LibcDeathTestExecutors.cpp b/libc/test/UnitTest/LibcDeathTestExecutors.cpp
index cd632677f0386..77b0559c7acea 100644
--- a/libc/test/UnitTest/LibcDeathTestExecutors.cpp
+++ b/libc/test/UnitTest/LibcDeathTestExecutors.cpp
@@ -15,7 +15,7 @@
 #include <cassert>
 
 namespace {
-constexpr unsigned timeout_ms = 10000;
+constexpr unsigned TIMEOUT_MS = 10000;
 } // Anonymous namespace
 
 namespace LIBC_NAMESPACE_DECL {
@@ -25,7 +25,7 @@ bool Test::testProcessKilled(testutils::FunctionCaller *Func, int Signal,
                              const char *LHSStr, const char *RHSStr,
                              internal::Location Loc) {
   testutils::ProcessStatus Result =
-      testutils::invoke_in_subprocess(Func, timeout_ms);
+      testutils::invoke_in_subprocess(Func, TIMEOUT_MS);
 
   if (const char *error = Result.get_error()) {
     Ctx->markFail();
@@ -37,7 +37,7 @@ bool Test::testProcessKilled(testutils::FunctionCaller *Func, int Signal,
   if (Result.timed_out()) {
     Ctx->markFail();
     tlog << Loc;
-    tlog << "Process timed out after " << timeout_ms << " milliseconds.\n";
+    tlog << "Process timed out after " << TIMEOUT_MS << " milliseconds.\n";
     return false;
   }
 
@@ -69,7 +69,7 @@ bool Test::testProcessExits(testutils::FunctionCaller *Func, int ExitCode,
                             const char *LHSStr, const char *RHSStr,
                             internal::Location Loc) {
   testutils::ProcessStatus Result =
-      testutils::invoke_in_subprocess(Func, timeout_ms);
+      testutils::invoke_in_subprocess(Func, TIMEOUT_MS);
 
   if (const char *error = Result.get_error()) {
     Ctx->markFail();
@@ -81,7 +81,7 @@ bool Test::testProcessExits(testutils::FunctionCaller *Func, int ExitCode,
   if (Result.timed_out()) {
     Ctx->markFail();
     tlog << Loc;
-    tlog << "Process timed out after " << timeout_ms << " milliseconds.\n";
+    tlog << "Process timed out after " << TIMEOUT_MS << " milliseconds.\n";
     return false;
   }
 



More information about the libc-commits mailing list