summaryrefslogtreecommitdiff
path: root/src/tests/efl_mono/Main.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/efl_mono/Main.cs')
-rw-r--r--src/tests/efl_mono/Main.cs35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/tests/efl_mono/Main.cs b/src/tests/efl_mono/Main.cs
index b7b6276..5a9f93c 100644
--- a/src/tests/efl_mono/Main.cs
+++ b/src/tests/efl_mono/Main.cs
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1using System; 16using System;
2using System.Runtime.InteropServices; 17using System.Runtime.InteropServices;
3using System.Runtime.CompilerServices; 18using System.Runtime.CompilerServices;
@@ -9,14 +24,19 @@ class TestMain
9 static Type[] GetTestCases(String name="") 24 static Type[] GetTestCases(String name="")
10 { 25 {
11 return Assembly.GetExecutingAssembly().GetTypes().Where(t => String.Equals(t.Namespace, "TestSuite", StringComparison.Ordinal) && 26 return Assembly.GetExecutingAssembly().GetTypes().Where(t => String.Equals(t.Namespace, "TestSuite", StringComparison.Ordinal) &&
12 t.Name.StartsWith("Test") && 27 t.Name.StartsWith("Test", StringComparison.Ordinal) &&
13 t.Name.Contains(name)).ToArray(); 28 t.Name.Contains(name, StringComparison.Ordinal)).ToArray();
14 } 29 }
15 30
16 static int Main(string[] args) 31 static int Main(string[] args)
17 { 32 {
18 if (Environment.GetEnvironmentVariable("ELM_ENGINE") == null) 33 /// We do not use System.Environment due to CoreCLR open issues regarding
19 Environment.SetEnvironmentVariable("ELM_ENGINE", "buffer"); 34 /// setenv modifying the actual C environment. See issue #1592 in CoreCLR repo.
35 Eina.Config.Init();
36 if (Eina.Environment.GetEnv("ELM_ENGINE") == null)
37 {
38 Eina.Environment.SetEnv("ELM_ENGINE", "buffer", true);
39 }
20 40
21 Efl.All.Init(Efl.Csharp.Components.Ui); 41 Efl.All.Init(Efl.Csharp.Components.Ui);
22 42
@@ -25,7 +45,7 @@ class TestMain
25 String ckRunSuite = Environment.GetEnvironmentVariable("CK_RUN_SUITE"); 45 String ckRunSuite = Environment.GetEnvironmentVariable("CK_RUN_SUITE");
26 String ckRunCase = Environment.GetEnvironmentVariable("CK_RUN_CASE"); 46 String ckRunCase = Environment.GetEnvironmentVariable("CK_RUN_CASE");
27 47
28 if (ckRunSuite != null && !ckRunSuite.Equals("mono")) 48 if (ckRunSuite != null && !ckRunSuite.Equals("mono", StringComparison.Ordinal))
29 return 0; 49 return 0;
30 50
31 if (ckRunCase == null) 51 if (ckRunCase == null)
@@ -33,14 +53,14 @@ class TestMain
33 53
34 Console.WriteLine("[ START SUITE ] " + ckRunSuite); 54 Console.WriteLine("[ START SUITE ] " + ckRunSuite);
35 var cases= GetTestCases(ckRunCase); 55 var cases= GetTestCases(ckRunCase);
36 foreach(var testCase in cases) 56 foreach (var testCase in cases)
37 { 57 {
38 var localTestCases = testCase.GetMethods(BindingFlags.Static | BindingFlags.Public); 58 var localTestCases = testCase.GetMethods(BindingFlags.Static | BindingFlags.Public);
39 59
40 var setUp = Array.Find(localTestCases, m => String.Equals(m.Name, "SetUp", StringComparison.Ordinal)); 60 var setUp = Array.Find(localTestCases, m => String.Equals(m.Name, "SetUp", StringComparison.Ordinal));
41 var tearDown = Array.Find(localTestCases, m => String.Equals(m.Name, "TearDown", StringComparison.Ordinal)); 61 var tearDown = Array.Find(localTestCases, m => String.Equals(m.Name, "TearDown", StringComparison.Ordinal));
42 62
43 foreach(var localTestCase in localTestCases) 63 foreach (var localTestCase in localTestCases)
44 { 64 {
45 if (localTestCase == setUp || localTestCase == tearDown) 65 if (localTestCase == setUp || localTestCase == tearDown)
46 continue; 66 continue;
@@ -99,6 +119,7 @@ class TestMain
99 Console.WriteLine("[ END SUITE ] " + ckRunSuite); 119 Console.WriteLine("[ END SUITE ] " + ckRunSuite);
100 120
101 Efl.All.Shutdown(); 121 Efl.All.Shutdown();
122 Eina.Config.Shutdown(); // For the extra init in getenv/setenv above
102 123
103 if (!pass) 124 if (!pass)
104 return -1; 125 return -1;