[gbrainy] No need to copy assemblies to execute unit tests



commit ce768e85416da215d67554741f1d779c5c87b938
Author: Jordi Mas <jmas softcatala org>
Date:   Fri Mar 18 08:21:49 2011 +0100

    No need to copy assemblies to execute unit tests

 tests/Makefile.am                    |   15 +++++----------
 tests/TestSupport/UnitTestSupport.cs |    7 ++++++-
 tools/Makefile.am                    |    4 +++-
 3 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c3d7fbd..32cf024 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -30,18 +30,13 @@ if ENABLE_TESTS
 ASSEMBLIES = \
 	$(NUNIT_LIBS)			\
 	$(MONO_ADDINS_LIBS)		\
-	-r:gbrainy.Core.dll	\
-	-r:gbrainy.exe
+	-r:$(top_builddir)/src/gbrainy.Core.dll	\
+	-r:$(top_builddir)/src/gbrainy.exe
 
-MONO_PATH = .:$(top_builddir)/src:
+MONO_PATH = $(top_builddir)/src
 
 RESSOURCES =
 
-COPY_FILES:
-	cp ../src/gbrainy.Core.dll .
-	cp ../src/gbrainy.exe .
-	cp ../src/gbrainy.Games.dll .
-
 $(CORE): $(CSFILES_CORE) $(top_builddir)/src/gbrainy.exe
 	$(CSC) -out:$@ $(CSFLAGS) $(CSFILES_CORE) $(ASSEMBLIES) $(RESSOURCES)
 
@@ -51,9 +46,9 @@ $(CLASSICAL): $(CSFILES_CLASSICAL) $(top_builddir)/src/gbrainy.exe
 $(GAMES): $(CSFILES_GAMES) $(top_builddir)/src/gbrainy.exe
 	$(CSC) -out:$@ $(CSFLAGS) $(CSFILES_GAMES) $(ASSEMBLIES) -r:../src/gbrainy.Games.dll $(RESSOURCES)
 
-all: COPY_FILES $(CORE) $(CLASSICAL) $(GAMES)
+all: $(CORE) $(CLASSICAL) $(GAMES)
 
-run: COPY_FILES $(CORE) $(CLASSICAL) $(GAMES)
+run: $(CORE) $(CLASSICAL) $(GAMES)
 	MONO_PATH=$(MONO_PATH) $(NUNIT) $(CLASSICAL) -nologo
 	MONO_PATH=$(MONO_PATH) $(NUNIT) $(CORE) -nologo
 	MONO_PATH=$(MONO_PATH) $(NUNIT) $(GAMES) -nologo
diff --git a/tests/TestSupport/UnitTestSupport.cs b/tests/TestSupport/UnitTestSupport.cs
index 90d7535..e83ef1a 100644
--- a/tests/TestSupport/UnitTestSupport.cs
+++ b/tests/TestSupport/UnitTestSupport.cs
@@ -33,8 +33,13 @@ namespace gbrainyTest
 			ServiceLocator.Instance.RegisterService <ITranslations> (new TranslationsCatalog ());
 			ServiceLocator.Instance.RegisterService <IConfiguration> (new MemoryConfiguration ());
 
+			string mono_path = Environment.GetEnvironmentVariable ("MONO_PATH");
+
+			if (String.IsNullOrEmpty (mono_path))
+				throw new InvalidOperationException ("Use MONO_PATH enviroment variable to specify the location of the assemblies");
+
 			// Configuration
-			ServiceLocator.Instance.GetService <IConfiguration> ().Set (ConfigurationKeys.AssembliesDir, ".");
+			ServiceLocator.Instance.GetService <IConfiguration> ().Set (ConfigurationKeys.AssembliesDir, mono_path);
 		}
 	}
 }
diff --git a/tools/Makefile.am b/tools/Makefile.am
index a379e69..a968d4c 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -12,9 +12,11 @@ ASSEMBLIES = \
 	-r:../src/gbrainy.Core.dll	\
 	-r:Mono.Posix
 
+MONO_PATH = .:$(top_builddir)/src:
+
 GameXmlToGetString.exe: $(GAMESXMLSTRINGS_CSFILES) ../data/games.xml $(srcdir)/GameXmlGetStringTemplate.cs
 		   $(CSC) -target:winexe -out:$@ $(EXTRAFLAGS) $(GAMESXMLSTRINGS_CSFILES) $(ASSEMBLIES)
-		   export MONO_PATH=../src && $(MONO) $@ $(srcdir)
+		   export MONO_PATH=$(MONO_PATH) && $(MONO) $@ $(srcdir)
 
 TranslationsChecker.exe: $(TRANSLATIONSCHECKER_CSFILES)
 		   $(CSC) -target:winexe -out:$@ $(EXTRAFLAGS) $(TRANSLATIONSCHECKER_CSFILES) $(ASSEMBLIES)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]