Merge pull request #2765 from akoeplinger/mcs-fix-test-windows-backslash
authorMarek Safar <marek.safar@gmail.com>
Wed, 16 Mar 2016 17:18:27 +0000 (18:18 +0100)
committerMarek Safar <marek.safar@gmail.com>
Wed, 16 Mar 2016 17:18:27 +0000 (18:18 +0100)
[compiler-tester] Fix incorrect failure with Windows paths in error messages

1  2 
mcs/tools/compiler-tester/compiler-tester.cs

index ca804a604328da8b57efed3e0ae0ed9066fd9951,f48ceeb2c94a3d996781efe730e32f1d6aa02128..beafdfa555778472afda9b56e0d11d2fd3d52845
@@@ -589,12 -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);
                                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)
                                        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;
                                }
  
                static bool TryToMatchErrorMessage (string actual, string expected)
                {
+                       actual = actual.Replace ("\\", "/");
                        var path_mask_start = expected.IndexOf ("*PATH*");
                        if (path_mask_start > 0 && actual.Length > path_mask_start) {
                                var path_mask_continue = expected.Substring (path_mask_start + 6);