Skip to content

Commit 7801ffd

Browse files
authored
Merge pull request #6 from bonachea/test-seg-validate
Fix bug4821 - Some tests request an incorrectly large segment size
2 parents 2f91d00 + dac4844 commit 7801ffd

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎ChangeLog‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ GASNet-EX ChangeLog
2424

2525
* Notable bugs fixed in this release: (details at https://gasnet-bugs.lbl.gov)
2626
- bug4811 - ofi: startup crashes with --enable-segment-everything
27+
- bug4821 - Some tests request an incorrectly large segment size
2728

2829
----------------------------------------------------------------------
2930
2025-08-28: GASNet-EX 2025.8.0

‎tests/test.h‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,9 +1015,21 @@ static size_t test_num_am_handlers = 0;
10151015
* Wrap gasnet_attach() or gex_Segment_Attach() to validate
10161016
* the allocated segment size, alignment, etc.
10171017
*/
1018+
static void _test_validate_seg_request(uintptr_t length) {
1019+
assert_always(length > 0);
1020+
assert_always(((uintptr_t)length) % PAGESZ == 0);
1021+
uintptr_t max_local = gasnet_getMaxLocalSegmentSize();
1022+
if (length > max_local) {
1023+
FATALERR("Test requested a GASNet segment of size=%lu, "
1024+
"but this exceeds the currently available gasnet_getMaxLocalSegmentSize()=%lu.\n"
1025+
"You may need to adjust the memory resource limits of this system/shell, "
1026+
"otherwise adjust test parameters to reduce segment utilization requirements.",
1027+
(unsigned long)length, (unsigned long)max_local);
1028+
}
1029+
}
10181030
#ifdef _INCLUDED_GASNET_H
1019-
static int _test_attach(gasnet_handlerentry_t *table, int numentries, uintptr_t segsize, uintptr_t minheapoffset)
1020-
{
1031+
static int _test_attach(gasnet_handlerentry_t *table, int numentries, uintptr_t segsize, uintptr_t minheapoffset) {
1032+
_test_validate_seg_request(segsize);
10211033
GASNET_Safe(gasnet_attach(table, numentries, segsize, minheapoffset));
10221034
gex_Rank_t i;
10231035
gasnet_seginfo_t *s = (gasnet_seginfo_t *)test_malloc(TEST_PROCS*sizeof(gasnet_seginfo_t));
@@ -1039,8 +1051,8 @@ static size_t test_num_am_handlers = 0;
10391051
static int _test_Segment_Attach(
10401052
gex_Segment_t *segment_p,
10411053
gex_TM_t tm,
1042-
uintptr_t length)
1043-
{
1054+
uintptr_t length) {
1055+
_test_validate_seg_request(length);
10441056
GASNET_Safe(gex_Segment_Attach(segment_p, tm, length));
10451057
BARRIER();
10461058
for (gex_Rank_t i=0; i < TEST_PROCS; i++) {

0 commit comments

Comments
 (0)