1
0
Fork 0

fix tests

This commit is contained in:
Andrey Abramov 2019-11-22 10:00:37 +03:00
parent b56908d4fc
commit 70283adda5
2 changed files with 7 additions and 5 deletions

View File

@ -29,7 +29,7 @@
#include <functional>
#include <fcntl.h> // open/_wopen
#ifdef _WIN32
#ifdef _WIN32
#include <tchar.h>
#include <io.h> // _close
#define file_blksize_t uint32_t // DWORD (same as GetDriveGeometry(...) DISK_GEOMETRY::BytesPerSector)
@ -45,20 +45,21 @@
#define file_stat _wstat64
#define handle_cast(f) f
#define IR_WSTR(x) L ## x // cannot use _T(...) macro when _MBCS is defined
#define IR_DEVNULL IR_WSTR("NUL:")
#define IR_FADVICE_NORMAL 0
#define IR_FADVICE_SEQUENTIAL FILE_FLAG_SEQUENTIAL_SCAN
#define IR_FADVICE_RANDOM FILE_FLAG_RANDOM_ACCESS
#define IR_FADVICE_DONTNEED 0
#define IR_FADVICE_NOREUSE 0
#define IR_WSTR(x) L ## x // cannot use _T(...) macro when _MBCS is defined
#else
#include <unistd.h> // close
#include <sys/types.h> // for blksize_t
#define file_blksize_t blksize_t
#define file_path_delimiter '/'
#define file_path_t char*
#define file_stat_t struct stat
#define file_stat_t struct stat
#define file_stat stat
#define file_fstat fstat
@ -67,6 +68,7 @@
#define posix_close close
#define handle_cast(f) static_cast<int>(reinterpret_cast<size_t>(f))
#define IR_DEVNULL "/dev/null"
#ifndef __APPLE__
#define IR_FADVICE_NORMAL POSIX_FADV_NORMAL
#define IR_FADVICE_SEQUENTIAL POSIX_FADV_SEQUENTIAL

View File

@ -86,8 +86,8 @@ int EndpointMock::port() const {
#ifndef _WIN32
GeneralClientConnectionMock::GeneralClientConnectionMock()
: GeneralClientConnection(&endpoint, 0, 0, 0),
nil(file_open((const file_path_t)nullptr, "rw")) {
_socket.fileDescriptor = file_no(nil.get()); // must be a readable/writable descriptor
nil(irs::file_utils::open(IR_DEVNULL, irs::file_utils::OpenMode::Write, 0)) {
_socket.fileDescriptor = handle_cast(nil.get()); // must be a readable/writable descriptor
}
#else
GeneralClientConnectionMock::GeneralClientConnectionMock()