Skip to content

Commit 0eeecee

Browse files
committed
threads/t/stack*: Add comment
I noticed that the first real test in each of these could succeed by happenstance even if the implementation is broken. If the numbers we use happen to be the same as the system default, we'll get true even if the system ignored the request to use our numbers. Fixing the test is a chicken and egg problem, as to find out what the default value is requires using the functions the test files are trying to test. A unit could be added to Configure, but that seems too much work for just this purpose. The comments added by this commit suggest using an out-of-the-ordinary value instead of the power of 2 one that is currently used. That would minimize the likelihood of happenstance.
1 parent 31898f8 commit 0eeecee

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

dist/threads/t/stack.t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ BEGIN {
1212
exit(0);
1313
}
1414

15+
# XXX Note that if the default stack size happens to be the same as these
16+
# numbers, that test 2 would return success just out of happenstance.
17+
# This possibility could be lessened by choosing $frames to be something
18+
# less likely than a power of 2
19+
1520
$frame_size = 4096;
1621
$frames = 128;
1722
$size = $frames * $frame_size;

dist/threads/t/stack_env.t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ BEGIN {
4545
$| = 1;
4646
print("1..4\n"); ### Number of tests that will be run ###
4747

48+
# XXX Note that if the default stack size happens to be the same as these
49+
# numbers, that test 2 would return success just out of happenstance.
50+
# This possibility could be lessened by choosing $frames to be something
51+
# less likely than a power of 2
52+
4853
$frame_size = 4096;
4954
$frames = 128;
5055
$size = $frames * $frame_size;

0 commit comments

Comments
 (0)