From 90ad20a615da3066519aad3d85ee9f1466140cb6 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Fri, 18 Aug 2017 15:02:16 +0200 Subject: Don't throw during test cases build process (most runner cannot handle it) --- linker/Tests/TestCasesRunner/TestCaseCollector.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'linker') diff --git a/linker/Tests/TestCasesRunner/TestCaseCollector.cs b/linker/Tests/TestCasesRunner/TestCaseCollector.cs index c84ff3534..9545e0061 100644 --- a/linker/Tests/TestCasesRunner/TestCaseCollector.cs +++ b/linker/Tests/TestCasesRunner/TestCaseCollector.cs @@ -70,22 +70,29 @@ namespace Mono.Linker.Tests.TestCasesRunner { var typeDefinition = FindTypeDefinition (caseAssemblyDefinition, potentialCase); - if (typeDefinition == null) - throw new InvalidOperationException ($"Could not find the matching type for test case {sourceFile}. Ensure the file name and class name match"); + testCase = null; + + if (typeDefinition == null) { + Console.WriteLine ($"Could not find the matching type for test case {sourceFile}. Ensure the file name and class name match"); + return false; + } if (typeDefinition.HasAttribute (nameof (NotATestCaseAttribute))) { - testCase = null; return false; } // Verify the class as a static main method var mainMethod = typeDefinition.Methods.FirstOrDefault (m => m.Name == "Main"); - if (mainMethod == null) - throw new InvalidOperationException ($"{typeDefinition} in {sourceFile} is missing a Main() method"); + if (mainMethod == null) { + Console.WriteLine ($"{typeDefinition} in {sourceFile} is missing a Main() method"); + return false; + } - if (!mainMethod.IsStatic) - throw new InvalidOperationException ($"The Main() method for {typeDefinition} in {sourceFile} should be static"); + if (!mainMethod.IsStatic) { + Console.WriteLine ($"The Main() method for {typeDefinition} in {sourceFile} should be static"); + return false; + } testCase = potentialCase; return true; -- cgit v1.2.3