Improve coverage in Fs Access

- Added ULTS to improve the code coverage in fs_access.
- Used the shared functions in the ULTs.
- Added the function for pwrite in the shared code.
Related-To: LOCI-2117

Signed-off-by: Bari, Pratik <pratik.bari@intel.com>
This commit is contained in:
Bari, Pratik
2023-02-26 15:41:12 +00:00
committed by Compute-Runtime-Automation
parent 52f21464cd
commit b161af5886
6 changed files with 342 additions and 131 deletions

View File

@@ -55,6 +55,7 @@ uint32_t munmapFuncCalled = 0u;
int (*sysCallsOpen)(const char *pathname, int flags) = nullptr;
ssize_t (*sysCallsPread)(int fd, void *buf, size_t count, off_t offset) = nullptr;
ssize_t (*sysCallsPwrite)(int fd, const void *buf, size_t count, off_t offset) = nullptr;
int (*sysCallsReadlink)(const char *path, char *buf, size_t bufsize) = nullptr;
int (*sysCallsIoctl)(int fileDescriptor, unsigned long int request, void *arg) = nullptr;
int (*sysCallsPoll)(struct pollfd *pollFd, unsigned long int numberOfFds, int timeout) = nullptr;
@@ -189,6 +190,9 @@ ssize_t pread(int fd, void *buf, size_t count, off_t offset) {
}
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) {
if (sysCallsPwrite != nullptr) {
return sysCallsPwrite(fd, buf, count, offset);
}
pwriteFuncCalled++;
return 0;
}

View File

@@ -17,6 +17,7 @@ namespace SysCalls {
extern int (*sysCallsOpen)(const char *pathname, int flags);
extern ssize_t (*sysCallsPread)(int fd, void *buf, size_t count, off_t offset);
extern ssize_t (*sysCallsPwrite)(int fd, const void *buf, size_t count, off_t offset);
extern int (*sysCallsReadlink)(const char *path, char *buf, size_t bufsize);
extern int (*sysCallsIoctl)(int fileDescriptor, unsigned long int request, void *arg);
extern int (*sysCallsPoll)(struct pollfd *pollFd, unsigned long int numberOfFds, int timeout);