libmpm

morphux C package management library
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/libmpm

commit f1310827b32cd6a1104bf3a344e021da557a96fc
parent 350ddf8609629c43ef1d01f9b1b0e985c67cc0b4
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Fri, 16 Jun 2017 12:19:53 +0200

Fix(Tests): Better coverage

Diffstat:
MMakefile | 2+-
Minc/packer.h | 11+++--------
Mtests/test_compile.c | 1+
3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile @@ -95,7 +95,7 @@ check: coverage: make -C lib/libmorphux/ test - $(MAKE) fclean all OFLAGS="-std=gnu99 -g -O0 -coverage -lcov -DCOMPILE_WITH_TEST" + $(MAKE) fclean all OFLAGS="-std=gnu99 -g -O0 -coverage -lcov -DCOMPILE_WITH_TEST -fno-inline" make -C tests coverage cd tests && ./test gcov -o src/ $(SRCS) diff --git a/inc/packer.h b/inc/packer.h @@ -160,17 +160,12 @@ static inline void packer_header_comp_free(packer_header_t *ptr) { if (ptr == NULL) return ; - if (ptr->compilation.configure != NULL) - list_free(ptr->compilation.configure, &vector_string_free); - - if (ptr->compilation.env != NULL) - list_free(ptr->compilation.env, &vector_string_free); - - ptr->compilation.env = NULL; - ptr->compilation.configure = NULL; + list_free(ptr->compilation.configure, &vector_string_free); + list_free(ptr->compilation.env, &vector_string_free); FREE(ptr->compilation.make); FREE(ptr->compilation.test); FREE(ptr->compilation.install); + packer_header_comp_init(ptr); } /*! diff --git a/tests/test_compile.c b/tests/test_compile.c @@ -9,6 +9,7 @@ TEST(init_compile) { packer_t *ptr; set_mkdir_fail(-1); + set_malloc_fail(-1); getcwd(g_old_pwd, sizeof(g_old_pwd)); recursive_delete(OUTPUT_DIR); ptr = packer_init_dir("packer/compilation/");