Merge pull request #4302 from marek-safar/corefx-bump
[mono.git] / mcs / tools / compiler-tester / compiler-tester.cs
index 602f6540ae4a7c8b1e4711114f9e457f83ab1433..265f702ab654b6e0ec0041bc3d53a8a0de9c2096 100644 (file)
@@ -91,7 +91,7 @@ namespace TestRunner {
                }
        }
 
-#if !NET_2_1
+#if !MOBILE
        class ProcessTester: ITester
        {
                ProcessStartInfo pi;
@@ -589,13 +589,12 @@ namespace TestRunner {
                        string[] test_args;
 
                        if (test.CompilerOptions != null) {
-                               test_args = new string[2 + test.CompilerOptions.Length];
+                               test_args = new string[1 + test.CompilerOptions.Length];
                                test.CompilerOptions.CopyTo (test_args, 0);
                        } else {
-                               test_args = new string[2];
+                               test_args = new string[1];
                        }
-                       test_args[test_args.Length - 2] = test_args[0];
-                       test_args[test_args.Length - 1] = "-debug";
+                       test_args[test_args.Length - 1] = test_args[0];
                        test_args[0] = test.FileName;
 
                        return tester.Invoke (test_args);
@@ -697,11 +696,9 @@ namespace TestRunner {
                                log_file.WriteLine (msg, rest);
                }
                
-               public void LogFileLine (string file, string msg, params object [] args)
+               public void LogFileLine (string file, string msg)
                {
-                       string s = verbose ? 
-                               string.Format (msg, args) :
-                               file + "...\t" + string.Format (msg, args); 
+                       string s = verbose ? msg : file + "...\t" + msg;
 
                        Console.WriteLine (s);
                        if (log_file != null)
@@ -737,7 +734,7 @@ namespace TestRunner {
                bool update_verif_file;
                Hashtable verif_data;
 
-#if !NET_2_1
+#if !MOBILE
                ProcessStartInfo pi;
 #endif
                readonly string mono;
@@ -759,7 +756,7 @@ namespace TestRunner {
                        files_folder = Directory.GetCurrentDirectory ();
                        this.verif_file = verif_file;
 
-#if !NET_2_1
+#if !MOBILE
                        pi = new ProcessStartInfo ();
                        pi.CreateNoWindow = true;
                        pi.WindowStyle = ProcessWindowStyle.Hidden;
@@ -871,7 +868,7 @@ namespace TestRunner {
                                        return true;
 
                                if (md.ILSize > il_size) {
-                                       checker.LogFileLine (test.FileName, "{0} (code size reduction {1} -> {2})", decl_type + ": " + m_name, md.ILSize, il_size);
+                                       checker.LogFileLine (test.FileName, string.Format ("{0} (code size reduction {1} -> {2})", decl_type + ": " + m_name, md.ILSize, il_size));
                                        md.ILSize = il_size;
                                        return true;
                                }
@@ -968,7 +965,7 @@ namespace TestRunner {
                        string filename = test.FileName;
 
                        AppDomain domain = null;
-#if !NET_2_1
+#if !MOBILE
                        if (safe_execution) {
                                // Create a new AppDomain, with the current directory as the base.
                                AppDomainSetup setupInfo = new AppDomainSetup ();
@@ -980,7 +977,7 @@ namespace TestRunner {
                        try {
                                DomainTester tester;
                                try {
-#if !NET_2_1
+#if !MOBILE
                                        if (domain != null)
                                                tester = (DomainTester) domain.CreateInstanceAndUnwrap (typeof (PositiveChecker).Assembly.FullName, typeof (DomainTester).FullName);
                                        else
@@ -1001,7 +998,7 @@ namespace TestRunner {
                                if (doc_output != null) {
                                        string ref_file = filename.Replace (".cs", "-ref.xml");
                                        try {
-#if !NET_2_1
+#if !MOBILE
                                                new XmlComparer ("doc").Compare (ref_file, doc_output);
 #endif
                                        } catch (Exception e) {
@@ -1442,17 +1439,16 @@ namespace TestRunner {
 
                static bool TryToMatchErrorMessage (string actual, string expected)
                {
-                       var path_mask_start = expected.IndexOf ("*PATH*");
+                       actual = actual.Replace ("\\", "/");
+                       var path_mask_start = expected.IndexOf ("*PATH*", StringComparison.Ordinal);
                        if (path_mask_start > 0 && actual.Length > path_mask_start) {
-                               var path_mask_continue = expected.Substring (path_mask_start + 6);
-                               var expected_continue = actual.IndexOf (path_mask_continue, path_mask_start);
-                               if (expected_continue > 0) {
-                                       var path = actual.Substring (path_mask_start, expected_continue - path_mask_start);
-                                       if (actual == expected.Replace ("*PATH*", path))
-                                               return true;
-
-                                       throw new ApplicationException (expected.Replace ("*PATH*", path));
+                               var parts = expected.Split (new [] { "*PATH*" }, StringSplitOptions.None);
+                               foreach (var part in parts) {
+                                       if (!actual.Contains (part))
+                                               return false;
                                }
+
+                               return true;
                        }
 
                        return false;