Bladeren bron

[System.Core] Use corefx System.Linq tests (~25k tests) (#5515)

Egor Bogatov 8 jaren geleden
bovenliggende
commit
cae8dd6dbd

+ 8 - 2
mcs/build/library.make

@@ -388,5 +388,11 @@ $(the_libdir)/.doc-stamp: $(the_lib)
 gen-deps:
 	@echo "$(DEPS_TARGET_DIR): $(DEP_DIRS) $(DEP_LIBS)" >> $(DEPS_FILE)
 
-update-corefx-sr: $(RESX_RESOURCE_STRING)
-	MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resx2sr.exe $(RESX_RESOURCE_STRING) >corefx/SR.cs
+update-corefx-sr-generic:
+ifneq ($(RESX_STRINGS),)
+	MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resx2sr.exe $(RESX_STRINGS) >$(SR_OUTPUT)
+endif
+
+update-corefx-sr: $(RESX_RESOURCE_STRING) $(XTEST_RESX_RESOURCE_STRING)
+	make SR_OUTPUT=corefx/SR.cs RESX_STRINGS=$(RESX_RESOURCE_STRING) update-corefx-sr-generic \
+	&& make SR_OUTPUT=corefx/SR.tests.cs RESX_STRINGS=$(XTEST_RESX_RESOURCE_STRING) update-corefx-sr-generic

+ 1 - 1
mcs/build/tests.make

@@ -20,7 +20,7 @@ TEST_RUNTIME_WRAPPERS_PATH = $(shell dirname $(RUNTIME))/_tmpinst/bin
 ifndef NO_TEST
 
 test_nunit_lib = nunitlite.dll
-xunit_core := xunit.core xunit.abstractions xunit.assert Xunit.NetCore.Extensions
+xunit_core := xunit.core xunit.execution.desktop xunit.abstractions xunit.assert Xunit.NetCore.Extensions
 xunit_deps := System.Runtime
 xunit_src  := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttribute.cs BenchmarkDiscover.cs) $(topdir)/../mcs/class/test-helpers/PlatformDetection.cs
 

+ 4 - 0
mcs/class/System.Core/Makefile

@@ -52,6 +52,10 @@ BUILT_SOURCES = \
 endif
 
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+XTEST_LIB_REFS = System Facades/System.Threading.Tasks Microsoft.CSharp Facades/System.Text.RegularExpressions Facades/System.Reflection Facades/System.Reflection.Extensions Facades/System.Runtime.InteropServices.RuntimeInformation Facades/System.Reflection.Emit
+# FEATURE_INTERPRET, FEATURE_COMPILE, NO_FEATURE_STATIC_DELEGATE
+XTEST_LIB_FLAGS = -unsafe -d:FEATURE_COMPILE
+XTEST_RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Collections.Immutable/src/Resources/Strings.resx
 
 include ../../build/library.make
 

+ 68 - 0
mcs/class/System.Core/System.Core_xtest.dll.sources

