From a632c82b59bdc6ea73d772101684d2dae0476f9e Mon Sep 17 00:00:00 2001 From: Jeroen Dekkers Date: Fri, 19 Oct 2012 18:46:46 +0200 Subject: [PATCH] Implement a "make check" target that will run the unit tests --- GNUmakefile | 4 +++- Tests/Unit/GNUmakefile | 12 +++++++++--- Tests/Unit/SOGoTestRunner.m | 4 +++- UI/Templates/GNUmakefile | 2 ++ UI/WebServerResources/GNUmakefile | 2 ++ 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index af8be3570..957160740 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -10,6 +10,8 @@ SUBPROJECTS = \ SoObjects \ Main \ UI \ - Tools + Tools \ + Tests/Unit \ + include $(GNUSTEP_MAKEFILES)/aggregate.make diff --git a/Tests/Unit/GNUmakefile b/Tests/Unit/GNUmakefile index 5b22f55b0..6c54a1904 100644 --- a/Tests/Unit/GNUmakefile +++ b/Tests/Unit/GNUmakefile @@ -27,11 +27,17 @@ $(TEST_TOOL)_OBJC_FILES += \ TEST_TOOL_NAME = $(TEST_TOOL) -TEST_TOOL_CPPFLAGS += \ - -Wall -D_GNU_SOURCE -I../SOPE/ -I../SoObjects/ -I../UI/ +$(TEST_TOOL)_CPPFLAGS += \ + -Wall -D_GNU_SOURCE -I../../SOPE/ -I../../SoObjects/ -I../../UI/ ADDITIONAL_LIB_DIRS += \ - -L../SoObjects/SOGo -lSOGo -lNGMime -lNGCards -lGDLContentStore -lNGExtensions -lSBJson -lobjc -L/usr/local/lib -lSaxObjC + -L../../SoObjects/SOGo/SOGo.framework/Versions/Current -L../../SOPE/NGCards/obj -L../../SOPE/GDLContentStore/obj -lSOGo -lNGMime -lNGCards -lGDLContentStore -lNGExtensions -lSBJson -lobjc \ + -L/usr/local/lib -lSaxObjC \ + -Wl,-rpath,../../SoObjects/SOGo/SOGo.framework/Versions/Current -Wl,-rpath,../../SOPE/NGCards/obj -Wl,-rpath,../../SOPE/GDLContentStore/obj -Wl,-rpath,../../OGoContentStore/obj +ADDITIONAL_LDFLAGS += -Wl,--no-as-needed + +check :: + ./obj/sogo-tests -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/test-tool.make diff --git a/Tests/Unit/SOGoTestRunner.m b/Tests/Unit/SOGoTestRunner.m index 7d6637c92..721d3e2d2 100644 --- a/Tests/Unit/SOGoTestRunner.m +++ b/Tests/Unit/SOGoTestRunner.m @@ -31,6 +31,8 @@ #import "SOGoTestRunner.h" +#define EXPECTED_FAILURES 3 + @implementation SOGoTestRunner + (SOGoTestRunner *) testRunner @@ -89,7 +91,7 @@ [allTestClasses autorelease]; [self autorelease]; - return rc; + return (failuresCount + errorsCount != EXPECTED_FAILURES); } - (void) incrementTestCounter: (SOGoTestFailureCode) failureCode diff --git a/UI/Templates/GNUmakefile b/UI/Templates/GNUmakefile index f96e836d9..304843ce4 100644 --- a/UI/Templates/GNUmakefile +++ b/UI/Templates/GNUmakefile @@ -35,6 +35,8 @@ install :: tar cf - $(WOXS) | ( cd $(SOGO_TEMPLATESDIR); tar xf -) ;\ fi +check :: + clean :: distclean :: clean diff --git a/UI/WebServerResources/GNUmakefile b/UI/WebServerResources/GNUmakefile index 4002194d7..6ed0e4083 100644 --- a/UI/WebServerResources/GNUmakefile +++ b/UI/WebServerResources/GNUmakefile @@ -16,6 +16,8 @@ install :: rm -rf $(SOGO_WEBSERVERRESOURCESDIR)/ckeditor/_source; \ fi +check :: + clean :: distclean :: clean