Skip to content

Commit

Permalink
Fix hardcoded page size in test (#2276)
Browse files Browse the repository at this point in the history
Summary:
This test segfaults on Nvidia's grace cpus since the page size for them is 64kb. Replacing the hardcoded value fixes the issue.

Pull Request resolved: #2276

Reviewed By: yfeldblum

Differential Revision: D60919932

Pulled By: Orvid

fbshipit-source-id: 346c9441f92f20f2a01aff0443e3d89e9fcb251c
  • Loading branch information
yashssh authored and facebook-github-bot committed Aug 16, 2024
1 parent 4b65742 commit a2aae6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions folly/test/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,7 @@ cpp_unittest(
"//folly/portability:gmock",
"//folly/portability:gtest",
"//folly/portability:sys_mman",
"//folly/portability:unistd",
],
external_deps = [
("boost", None, "boost_algorithm"),
Expand Down
3 changes: 2 additions & 1 deletion folly/test/RangeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <folly/portability/GMock.h>
#include <folly/portability/GTest.h>
#include <folly/portability/SysMman.h>
#include <folly/portability/Unistd.h>

#if __has_include(<range/v3/range/concepts.hpp>)
#include <range/v3/range/concepts.hpp>
Expand Down Expand Up @@ -1052,7 +1053,7 @@ TYPED_TEST(NeedleFinderTest, Base) {
}
}

const size_t kPageSize = 4096;
const size_t kPageSize = sysconf(_SC_PAGESIZE);
// Updates contents so that any read accesses past the last byte will
// cause a SIGSEGV. It accomplishes this by changing access to the page that
// begins immediately after the end of the contents (as allocators and mmap()
Expand Down

0 comments on commit a2aae6d

Please sign in to comment.