Skip to content

Commit 31898f8

Browse files
committed
threads/t/stack* Generalize larger min stack sizes
This changes the tests so that they will work on systems that require larger minimum stack sizes than what we initially try. The initial test is skipped in this case, but the rest of the tests are adjusted from the new information. This was the least disruptive way I could come up with that didn't assume things worked correctly before running the tests, yet still adapted to a platform that has a larger minimum requirement than we guess. One could increase the initial guess to the maximum of any box found so far (this would mean doubling it in this case), but what happens if a larger case comes around?
1 parent 601bde6 commit 31898f8

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

dist/threads/t/stack.t

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,17 @@ ok(1, 1, 'Loaded');
5555

5656
### Start of Testing ###
5757

58-
is(2, threads->get_stack_size(), $size,
59-
'Stack size set in import');
58+
my $actual_size = threads->get_stack_size();
59+
60+
{
61+
if ($actual_size > $size) {
62+
print("ok 2 # skip because system needs larger minimum stack size\n");
63+
$size = $actual_size;
64+
}
65+
else {
66+
is(2, $actual_size, $size, 'Stack size set in import');
67+
}
68+
}
6069

6170
my $size_plus_quarter = $size * 1.25; # 128 frames map to 160
6271
is(3, threads->set_stack_size($size_plus_quarter), $size,

dist/threads/t/stack_env.t

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,17 @@ ok(1, 1, 'Loaded');
5757

5858
### Start of Testing ###
5959

60-
is(2, threads->get_stack_size(), $size,
61-
'$ENV{PERL5_ITHREADS_STACK_SIZE}');
60+
my $actual_size = threads->get_stack_size();
61+
62+
{
63+
if ($actual_size > $size) {
64+
print("ok 2 # skip because system needs larger minimum stack size\n");
65+
$size = $actual_size;
66+
}
67+
else {
68+
is(2, $actual_size, $size, '$ENV{PERL5_ITHREADS_STACK_SIZE}');
69+
}
70+
}
6271

6372
my $size_plus_eighth = $size * 1.125; # 128 frames map to 144
6473
is(3, threads->set_stack_size($size_plus_eighth), $size,

0 commit comments

Comments
 (0)