Browse Source

[runtime] Move testing dll into profile

Alexander Kyte 8 years ago
parent
commit
a4edbde01e

+ 10 - 3
mcs/build/tests.make

@@ -94,8 +94,12 @@ endif
 
 test_assemblies :=
 
+test_lib_dir = $(topdir)/class/lib/$(PROFILE)/tests
+
+test_lib_output = $(topdir)/class/lib/$(PROFILE)/tests/$(test_lib)
+
 ifdef HAVE_CS_TESTS
-test_assemblies += $(test_lib)
+test_assemblies += $(test_lib_output)
 endif
 
 ifdef test_assemblies
@@ -183,7 +187,10 @@ endif
 
 ifdef HAVE_CS_TESTS
 
-$(test_lib): $(the_assembly) $(test_response) $(test_nunit_dep)
+$(test_lib_dir):
+	mkdir -p $@
+
+$(test_lib_output): $(the_assembly) $(test_response) $(test_nunit_dep) $(test_lib_dir)
 	$(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response)
 
 test_response_preprocessed = $(test_response)_preprocessed
@@ -203,7 +210,7 @@ $(test_makefrag): $(test_response)
 
 -include $(test_makefrag)
 
-build-test-lib: $(test_lib)
+build-test-lib: $(test_lib_output)
 	@echo Building testing lib
 
 endif

+ 1 - 1
mcs/class/Microsoft.Build.Utilities/Makefile

@@ -30,4 +30,4 @@ CLEAN_FILES += $(TEST_RESX_RESOURCES)
 $(TEST_RESX_RESOURCES): %.resources: %.resx
 	$(RESGEN) $< || cp [email protected] $@
 
-$(test_lib): $(TEST_RESX_RESOURCES)
+$(test_lib_output): $(TEST_RESX_RESOURCES) $(test_lib_dir)

+ 11 - 2
mcs/class/Microsoft.Build/Test/Microsoft.Build.Construction/ProjectRootElementTest.cs

@@ -30,8 +30,13 @@ namespace MonoTests.Microsoft.Build.Construction
 			var xml = XmlReader.Create (new StringReader (empty_project_xml), null, "file:///foo.xml");
 			// This creator does not fill FullPath...
 			var root = ProjectRootElement.Create (xml);
+
+			// Expected to run from mcs/class/lib/profile
+			var dir_name = Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath);
+			var namespace_path = Path.Combine (Directory.GetParent (dir_name).Parent.FullName, "Microsoft.Build");
+
 			Assert.IsNull (root.FullPath, "#2");
-			Assert.AreEqual (Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath), root.DirectoryPath, "#3");
+			Assert.AreEqual (namespace_path, root.DirectoryPath, "#3");
 		}
 
 		[Test]
@@ -39,7 +44,11 @@ namespace MonoTests.Microsoft.Build.Construction
 		{
 			var root = ProjectRootElement.Create ();
 			root.FullPath = "test" + Path.DirectorySeparatorChar + "foo.xml";
-			var full = Path.Combine (Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath), "test", "foo.xml");
+
+			// Expected to run from mcs/class/lib/profile
+			var dir_name = Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath);
+			var namespace_path = Path.Combine (Directory.GetParent (dir_name).Parent.FullName, "Microsoft.Build");
+			var full = Path.Combine (namespace_path, "test", "foo.xml");
 			Assert.AreEqual (full, root.FullPath, "#1");
 			Assert.AreEqual (Path.GetDirectoryName (full), root.DirectoryPath, "#1");
 		}

+ 5 - 0
mcs/class/System.ServiceModel/Test/MetadataTests/TestContext.cs

@@ -138,7 +138,10 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
 			if (!name.EndsWith (".xml"))
 				name = name + ".xml";
 			var uri = new Uri (asm.CodeBase);
+			// Run from mcs/class/lib/<profile>
 			var path = Path.GetDirectoryName (uri.AbsolutePath);
+			path = Directory.GetParent (path).Parent.FullName;
+			path = Path.Combine (path, "System.ServiceModel");
 			path = Path.Combine (path, "Test");
 			path = Path.Combine (path, "MetadataTests");
 			path = Path.Combine (path, "Resources");
@@ -172,6 +175,8 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
 				name = name + ".config";
 			var uri = new Uri (asm.CodeBase);
 			var path = Path.GetDirectoryName (uri.AbsolutePath);
+			path = Directory.GetParent (path).Parent.FullName;
+			path = Path.Combine (path, "System.ServiceModel");
 			path = Path.Combine (path, "Test");
 			path = Path.Combine (path, "MetadataTests");
 			path = Path.Combine (path, "Resources");

+ 4 - 6
mcs/class/System.Web/Test/System.Web.Caching/CacheItemPriorityQueueTest.cs

@@ -91,12 +91,10 @@ namespace MonoTests.System.Web.Caching
 
 		static CacheItemPriorityQueueTest ()
 		{
-			dataDir =
-				Path.Combine (
-					Path.Combine (
-						Path.Combine (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), "Test"),
-						"System.Web.Caching"),
-					DATA_DIR);
+			// Assumes this is compiled into mcs/class/lib/<profile>
+			string class_dir = Directory.GetParent (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location)).Parent.FullName;
+			string system_web_dir = Path.Combine (class_dir, "System.Web", "Test", "System.Web.Caching");
+			dataDir = Path.Combine (system_web_dir, DATA_DIR);
 		}
 		
 		void RunTest (string testsFileName, string listFileName)

+ 1 - 1
mcs/class/System/Makefile

@@ -177,7 +177,7 @@ $(the_libdir_base)System.Configuration.dll:
 
 $(build_lib): $(CYCLIC_DEP_FILES)
 
-$(test_lib): $(TEST_RESOURCES)
+$(test_lib_output): $(TEST_RESOURCES) $(test_lib_dir)
 
 CLEAN_FILES = $(test_lib).config $(bare_libdir)/System.dll $(secxml_libdir)/System.dll $(bare_libdir)/System.dll.mdb $(secxml_libdir)/System.dll.mdb
 

+ 1 - 1
mcs/class/corlib/Makefile

@@ -158,7 +158,7 @@ TEST_RESOURCES = $(TEST_RESX_RESOURCES) $(TEST_RESX_RESOURCES_SATELITE)
 satellite_assembly1 = es-ES/$(patsubst %.dll,%.resources.dll,$(test_lib))
 satellite_assembly2 = nn-NO/$(patsubst %.dll,%.resources.dll,$(test_lib))
 
-$(test_lib): $(TEST_RESOURCES) $(satellite_assembly1) $(satellite_assembly2) 
+$(test_lib_output): $(TEST_RESOURCES) $(satellite_assembly1) $(satellite_assembly2) $(test_lib_dir)
 
 $(satellite_assembly1): Test/resources/culture-es-ES.cs Test/resources/Resources.es-ES.resources
 	@mkdir -p es-ES

+ 3 - 1
mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs

@@ -1043,7 +1043,9 @@ namespace MonoTests.System.Text
 		[Category ("MobileNotWorking")]
 		public void Bug415628 ()
 		{
-			using (var f = File.Open (Path.Combine (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), "Test/resources/415628.bin"), FileMode.Open)) {
+			DirectoryInfo bcl_output_dir = Directory.GetParent (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location));
+			string namespace_dir = Path.Combine (bcl_output_dir.Parent.FullName, "corlib");
+			using (var f = File.Open (Path.Combine (namespace_dir, "Test/resources/415628.bin"), FileMode.Open)) {
 				BinaryReader br = new BinaryReader (f);
 				byte [] buf = br.ReadBytes (8000);
 				Encoding.UTF8.GetString(buf);