diff options
author | Marek Safar <marek.safar@gmail.com> | 2018-02-23 13:41:41 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2018-02-26 13:52:12 +0300 |
commit | 0129c25e435841fea84672dcdec608da643b93b1 (patch) | |
tree | 1c29d7540c579361a6b9b55f23b7f3f8f8496a53 | |
parent | 335ca28eaf91b157420e22cfdbecb98884172a56 (diff) |
[tests] Use RemoteExecutor from corefx
-rw-r--r-- | mcs/build/config-default.make | 3 | ||||
-rw-r--r-- | mcs/build/tests.make | 18 | ||||
-rw-r--r-- | mcs/class/System.Data/Makefile | 2 | ||||
-rw-r--r-- | mcs/class/System.Runtime.Remoting/Makefile | 2 | ||||
-rw-r--r-- | mcs/class/corlib/Makefile | 3 | ||||
-rw-r--r-- | mcs/class/test-helpers/RemoteExecutorConsoleApp.cs | 49 | ||||
-rw-r--r-- | mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs | 5 |
7 files changed, 18 insertions, 64 deletions
diff --git a/mcs/build/config-default.make b/mcs/build/config-default.make index 124aafcecf7..f9d2f21212a 100644 --- a/mcs/build/config-default.make +++ b/mcs/build/config-default.make @@ -34,7 +34,8 @@ sysconfdir = $(prefix)/etc RUNTIME = false MONO_PATH_TOP = $(topdir)/class/lib/$(PROFILE_DIRECTORY)/ MONO_PATH_TESTS = $(MONO_PATH_TOP)/tests -TEST_RUNTIME = MONO_PATH="$(MONO_PATH_TOP)$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$(MONO_PATH_TESTS)$(PLATFORM_PATH_SEPARATOR).$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug +TEST_MONO_PATH = $(MONO_PATH_TOP)$(PLATFORM_PATH_SEPARATOR)$(MONO_PATH_TESTS) +TEST_RUNTIME = MONO_PATH="$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR).$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug # In case you want to add MCS_FLAGS, this lets you not have to # keep track of the default value diff --git a/mcs/build/tests.make b/mcs/build/tests.make index a3592ff80ab..90d473378c6 100644 --- a/mcs/build/tests.make +++ b/mcs/build/tests.make @@ -25,8 +25,13 @@ xunit_deps := System.Runtime xunit_src := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttribute.cs BenchmarkDiscover.cs) $(topdir)/../mcs/class/test-helpers/PlatformDetection.cs ifeq ($(USE_XTEST_REMOTE_EXECUTOR), YES) -XTEST_REMOTE_EXECUTOR = $(xunit_test_lib)_RemoteExecuter.exe -xunit_src += $(topdir)/../mcs/class/test-helpers/AdminHelper.cs $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs $(topdir)/../external/corefx/src/Common/src/System/PasteArguments.cs +XTEST_REMOTE_EXECUTOR = $(topdir)/class/lib/$(PROFILE)/RemoteExecutorConsoleApp.exe +xunit_src += $(topdir)/../mcs/class/test-helpers/AdminHelper.cs \ +$(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs \ +$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs \ +$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs \ +$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs \ +$(topdir)/../external/corefx/src/Common/src/System/PasteArguments.cs endif xunit_class_deps := @@ -259,10 +264,11 @@ endif ifdef HAVE_CS_XTESTS -XTEST_HARNESS_PATH = $(topdir)/../external/xunit-binaries +XTEST_HARNESS_PATH := $(topdir)/../external/xunit-binaries XTEST_HARNESS = $(XTEST_HARNESS_PATH)/xunit.console.exe XTEST_HARNESS_FLAGS := -noappdomain -noshadow -parallel none -nunit TestResult-$(PROFILE)-xunit.xml XTEST_TRAIT := -notrait category=failing -notrait category=nonmonotests -notrait Benchmark=true -notrait category=outerloop +TEST_MONO_PATH := $(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$(XTEST_HARNESS_PATH) ifdef FIXTURE XTEST_HARNESS_FLAGS += -class $(FIXTURE) @@ -284,13 +290,13 @@ run-xunit-test-local: run-xunit-test-lib run-xunit-test-lib: xunit-test-local $(XTEST_REMOTE_EXECUTOR) @cp -rf $(XTEST_HARNESS_PATH)/xunit.execution.desktop.dll xunit.execution.desktop.dll ok=:; \ - PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(XTEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(XTEST_HARNESS) $(xunit_test_lib) $(XTEST_HARNESS_FLAGS) $(XTEST_TRAIT) || ok=false; \ + PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" REMOTE_EXECUTOR=$(XTEST_REMOTE_EXECUTOR) $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(XTEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(XTEST_HARNESS) $(xunit_test_lib) $(XTEST_HARNESS_FLAGS) $(XTEST_TRAIT) || ok=false; \ $$ok @rm -f xunit.execution.desktop.dll # Some xunit tests want to be executed in a separate process (see RemoteExecutorTestBase) -$(XTEST_REMOTE_EXECUTOR): $(topdir)/../mcs/class/test-helpers/RemoteExecutorConsoleApp.cs - $(TEST_COMPILE) $(topdir)/../mcs/class/test-helpers/RemoteExecutorConsoleApp.cs -r:$(xunit_test_lib) $(xtest_flags) /debug- +$(XTEST_REMOTE_EXECUTOR): $(topdir)/../external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs + $(TEST_COMPILE) $(topdir)/../external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs -out:$@ $(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src) $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src) diff --git a/mcs/class/System.Data/Makefile b/mcs/class/System.Data/Makefile index 6d80a3b531d..d777e8b430e 100644 --- a/mcs/class/System.Data/Makefile +++ b/mcs/class/System.Data/Makefile @@ -45,8 +45,6 @@ TEST_NUNITLITE_APP_CONFIG_GLOBAL=Test/test-config-file USE_XTEST_REMOTE_EXECUTOR = YES XTEST_LIB_REFS = System System.Core System.Xml Facades/System.Text.Encoding.CodePages Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation -TEST_MONO_PATH = . - EXTRA_DISTFILES = \ $(wildcard Test/System.Data/*.xml) \ $(wildcard Test/System.Data/*.xsd) \ diff --git a/mcs/class/System.Runtime.Remoting/Makefile b/mcs/class/System.Runtime.Remoting/Makefile index 4dc2f64f9d2..3b4b390b4f6 100644 --- a/mcs/class/System.Runtime.Remoting/Makefile +++ b/mcs/class/System.Runtime.Remoting/Makefile @@ -15,8 +15,6 @@ endif TEST_MCS_FLAGS = -nowarn:618 TEST_LIB_REFS = System System.Xml System.Core -TEST_MONO_PATH = . - EXTRA_DISTFILES = Test/corba-example.cs Test/simple-example.cs include ../../build/library.make diff --git a/mcs/class/corlib/Makefile b/mcs/class/corlib/Makefile index bfe37c575c7..d8e87d037b0 100644 --- a/mcs/class/corlib/Makefile +++ b/mcs/class/corlib/Makefile @@ -204,9 +204,6 @@ $(vtsdir)/$(PROFILE)_TestLib/BinarySerializationOverVersions.exe: $(vtsdir)/Bina $(vtsdir)/BinarySerializationOverVersions.cs -out:$@ @cp $(vtsdir)/$(PROFILE)_TestLib/1.0/Address.dll $(vtsdir)/$(PROFILE)_TestLib -# Need to define TEST_MONO_PATH to an absolute dir since the test is ran from a subdir -TEST_MONO_PATH=$(PWD)/../lib/$(PROFILE) - run-test-vts: test-vts @echo Running vts tests... PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(TEST_HARNESS) $(NOSHADOW_FLAG) \ diff --git a/mcs/class/test-helpers/RemoteExecutorConsoleApp.cs b/mcs/class/test-helpers/RemoteExecutorConsoleApp.cs deleted file mode 100644 index 93977430a5a..00000000000 --- a/mcs/class/test-helpers/RemoteExecutorConsoleApp.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Linq; -using System.Reflection; -using System.Threading.Tasks; - -class Program -{ - static int Main (string[] args) - { - if (args == null || args.Length < 3) - { - Console.WriteLine ("Invalid argumenets.\n Usage: RemoteTestExecuter.exe {assembly_name} {type_name} {method_name} {exception_file} {method_args}"); - return -1; - } - - string assemblyName = args[0]; - string typeName = args[1]; - string methodName = args[2]; - - var type = Type.GetType ($"{typeName}, {assemblyName}"); - if (type == null) - throw new Exception ($"Type {typeName} was not found in {assemblyName}"); - - var method = type.GetMethod (methodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); - if (method == null) - throw new Exception ($"Method {methodName} was not found in {typeName}, {assemblyName}"); - - var methodArgs = args.Length == 4 ? null : args.Skip(4).Cast<object>().ToArray(); - var instance = Activator.CreateInstance (type); - int result = 0; - - if (method.ReturnType == typeof (int)) - { - result = (int)method.Invoke (instance, methodArgs); - } - else if (method.ReturnType == typeof (Task<int>)) - { - var task = (Task<int>)method.Invoke (instance, methodArgs); - task.Wait(); //use C# 7.1 async Main? - result = task.Result; - } - else - { - throw new Exception($"ReturnType should be int or Task<int>. But was: {method.ReturnType.Name}"); - } - - return result; - } -}
\ No newline at end of file diff --git a/mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs b/mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs index 33b04fdb5f8..2f840a1b82e 100644 --- a/mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs +++ b/mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs @@ -10,7 +10,10 @@ namespace System.Diagnostics /// <summary>Base class used for all tests that need to spawn a remote process.</summary> public abstract partial class RemoteExecutorTestBase : FileCleanupTestBase { + // protected static readonly string HostRunnerName = "mono"; protected static readonly string HostRunner = Process.GetCurrentProcess().MainModule.FileName; - static readonly string ExtraParameter = "RemoteExecutorConsoleApp.exe"; + + // Should be ../lib/$(PROFILE)/RemoteExecutorConsoleApp.exe + static readonly string ExtraParameter = "--debug " + Environment.GetEnvironmentVariable ("REMOTE_EXECUTOR"); } } |