diff --git a/configure.ac b/configure.ac index 78a1d71..49c7047 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT( [https://github.com/pampanic/pam_panic/issues], [pam_panic]) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE([-Wall]) +AM_INIT_AUTOMAKE([-Wall subdir-objects]) AC_PREREQ([2.69]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER([src/config.h]) diff --git a/src/pam_panic/pam_panic_authdevice.c b/src/pam_panic/pam_panic_authdevice.c index 2a014db..94386f5 100644 --- a/src/pam_panic/pam_panic_authdevice.c +++ b/src/pam_panic/pam_panic_authdevice.c @@ -8,10 +8,8 @@ LICENSE : GNU-GPLv3 #include #include -#ifndef TEST - #include - #include -#endif +#include +#include #include #include "pam_panic_reject.h" diff --git a/test/Makefile.am b/test/Makefile.am index 704c182..909ca98 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,3 +1,4 @@ +CFLAGS += -DTEST bin_PROGRAMS = test test_SOURCES = test.h ../src/pam_panic/pam_panic_authdevice.c ../src/pam_panic/pam_panic_reject.c test.c test_LDFLAGS = -lpam -lcunit @@ -5,4 +6,3 @@ test_LDFLAGS = -lpam -lcunit all: @printf "Running test...\n" ./test - @printf "OK!\n" diff --git a/test/test.c b/test/test.c index fd941f3..85cd565 100644 --- a/test/test.c +++ b/test/test.c @@ -4,7 +4,7 @@ #include "../src/pam_panic/pam_panic_authdevice.h" #include "../src/pam_panic/pam_panic_reject.h" #include - +#include #define STATE_GOOD 0 #define STATE_BAD 99 @@ -36,6 +36,7 @@ void test_authDeviceGood(void) { fclose(f); int ret = authDevice(NULL, gU, bU, NULL, 0, 0, 0); + printf("%d\n", ret); CU_ASSERT_EQUAL(ret, STATE_GOOD); unlink(gU); } @@ -81,7 +82,7 @@ void test_rejectNA(void) { int main(void) { // no stdout buffering - setbuf(stdout, NULL); + //setbuf(stdout, NULL); // init CUnit test registry CU_pSuite pSuiteDevice = NULL; @@ -112,6 +113,17 @@ int main(void) { return CU_get_error(); } - return 0; + /* Run all tests */ + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_basic_run_tests(); + + int fail = CU_get_number_of_failures(); + + CU_cleanup_registry(); + + if(fail) + return 1; + + return CU_get_error(); }