[runtime] Move testing dll into profile
authorAlexander Kyte <alexmkyte@gmail.com>
Wed, 7 Jun 2017 18:44:36 +0000 (14:44 -0400)
committerAlexander Kyte <alexmkyte@gmail.com>
Wed, 30 Aug 2017 16:54:47 +0000 (12:54 -0400)
mcs/build/tests.make
mcs/class/Microsoft.Build.Utilities/Makefile
mcs/class/Microsoft.Build/Test/Microsoft.Build.Construction/ProjectRootElementTest.cs
mcs/class/System.ServiceModel/Test/MetadataTests/TestContext.cs
mcs/class/System.Web/Test/System.Web.Caching/CacheItemPriorityQueueTest.cs
mcs/class/System/Makefile
mcs/class/corlib/Makefile
mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs

index f5c4f99070f6d88cdde8baaf7ce58b9726d13215..e0c0e50a69aff2060ae6f237cabc6f2c701a4175 100644 (file)
@@ -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
index 0a3f0d2ed47662454ee613193dc5b4fda871d8dd..7d4f990ef8e9627fa6d8398a450d8a0949aceb31 100644 (file)
@@ -30,4 +30,4 @@ CLEAN_FILES += $(TEST_RESX_RESOURCES)
 $(TEST_RESX_RESOURCES): %.resources: %.resx
        $(RESGEN) $< || cp $@.prebuilt $@
 
-$(test_lib): $(TEST_RESX_RESOURCES)
+$(test_lib_output): $(TEST_RESX_RESOURCES) $(test_lib_dir)
index 2fbb9f18587853bd786d5125f7e73cd2a2a68e7f..8a0a2991f24c5a0a7ae7df315f2bc8d360d7ae98 100644 (file)
@@ -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");
                }
index be7bdb27bd4c38f11b01338b219fe558f010a61d..fb0e2b3609e201b2fe70420c7dbcc0bb8e867e8f 100644 (file)
@@ -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");
index b9754e7e84ae71fc7f1fe99212851ee93e7d3546..3e1c6d2e5d4ee69f228291c9a52fc90fd40b3618 100644 (file)
@@ -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)
index 7a7647521db988500f37329a3f74d10eabcbccab..125abbda448ba1e2743967728e9f4f89ecc00b2b 100644 (file)
@@ -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
 
index 131443e8c2ed2c8efab728dc5f46080af5bf745a..8a0453f6e7954f5b971602f6cbe9eab18042b180 100644 (file)
@@ -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
index 12de999dc5b6372937898c66fdfa1c8d7805b088..c073cb546aea8cdca6e51b8864fb6ac3c5bab911 100644 (file)
@@ -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);