From: Jeroen Dekkers <jeroen@dekkers.ch>
Date: Wed, 7 Dec 2011 21:11:45 +0100
Subject: make-check

---
 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 af8be35..9571607 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 5b22f55..2b36a42 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
+
+
+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 2dcaebd..5d3c49a 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
@@ -92,7 +94,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 f96e836..304843c 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 2d49a69..21e9922 100644
--- a/UI/WebServerResources/GNUmakefile
+++ b/UI/WebServerResources/GNUmakefile
@@ -17,6 +17,8 @@ install ::
 	  cp -r scriptaculous $(SOGO_WEBSERVERRESOURCESDIR)/; \
 	fi
 
+check ::
+
 clean ::
 
 distclean :: clean
-- 
