mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 02:09:24 +01:00
Make get_total_system_memory mockable.
This patch makes get_total_system_memory mockable, which allows us to alter the return value of the function in tests. See: https://bugs.torproject.org/24782
This commit is contained in:
parent
0803d79f55
commit
bd42367a1e
@ -3409,8 +3409,8 @@ get_total_system_memory_impl(void)
|
||||
* Try to find out how much physical memory the system has. On success,
|
||||
* return 0 and set *<b>mem_out</b> to that value. On failure, return -1.
|
||||
*/
|
||||
int
|
||||
get_total_system_memory(size_t *mem_out)
|
||||
MOCK_IMPL(int,
|
||||
get_total_system_memory, (size_t *mem_out))
|
||||
{
|
||||
static size_t mem_cached=0;
|
||||
uint64_t m = get_total_system_memory_impl();
|
||||
|
@ -699,7 +699,7 @@ char *make_path_absolute(char *fname);
|
||||
|
||||
char **get_environment(void);
|
||||
|
||||
int get_total_system_memory(size_t *mem_out);
|
||||
MOCK_DECL(int, get_total_system_memory, (size_t *mem_out));
|
||||
|
||||
int compute_num_cpus(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user