@@ -0,0 +1,68 @@
+../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs
+
+# System.Linq.Queryable
+../../../external/corefx/src/System.Linq.Queryable/tests/*.cs
+../../../external/corefx/src/Common/tests/System/Linq/SkipTakeData.cs
+
+# System.Linq.Expressions
+../../../external/corefx/src/System.Linq.Expressions/tests/Array/*.cs:NewArrayBoundsTests.cs,ArrayAccessTests.cs,ArrayIndexTests.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Block/*.cs:NoParameterBlockTests.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Call/*.cs:CallTests.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Cast/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Conditional/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Constant/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Convert/*.cs:ConvertCheckedTests.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/DebuggerTypeProxy/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/DebugInfo/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Default/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/DelegateType/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Dynamic/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/DynamicExpression/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/ExceptionHandling/*.cs:ExceptionHandlingExpressions.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Goto/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/ILReader/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/IndexExpression/*.cs:IndexExpressionTests.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Invoke/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Label/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Lambda/*.cs:LambdaTests.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Lifted/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/ListInit/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Loop/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Member/*.cs:MemberAccessTests.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/MemberInit/*.cs:BindTests.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/New/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/SequenceTests/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Switch/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Ternary/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/TestExtensions/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/TypeBinary/*.cs
+#../../../external/corefx/src/System.Linq.Expressions/tests/Unary/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Variables/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Visitor/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Assignment/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Bitwise/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/*.cs:BinaryCoalesceTests.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Comparison/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Logical/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/ReferenceComparison/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/Unary/IncDecAssign/*.cs
+../../../external/corefx/src/System.Linq.Expressions/tests/*.cs:CompilerTests.cs,StackSpillerTests.cs,ReadOnlyCollectionBuilderTests.cs
+Test/System.Linq.Expressions/TestExtensions.cs
+
+# System.Linq.Expressions
+../../../external/corefx/src/System.Linq.Parallel/tests/Combinatorial/*.cs
+../../../external/corefx/src/System.Linq.Parallel/tests/Helpers/*.cs
+#../../../external/corefx/src/System.Linq.Parallel/tests/QueryOperators/*.cs
+../../../external/corefx/src/System.Linq.Parallel/tests/*.cs:WithCancellationTests.cs,PlinqModesTests.cs,ExchangeTests.cs,EtwTests.cs
+../../../external/corefx/src/Common/tests/System/Threading/ThreadPoolHelpers.cs
+../../../external/corefx/src/Common/tests/System/Diagnostics/Tracing/TestEventListener.cs
+../../../external/corefx/src/Common/tests/System/ShouldNotBeInvokedException.cs
+
+# tests need System.Collections.Immutable.dll
+../../../external/corefx/src/Common/src/System/Runtime/Versioning/NonVersionableAttribute.cs
+../../../external/corefx/src/System.Collections.Immutable/src/System/Collections/Generic/*.cs
+../../../external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/*.cs
+../../../external/corefx/src/System.Collections.Immutable/src/Validation/*.cs
+corefx/SR.tests.cs

+ 35 - 0
mcs/class/System.Core/Test/System.Linq.Expressions/TestExtensions.cs

@@ -0,0 +1,35 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.CompilerServices;
+using System.Threading;
+using Xunit;
+
+namespace System.Linq.Expressions.Tests
+{
+    public static class CompilerTests
+    {
+        public static void VerifyIL(this LambdaExpression expression, string expected, bool appendInnerLambdas = false)
+        {
+            string actual = expression.GetIL(appendInnerLambdas);
+
+            string nExpected = Normalize(expected);
+            string nActual = Normalize(actual);
+
+            Assert.Equal(nExpected, nActual);
+        }
+
+        private static string Normalize(string s)
+        {
+            Collections.Generic.IEnumerable<string> lines =
+                s
+                .Replace("\r\n", "\n")
+                .Split(new[] { '\n' })
+                .Select(line => line.Trim())
+                .Where(line => line != "" && !line.StartsWith("//"));
+
+            return string.Join("\n", lines);
+        }
+    }
+}

+ 16 - 0
mcs/class/System.Core/corefx/SR.tests.cs

@@ -0,0 +1,16 @@
+//
+// This file was generated by resx2sr tool
+//
+
+partial class SR
+{
+	public const string ArrayInitializedStateNotEqual = "Object is not a array with the same initialization state as the array to compare it to.";
+	public const string ArrayLengthsNotEqual = "Object is not a array with the same number of elements as the array to compare it to.";
+	public const string CannotFindOldValue = "Cannot find the old value";
+	public const string CapacityMustBeGreaterThanOrEqualToCount = "Capacity was less than the current Count of elements.";
+	public const string CapacityMustEqualCountOnMove = "MoveToImmutable can only be performed when Count equals Capacity.";
+	public const string CollectionModifiedDuringEnumeration = "Collection was modified; enumeration operation may not execute.";
+	public const string DuplicateKey = "An element with the same key but a different value already exists. Key: {0}";
+	public const string InvalidEmptyOperation = "This operation does not apply to an empty instance.";
+	public const string InvalidOperationOnDefaultArray = "This operation cannot be performed on a default instance of ImmutableArray<T>.  Consider initializing the array, or checking the ImmutableArray<T>.IsDefault property.";
+}

+ 1 - 0
scripts/ci/run-test-default.sh

@@ -62,6 +62,7 @@ ${TESTCMD} --label=System.Configuration --timeout=5m make -w -C mcs/class/System
 ${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test
 ${TESTCMD} --label=System.Web.Extensions --timeout=5m make -w -C mcs/class/System.Web.Extensions run-test
 ${TESTCMD} --label=System.Core --timeout=15m make -w -C mcs/class/System.Core run-test
+${TESTCMD} --label=System.Core-xunit --timeout=15m make -w -C mcs/class/System.Core run-xunit-test
 ${TESTCMD} --label=System.Xml.Linq --timeout=5m make -w -C mcs/class/System.Xml.Linq run-test
 ${TESTCMD} --label=System.Data.DSE --timeout=5m make -w -C mcs/class/System.Data.DataSetExtensions run-test
 ${TESTCMD} --label=System.Web.Abstractions --timeout=5m make -w -C mcs/class/System.Web.Abstractions run-test