lib

morphux C utility library
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/lib

commit 7d9d0a5d666cd45cc51f124d0f69e9dac7eeeb81
parent d27f2da424778fac5713df80605dabe1711181d2
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Sun, 28 May 2017 18:50:04 +0200

Add(Mockup): Add mockup call for chdir(2)

Diffstat:
Minc/fail_test.h | 2++
Msrc/test.c | 4++++
2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/inc/fail_test.h b/inc/fail_test.h @@ -32,6 +32,7 @@ # define strcat(dst, src) fl_strcat(dst, src) # define mkdir(path, mode) fl_mkdir(path, mode) # define fork fl_fork +# define chdir fl_chdir # define MOCK_SET_DECL(fn_name, type, ...) \ void set_##fn_name##_fail(int val); \ @@ -49,6 +50,7 @@ MOCK_SET_DECL(strcpy, char *, char *, const char *); MOCK_SET_DECL(strcat, char *, char *, const char *); MOCK_SET_DECL(mkdir, int, const char *, mode_t); MOCK_SET_DECL(fork, pid_t); +MOCK_SET_DECL(chdir, int, const char *); # endif /* M_FAIL_TEST_H */ #endif /* COMPILE_WITH_TEST */ diff --git a/src/test.c b/src/test.c @@ -92,4 +92,8 @@ MOCK_SET_IMP(fork, pid_t, -1) { MOCK_REAL_CALL(fork); } +MOCK_SET_IMP(chdir, int, -1, const char *path) { + MOCK_REAL_CALL(chdir, path); +} + #endif /* COMPILE_WITH_TEST */