expr: fix crash for test_long_input on OpenBSD

Signed-off-by: Laurent Cheylus <foxy@free.fr>
This commit is contained in:
Laurent Cheylus 2025-11-08 17:15:35 +01:00
parent 0fabf825e1
commit 6130a334f2
No known key found for this signature in database

View file

@ -582,11 +582,17 @@ fn test_eager_evaluation() {
#[test]
fn test_long_input() {
// Giving expr an arbitrary long expression should succeed rather than end with a segfault due to a stack overflow.
#[cfg(not(windows))]
#[cfg(all(not(windows), not(target_os = "openbsd")))]
const MAX_NUMBER: usize = 40000;
#[cfg(not(windows))]
#[cfg(all(not(windows), not(target_os = "openbsd")))]
const RESULT: &str = "800020000\n";
// On OpenBSD, crash with default MAX_NUMBER
#[cfg(target_os = "openbsd")]
const MAX_NUMBER: usize = 10000;
#[cfg(target_os = "openbsd")]
const RESULT: &str = "50005000\n";
// On windows there is 8192 characters input limit
#[cfg(windows)]
const MAX_NUMBER: usize = 1300; // 7993 characters (with spaces)