lib

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

commit 721c0d40859384b1617653e21057377959dcabf2
parent 32e4cc9970c7539017535cfd12a39458e4055b12
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Wed, 10 May 2017 16:54:51 +0200

Fix(Tests): Now creating file in Makefile

Diffstat:
Msrc/m_util.c | 8++++++--
Mtests/Makefile | 4++++
Dtests/test_dir_2/file_1 | 0
3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/m_util.c b/src/m_util.c @@ -33,7 +33,7 @@ bool recursive_delete(const char *dir) { case FTS_DNR: /* FALLTROUGH */ case FTS_ERR: - return false; + goto error; case FTS_DC: /* FALLTROUGH */ @@ -53,11 +53,15 @@ bool recursive_delete(const char *dir) { /* FALLTROUGH */ case FTS_DEFAULT: if (remove(curr->fts_accpath) < 0) - return false; + goto error; break; } } fts_close(ftsp); return true; + +error: + fts_close(ftsp); + return false; } diff --git a/tests/Makefile b/tests/Makefile @@ -18,10 +18,14 @@ $(NAME): $(OBJS) $(CC) $(CFLAGS) $(OBJS) -o $(NAME) -L../ $(LDFLAGS) check: $(NAME) + mkdir -p test_dir_2 && touch test_dir_2/file && chmod a-w test_dir_2 ./$(NAME) + chmod +w test_dir_2 && rm -rf test_dir_2 valgrind: $(NAME) + mkdir test_dir_2 && touch test_dir_2/file && chmod a-w test_dir_2 valgrind --leak-check=full --error-exitcode=1 ./$(NAME) + chmod +w test_dir_2 && rm -rf test_dir_2 coverage: $(MAKE) fclean all CFLAGS=$(COVFLAGS) diff --git a/tests/test_dir_2/file_1 b/tests/test_dir_2/file_1