aboutsummaryrefslogtreecommitdiffstats
path: root/test/mock/syscall_io_mock.hpp
diff options
context:
space:
mode:
authorNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2022-07-21 07:14:31 +0900
committerNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2022-08-05 00:35:12 +0900
commitb0ed05f610e4bf70eae7929163e1ac8794bd15b0 (patch)
treefa0d21d6fec4e8b6c0393776afbabdb592e78c41 /test/mock/syscall_io_mock.hpp
parenteb7fddaec547c4c9d47cee77bd5419d34ab5f1df (diff)
Update test case
Ths patch update tase case Bug-AGL: SPEC-4500 Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp> Change-Id: I27b4a537d522198f5f180ce22fb7f0af95b3ddb8
Diffstat (limited to 'test/mock/syscall_io_mock.hpp')
-rw-r--r--test/mock/syscall_io_mock.hpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/mock/syscall_io_mock.hpp b/test/mock/syscall_io_mock.hpp
index 61e1840..6eb021a 100644
--- a/test/mock/syscall_io_mock.hpp
+++ b/test/mock/syscall_io_mock.hpp
@@ -5,6 +5,7 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <stdio.h>
/*
int open(const char *pathname, int flags);
@@ -28,10 +29,11 @@ static std::function<int(int)> _fsync;
/*
int unlink(const char *pathname);
int stat(const char *pathname, struct stat *buf);
+int rename(const char *oldpath, const char *newpath);
*/
static std::function<int(const char *)> _unlink;
static std::function<int(const char *pathname, struct stat *buf)> _stat;
-
+static std::function<int(const char *oldpath, const char *newpath)> _rename;
/*
int socket(int socket_family, int socket_type, int protocol);
@@ -73,6 +75,9 @@ public:
_stat = [this](const char *pathname, struct stat *buf) {
return stat(pathname, buf);
};
+ _rename = [this](const char *oldpath, const char *newpath){
+ return rename(oldpath, newpath);
+ };
_socket = [this](int socket_family, int socket_type, int protocol){
return socket(socket_family, socket_type, protocol);
@@ -100,6 +105,7 @@ public:
_unlink = {};
_stat = {};
+ _rename = {};
_socket = {};
_bind = {};
@@ -117,6 +123,7 @@ public:
MOCK_CONST_METHOD1(unlink, int(const char *));
MOCK_CONST_METHOD2(stat, int(const char *pathname, struct stat *buf));
+ MOCK_CONST_METHOD2(rename, int(const char *oldpath, const char *newpath));
MOCK_CONST_METHOD3(socket, int(int socket_family, int socket_type, int protocol));
MOCK_CONST_METHOD3(bind, int(int sockfd, const struct sockaddr *addr,socklen_t addrlen));
@@ -167,6 +174,11 @@ static int stat(const char *pathname, struct stat *buf)
return _stat(pathname, buf);
}
+static int rename(const char *oldpath, const char *newpath)
+{
+ return _rename(oldpath, newpath);
+}
+
static int socket(int socket_family, int socket_type, int protocol)
{
return _socket(socket_family, socket_type, protocol);