Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions libc/test/src/sys/mman/linux/mincore_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"

#include <unistd.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be the LLVM-libc sysconf.

Suggested change
#include <unistd.h>
#include "src/unistd/sysconf.h"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
using LlvmLibcMincoreTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;

// TODO: Replace with sysconf call once the function is properly implemented.
constexpr size_t PAGE_SIZE = 4096;
const size_t PAGE_SIZE = sysconf(_SC_PAGESIZE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to call the sysconf in the LLVM-libc namespace.

Suggested change
const size_t PAGE_SIZE = sysconf(_SC_PAGESIZE);
const size_t PAGE_SIZE = LIBC_NAMESPACE::sysconf(_SC_PAGESIZE);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine for tests, but just be aware that this changes the behavior to require a global constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I also figured that would be fine for tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


TEST_F(LlvmLibcMincoreTest, UnMappedMemory) {
unsigned char vec;
Expand Down
4 changes: 2 additions & 2 deletions libc/test/src/sys/mman/linux/mlock_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
#include "test/UnitTest/Test.h"

#include <sys/syscall.h>
#include <unistd.h>

// TODO: Replace with sysconf call once the function is properly implemented.
constexpr size_t PAGE_SIZE = 4096;
const size_t PAGE_SIZE = sysconf(_SC_PAGESIZE);

using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
using LlvmLibcMlockTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
Expand Down
5 changes: 3 additions & 2 deletions libc/test/src/sys/mman/linux/msync_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"

// TODO: Replace with sysconf call once the function is properly implemented.
constexpr size_t PAGE_SIZE = 4096;
#include <unistd.h>

const size_t PAGE_SIZE = sysconf(_SC_PAGESIZE);

using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
using LlvmLibcMsyncTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
Expand Down
4 changes: 2 additions & 2 deletions libc/test/src/sys/mman/linux/remap_file_pages_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

#include <sys/mman.h>
#include <sys/stat.h> // For S_IRWXU
#include <unistd.h>

// TODO: Replace with sysconf call once the function is properly implemented.
constexpr size_t PAGE_SIZE = 4096;
const size_t PAGE_SIZE = sysconf(_SC_PAGESIZE);

using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
Expand Down
Loading