[LLVM][SupportTests] Fix Windows build breakage

`MemoryBuffer::getOpenFile` take an OS file handle, not an int.
This commit is contained in:
Michael Spencer 2020-04-15 14:46:29 -07:00
parent d9e5691843
commit 18ee0fca8c
1 changed files with 7 additions and 2 deletions

View File

@ -398,9 +398,14 @@ TEST_F(MemoryBufferTest, mmapVolatileNoNull) {
// Create a file large enough to mmap. A 32KiB file should be enough.
for (unsigned i = 0; i < 0x1000; ++i)
OF << "01234567";
OF.flush();
OF.close();
auto MBOrError = MemoryBuffer::getOpenFile(FD, TestPath,
Expected<sys::fs::file_t> File = sys::fs::openNativeFileForRead(TestPath);
ASSERT_THAT_EXPECTED(File, Succeeded());
auto OnExit =
make_scope_exit([&] { ASSERT_NO_ERROR(sys::fs::closeFile(*File)); });
auto MBOrError = MemoryBuffer::getOpenFile(*File, TestPath,
/*FileSize=*/-1, /*RequiresNullTerminator=*/false, /*IsVolatile=*/true);
ASSERT_NO_ERROR(MBOrError.getError())
OwningBuffer MB = std::move(*MBOrError);