mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-20 13:11:34 +08:00
Add new IO functions
Related-To: NEO-5718 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
927c097b0e
commit
e0b5f2f7f7
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -13,11 +13,21 @@ fopenFuncPtr fopenPtr = &mockFopen;
|
||||
vfprintfFuncPtr vfprintfPtr = &mockVfptrinf;
|
||||
fcloseFuncPtr fclosePtr = &mockFclose;
|
||||
getenvFuncPtr getenvPtr = &mockGetenv;
|
||||
fseekFuncPtr fseekPtr = &mockFseek;
|
||||
ftellFuncPtr ftellPtr = &mockFtell;
|
||||
rewindFuncPtr rewindPtr = &mockRewind;
|
||||
freadFuncPtr freadPtr = &mockFread;
|
||||
|
||||
uint32_t mockFopenCalled = 0;
|
||||
uint32_t mockVfptrinfCalled = 0;
|
||||
uint32_t mockFcloseCalled = 0;
|
||||
uint32_t mockGetenvCalled = 0;
|
||||
uint32_t mockFseekCalled = 0;
|
||||
uint32_t mockFtellCalled = 0;
|
||||
long int mockFtellReturn = 0;
|
||||
uint32_t mockRewindCalled = 0;
|
||||
uint32_t mockFreadCalled = 0;
|
||||
size_t mockFreadReturn = 0;
|
||||
|
||||
std::unordered_map<std::string, std::string> *mockableEnvValues = nullptr;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -18,6 +18,12 @@ extern uint32_t mockFopenCalled;
|
||||
extern uint32_t mockVfptrinfCalled;
|
||||
extern uint32_t mockFcloseCalled;
|
||||
extern uint32_t mockGetenvCalled;
|
||||
extern uint32_t mockFseekCalled;
|
||||
extern uint32_t mockFtellCalled;
|
||||
extern long int mockFtellReturn;
|
||||
extern uint32_t mockRewindCalled;
|
||||
extern uint32_t mockFreadCalled;
|
||||
extern size_t mockFreadReturn;
|
||||
|
||||
extern std::unordered_map<std::string, std::string> *mockableEnvValues;
|
||||
|
||||
@ -44,5 +50,24 @@ inline char *mockGetenv(const char *name) noexcept {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline int mockFseek(FILE *stream, long int offset, int origin) {
|
||||
mockFseekCalled++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline long int mockFtell(FILE *stream) {
|
||||
mockFtellCalled++;
|
||||
return mockFtellReturn;
|
||||
}
|
||||
|
||||
inline void mockRewind(FILE *stream) {
|
||||
mockRewindCalled++;
|
||||
}
|
||||
|
||||
inline size_t mockFread(void *ptr, size_t size, size_t count, FILE *stream) {
|
||||
mockFreadCalled++;
|
||||
return mockFreadReturn;
|
||||
}
|
||||
|
||||
} // namespace IoFunctions
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user