[compiler-tester] Fix incorrect failure with Windows paths in error messages
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Thu, 11 Feb 2016 01:42:18 +0000 (02:42 +0100)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Thu, 11 Feb 2016 01:42:18 +0000 (02:42 +0100)
On Windows we saw a failure like the following in mcs tests:

```
cs1589-2.cs... REGRESSION (CORRECT ERROR -> WRONG ERROR MESSAGE)
Exp: Unable to include XML fragment `/foo/bar' of file `there-is-no-such-file'. Could not find file "*PATH*/there-is-no-such-file"
Was: Unable to include XML fragment `/foo/bar' of file `there-is-no-such-file'. Could not find file "C:\j\workspace\z\label\w64\mcs\errors\there-is-no-such-file"
```

Fixing it by replacing the backslash with forward slash before comparing it to the expected value.

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

index 602f6540ae4a7c8b1e4711114f9e457f83ab1433..f48ceeb2c94a3d996781efe730e32f1d6aa02128 100644 (file)
@@ -1442,6 +1442,7 @@ namespace TestRunner {
 
                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);