[libc-commits] [libc] [libc] Fix pthread_create_test for 32 bit systems (PR #66564)

Mikhail R. Gadelha via libc-commits libc-commits at lists.llvm.org
Fri Sep 22 06:55:10 PDT 2023


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

>From 08b5d0279b93f4ef7dec3f42e09cfb45f2c3d090 Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Fri, 15 Sep 2023 21:56:11 -0300
Subject: [PATCH 1/2] [libc] Fix pthread_create_test for 32 bit systems

The test tries to set the guard_size and stack_size of a thread to
SIZE_MAX / 4, which is a huge value in 64-bit systems but 1GB in 32-bit
ones.

We remove this test since the previous line already sets a value that
fails in both 64-bit and 32-bit systems.
---
 libc/test/integration/src/pthread/pthread_create_test.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libc/test/integration/src/pthread/pthread_create_test.cpp b/libc/test/integration/src/pthread/pthread_create_test.cpp
index 20a1139efbfa1ed..33dfe19f5ec4aff 100644
--- a/libc/test/integration/src/pthread/pthread_create_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_create_test.cpp
@@ -287,7 +287,6 @@ static void run_failure_tests() {
   run_failure_config(PTHREAD_STACK_MIN, SIZE_MAX);
   run_failure_config(PTHREAD_STACK_MIN, SIZE_MAX - PTHREAD_STACK_MIN);
   run_failure_config(SIZE_MAX / 2, SIZE_MAX / 2);
-  run_failure_config(SIZE_MAX / 4, SIZE_MAX / 4);
   run_failure_config(SIZE_MAX / 2 + 1234, SIZE_MAX / 2);
 
   // Test invalid parameters that are impossible to obtain via the

>From 3c289986d17fa96e8e83a2b52d9eddeb781f2810 Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Fri, 22 Sep 2023 10:53:54 -0300
Subject: [PATCH 2/2] Added 3 * (SIZE_MAX / 4) as suggested in the comments

---
 libc/test/integration/src/pthread/pthread_create_test.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libc/test/integration/src/pthread/pthread_create_test.cpp b/libc/test/integration/src/pthread/pthread_create_test.cpp
index 33dfe19f5ec4aff..c8d512343586f66 100644
--- a/libc/test/integration/src/pthread/pthread_create_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_create_test.cpp
@@ -287,6 +287,7 @@ static void run_failure_tests() {
   run_failure_config(PTHREAD_STACK_MIN, SIZE_MAX);
   run_failure_config(PTHREAD_STACK_MIN, SIZE_MAX - PTHREAD_STACK_MIN);
   run_failure_config(SIZE_MAX / 2, SIZE_MAX / 2);
+  run_failure_config(3 * (SIZE_MAX / 4), SIZE_MAX / 4);
   run_failure_config(SIZE_MAX / 2 + 1234, SIZE_MAX / 2);
 
   // Test invalid parameters that are impossible to obtain via the



More information about the libc-commits mailing list