Author: marek
Date: 2005-09-19 09:43:44 -0400 (Mon, 19 Sep 2005)
New Revision: 50229

Modified:
   trunk/mcs/tools/compiler-tester/ChangeLog
   trunk/mcs/tools/compiler-tester/compiler-tester.cs
Log:
2005-09-19  Marek Safar  <[EMAIL PROTECTED]>

        * compiler-tester: Reverted Martin's revert and ignore gmcs error
        tests for new checks as most of them are not "valid".

Modified: trunk/mcs/tools/compiler-tester/ChangeLog
===================================================================
--- trunk/mcs/tools/compiler-tester/ChangeLog   2005-09-19 13:38:56 UTC (rev 
50228)
+++ trunk/mcs/tools/compiler-tester/ChangeLog   2005-09-19 13:43:44 UTC (rev 
50229)
@@ -1,3 +1,8 @@
+2005-09-19  Marek Safar  <[EMAIL PROTECTED]>
+
+       * compiler-tester: Reverted Martin's revert and ignore gmcs error
+       tests for new checks as most of them are not "valid".
+
 2005-08-31  Martin Baulig  <[EMAIL PROTECTED]>
 
        * compiler-tester: Reverted Marek's latest changes - they were

Modified: trunk/mcs/tools/compiler-tester/compiler-tester.cs
===================================================================
--- trunk/mcs/tools/compiler-tester/compiler-tester.cs  2005-09-19 13:38:56 UTC 
(rev 50228)
+++ trunk/mcs/tools/compiler-tester/compiler-tester.cs  2005-09-19 13:43:44 UTC 
(rev 50229)
@@ -470,17 +470,24 @@
        {
                string expected_message;
                string error_message;
+               bool check_msg;
+               bool check_error_line;
 
                protected enum CompilerError {
                        Expected,
                        Wrong,
                        Missing,
-                       WrongMessage
+                       WrongMessage,
+                       MissingLocation
                }
 
-               public NegativeChecker (ITester tester, string log_file, string 
issue_file):
+               public NegativeChecker (ITester tester, string log_file, string 
issue_file, bool check_msg):
                        base (tester, log_file, issue_file)
                {
+//TODO: need to review gmcs first
+#if !NET_2_0
+                       this.check_msg = check_msg;
+#endif
                }
 
                protected override bool AnalyzeTestFile(int row, string line)
@@ -499,6 +506,17 @@
                                expected_message = line.Substring (index + 
1).Trim ();
                        }
 
+                       if (row == 2) {
+                               string filtered = line.Replace (" ", "");
+                               check_error_line = !filtered.StartsWith 
("//Line:0");
+
+                               if (!filtered.StartsWith ("//Line:")) {
+                                       LogLine ("IGNORING: Wrong test syntax 
(second line must have `// Line: xx' syntax");
+                                       ++ignored;
+                                       return false;
+                               }
+                       }
+
                        return base.AnalyzeTestFile (row, line);
                }
 
@@ -547,11 +565,21 @@
                        while (line != null) {
 
                                if (line.IndexOf (tested_text) != -1) {
-//                                     string msg = line.Substring 
(line.IndexOf (':', 22) + 1).TrimEnd ('.').Trim ();
-//                                     if (msg != expected_message && msg != 
expected_message.Replace ('`', '\'')) {
-//                                             error_message = msg;
-//                                             return 
CompilerError.WrongMessage;
-//                                     }
+                                       if (check_msg) {
+                                               int first = line.IndexOf (':');
+                                               int second = line.IndexOf (':', 
first + 1);
+                                               if (second == -1)
+                                                       second = first;
+
+                                               string msg = line.Substring 
(second + 1).TrimEnd ('.').Trim ();
+                                               if (msg != expected_message && 
msg != expected_message.Replace ('`', '\'')) {
+                                                       error_message = msg;
+                                                       return 
CompilerError.WrongMessage;
+                                               }
+
+                                               if (check_error_line && 
line.IndexOf (".cs(") == -1)
+                                                       return 
CompilerError.MissingLocation;
+                                       }
                                        return CompilerError.Expected;
                                }
 
@@ -603,8 +631,8 @@
                                        }
                                        else {
                                                LogLine ("REGRESSION (CORRECT 
ERROR -> WRONG ERROR MESSAGE)");
-                                               Console.WriteLine ("E: {0}", 
expected_message);
-                                               Console.WriteLine ("W: {0}", 
error_message);
+                                               LogLine ("Exp: {0}", 
expected_message);
+                                               LogLine ("Was: {0}", 
error_message);
                                        }
                                        break;
 
@@ -624,6 +652,22 @@
                                        }
 
                                        break;
+
+                               case CompilerError.MissingLocation:
+                                       if (know_issues.Contains (file)) {
+                                               LogLine ("KNOWN ISSUE (Missing 
error location)");
+                                               know_issues.Remove (file);
+                                               return false;
+                                       }
+                                       if (no_error_list.Contains (file)) {
+                                               LogLine ("REGRESSION (NO ERROR 
-> MISSING ERROR LOCATION)");
+                                               no_error_list.Remove (file);
+                                       }
+                                       else {
+                                               LogLine ("REGRESSION (CORRECT 
ERROR -> MISSING ERROR LOCATION)");
+                                       }
+                                       break;
+
                        }
 
                        regression.Add (file);
@@ -664,7 +708,7 @@
                        Checker checker;
                        switch (mode) {
                                case "negative":
-                                       checker = new NegativeChecker (tester, 
log_fname, issue_file);
+                                       checker = new NegativeChecker (tester, 
log_fname, issue_file, true);
                                        break;
                                case "positive":
                                        checker = new PositiveChecker (tester, 
log_fname, issue_file);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to