diff --git a/libc/test/src/stdlib/StrtolTest.h b/libc/test/src/stdlib/StrtolTest.h --- a/libc/test/src/stdlib/StrtolTest.h +++ b/libc/test/src/stdlib/StrtolTest.h @@ -8,6 +8,7 @@ #include "src/__support/CPP/limits.h" #include "src/__support/CPP/type_traits.h" +#include "src/__support/macros/properties/architectures.h" #include "src/errno/libc_errno.h" #include "test/UnitTest/Test.h" @@ -198,6 +199,12 @@ } void DecodeInOtherBases(FunctionT func) { +#if defined(LIBC_TARGET_ARCH_IS_GPU) + // This test is excessively slow on the GPU so we limit the nested depth. + constexpr int limit = 1; +#else + constexpr int limit = 36; +#endif char small_string[4] = {'\0', '\0', '\0', '\0'}; for (int base = 2; base <= 36; ++base) { for (int first_digit = 0; first_digit <= 36; ++first_digit) { @@ -218,7 +225,7 @@ for (int base = 2; base <= 36; ++base) { for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); - for (int second_digit = 0; second_digit <= 36; ++second_digit) { + for (int second_digit = 0; second_digit <= limit; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); if (first_digit < base && second_digit < base) { libc_errno = 0; @@ -243,9 +250,9 @@ for (int base = 2; base <= 36; ++base) { for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); - for (int second_digit = 0; second_digit <= 36; ++second_digit) { + for (int second_digit = 0; second_digit <= limit; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); - for (int third_digit = 0; third_digit <= 36; ++third_digit) { + for (int third_digit = 0; third_digit <= limit; ++third_digit) { small_string[2] = int_to_b36_char(third_digit); if (first_digit < base && second_digit < base &&