Skip to content

Commit

Permalink
freelist: Fix unit test initialization
Browse files Browse the repository at this point in the history
The freelist and scheduler unit tests were recently broken by
the change to freelist to allocate page-size boundary regions
when growing.  Fix the unit tests by specifying the system page
size (which is initialized during the core init function).

This is really a temporary fix, but we need to do some refactoring
of the code base to better handle unit testing.  Until we do that,
this works well enough.

Signed-off-by: Brian Barrett <[email protected]>
(cherry picked from commit ff843c6)
  • Loading branch information
bwbarrett committed Aug 23, 2023
1 parent ad6a3c1 commit a7949c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/unit/freelist.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ int regmr_simple(void *opaque, void *data, size_t size, void **handle)
simple_base = data;
simple_size = size;

if (size % system_page_size != 0) {
return ncclSystemError;
}

return ncclSuccess;
}

Expand Down Expand Up @@ -47,6 +51,7 @@ int main(int argc, char *argv[])
int ret;
size_t i;

system_page_size = 4096;
ofi_log_function = logger;

/* initial size larger than max size */
Expand Down
1 change: 1 addition & 0 deletions tests/unit/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ int main(int argc, char *argv[])
{
int ret = 0;
ofi_log_function = logger;
system_page_size = 4096;

ret = test_multiplexing_schedule() || test_threshold_scheduler();

Expand Down

0 comments on commit a7949c6

Please sign in to comment.