root/lib/common/mock_private.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright 2021-2022 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * This source code is licensed under the GNU Lesser General Public License
   7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #ifndef MOCK_PRIVATE__H
  11 #  define MOCK_PRIVATE__H
  12 
  13 #include <pwd.h>
  14 #include <stdbool.h>
  15 #include <stdio.h>
  16 #include <stdlib.h>
  17 #include <string.h>
  18 #include <sys/types.h>
  19 #include <sys/utsname.h>
  20 #include <unistd.h>
  21 #include <grp.h>
  22 
  23 /* This header is for the sole use of libcrmcommon_test and unit tests */
  24 
  25 extern bool pcmk__mock_calloc;
  26 void *__real_calloc(size_t nmemb, size_t size);
  27 void *__wrap_calloc(size_t nmemb, size_t size);
  28 
  29 extern bool pcmk__mock_fopen;
  30 FILE *__real_fopen(const char *pathname, const char *mode);
  31 FILE *__wrap_fopen(const char *pathname, const char *mode);
  32 
  33 extern bool pcmk__mock_getenv;
  34 char *__real_getenv(const char *name);
  35 char *__wrap_getenv(const char *name);
  36 
  37 extern bool pcmk__mock_setenv;
  38 int __real_setenv(const char *name, const char *value, int overwrite);
  39 int __wrap_setenv(const char *name, const char *value, int overwrite);
  40 
  41 extern bool pcmk__mock_unsetenv;
  42 int __real_unsetenv(const char *name);
  43 int __wrap_unsetenv(const char *name);
  44 
  45 extern bool pcmk__mock_getpid;
  46 pid_t __real_getpid(void);
  47 pid_t __wrap_getpid(void);
  48 
  49 extern bool pcmk__mock_grent;
  50 void __real_setgrent(void);
  51 void __wrap_setgrent(void);
  52 struct group * __wrap_getgrent(void);
  53 struct group * __real_getgrent(void);
  54 void __wrap_endgrent(void);
  55 void __real_endgrent(void);
  56 
  57 extern bool pcmk__mock_getpwnam_r;
  58 int __real_getpwnam_r(const char *name, struct passwd *pwd,
  59                       char *buf, size_t buflen, struct passwd **result);
  60 int __wrap_getpwnam_r(const char *name, struct passwd *pwd,
  61                       char *buf, size_t buflen, struct passwd **result);
  62 
  63 extern bool pcmk__mock_readlink;
  64 ssize_t __real_readlink(const char *restrict path, char *restrict buf,
  65                         size_t bufsize);
  66 ssize_t __wrap_readlink(const char *restrict path, char *restrict buf,
  67                         size_t bufsize);
  68 
  69 extern bool pcmk__mock_strdup;
  70 char *__real_strdup(const char *s);
  71 char *__wrap_strdup(const char *s);
  72 
  73 extern bool pcmk__mock_uname;
  74 int __real_uname(struct utsname *buf);
  75 int __wrap_uname(struct utsname *buf);
  76 
  77 #endif  // MOCK_PRIVATE__H

/* [previous][next][first][last][top][bottom][index][help] */