2005-08-31 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Wed, 31 Aug 2005 11:47:48 +0000 (11:47 -0000)
committerMartin Baulig <martin@novell.com>
Wed, 31 Aug 2005 11:47:48 +0000 (11:47 -0000)
* compiler-tester: Reverted Marek's latest changes - they were
breaking 231 gmcs tests.

svn path=/trunk/mcs/; revision=49167

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

index 527f60a9279f5d03cb2a89d178ccff50a9a33288..0134231aa4d37fc847b1209ee16337fdd8642da3 100644 (file)
@@ -1,22 +1,11 @@
-2005-08-26  Raja R Harinath  <rharinath@novell.com>
+2005-08-31  Martin Baulig  <martin@ximian.com>
 
-       * compiler-tester.cs (NegativeChecker.GetCompilerError): Don't
-       look for exactly two ':'s in the error message.
-       (NegativeChecker.HandleFailure): Print an informative message when
-       CompilerError.MissingLocation.
-
-2005-06-24  Marek Safar  <marek.safar@seznam.cz>
-
-       * compiler-tester:.cs Enabled error/warning message checking.
-
-2005-06-13  Marek Safar  <marek.safar@seznam.cz>
-
-       * compiler-tester.cs: Add check for correct error test case
-       syntax.
+       * compiler-tester: Reverted Marek's latest changes - they were
+       breaking 231 gmcs tests.
 
 2005-06-09  Marek Safar  <marek.safar@seznam.cz>
 
-       * compiler-tester.cs: Add process test runner to cope with
+       * compiler-tester: Add process test runner to cope with
        too many files in AppDomain(s).
 
 2005-06-06  Raja R Harinath  <harinath@gmail.com>
index af0eb9c6c9fe1cd6e9720be1314128c7ad3c0a29..68e42d8d120b524f446874307e75f4c3d91f44c8 100644 (file)
@@ -66,7 +66,7 @@ namespace TestRunner {
 
                public bool Invoke(string[] args)
                {
-                       StringBuilder sb = new StringBuilder ("/nologo ");
+                       StringBuilder sb = new StringBuilder ();
                        foreach (string s in args) {
                                sb.Append (s);
                                sb.Append (" ");
@@ -85,11 +85,9 @@ namespace TestRunner {
        {
                protected ITester tester;
                protected int success;
-               protected int total;
-               protected int ignored;
+               int total;
                string issue_file;
                StreamWriter log_file;
-               protected string[] compiler_options;
 
                protected ArrayList regression = new ArrayList ();
                protected ArrayList know_issues = new ArrayList ();
@@ -104,33 +102,24 @@ namespace TestRunner {
                        this.log_file = new StreamWriter (log_file, false);
                }
 
-               protected virtual bool GetExtraOptions (string file)
+               protected virtual string[] GetExtraOptions (string file)
                {
+                       const string options = "// Compiler options:";
+
                        int row = 0;
                        using (StreamReader sr = new StreamReader (file)) {
                                String line;
                                while (row++ < 3 && (line = sr.ReadLine()) != null) {
-                                       if (!AnalyzeTestFile (row, line))
-                                               return false;
+                                       int index = line.IndexOf (options);
+                                       if (index != -1) {
+                                               string[] o = line.Substring (index + options.Length).Trim().Split (' ');
+                                               for (int i = 0; i < o.Length; i++)
+                                                       o [i] = o[i].TrimStart ();
+                                               return o;
+                                       }                               
                                }
                        }
-                       return true;
-               }
-
-               protected virtual bool AnalyzeTestFile (int row, string line)
-               {
-                       const string options = "// Compiler options:";
-
-                       if (row == 1)
-                               compiler_options = null;
-
-                       int index = line.IndexOf (options);
-                       if (index != -1) {
-                               compiler_options = line.Substring (index + options.Length).Trim().Split (' ');
-                               for (int i = 0; i < compiler_options.Length; i++)
-                                       compiler_options[i] = compiler_options[i].TrimStart ();
-                       }
-                       return true;
+                       return null;
                }
 
                public void Do (string filename)
@@ -139,26 +128,22 @@ namespace TestRunner {
                        Log ("...\t");
 
                        if (ignore_list.Contains (filename)) {
-                               ++ignored;
                                LogLine ("NOT TESTED");
                                return;
                        }
 
-                       if (!GetExtraOptions (filename)) {
-                               return;
-                       }
-
                        ++total;
                        Check (filename);
                }
 
                protected virtual bool Check (string filename)
                {
+                       string[] extra = GetExtraOptions (filename);
                        string[] test_args;
 
-                       if (compiler_options != null) {
-                               test_args = new string [1 + compiler_options.Length];
-                               compiler_options.CopyTo (test_args, 0);
+                       if (extra != null) {
+                               test_args = new string [1 + extra.Length];
+                               extra.CopyTo (test_args, 0);
                        } else {
                                test_args = new string [1];
                        }
@@ -200,9 +185,6 @@ namespace TestRunner {
                        LogLine ("Done" + Environment.NewLine);
                        LogLine ("{0} test cases passed ({1:.##%})", success, (float) (success) / (float)total);
 
-                       if (ignored > 0)
-                               LogLine ("{0} test cases ignored", ignored);
-
                        know_issues.AddRange (no_error_list);
                        if (know_issues.Count > 0) {
                                LogLine ("");
@@ -290,26 +272,27 @@ namespace TestRunner {
                        }
                }
 
-               protected override bool GetExtraOptions(string file) {
-                       if (!base.GetExtraOptions (file))
-                               return false;
-
+               protected override string[] GetExtraOptions(string file)
+               {
                        doc_output = null;
-                       if (compiler_options == null)
-                               return true;
+                       string[] opt = base.GetExtraOptions (file);
+                       if (opt == null)
+                               return null;
 
-                       foreach (string one_opt in compiler_options) {
+                       foreach (string one_opt in opt) {
                                if (one_opt.StartsWith ("-doc:")) {
-                                       doc_output = one_opt.Split (':')[1];
+                                        doc_output = one_opt.Split (':')[1];
                                }
                        }
-                       return true;
+
+                       return opt;
                }
 
-               protected override bool Check(string filename) {
+               protected override bool Check(string filename)
+               {
                        try {
                                if (!base.Check (filename)) {
-                                       HandleFailure (filename, TestResult.CompileError, tester.Output);
+                                       HandleFailure (filename, TestResult.CompileError, null);
                                        return false;
                                }
                        }
@@ -318,13 +301,6 @@ namespace TestRunner {
                                return false;
                        }
 
-                       // Test setup
-                       if (filename.EndsWith ("-lib.cs") || filename.EndsWith ("-mod.cs")) {
-                               LogLine ("OK");
-                               --total;
-                               return true;
-                       }
-
                        MethodInfo mi = null;
                        string file = Path.Combine (files_folder, Path.GetFileNameWithoutExtension (filename) + ".exe");
                        if (!appdomain_limit_reached) {
@@ -442,7 +418,7 @@ namespace TestRunner {
                                                know_issues.Remove (file);
                                                return;
                                        }
-                                       LogLine ("REGRESSION (SUCCESS -> EXECUTION ERROR)");
+                                       LogLine ("REGRESSION (SUCCESS -> EXECUTE ERROR)");
                                        break;
 
                                case TestResult.XmlError:
@@ -468,56 +444,17 @@ namespace TestRunner {
 
        class NegativeChecker: Checker
        {
-               string expected_message;
-               string error_message;
-               bool check_msg;
-               bool check_error_line;
-
                protected enum CompilerError {
                        Expected,
                        Wrong,
-                       Missing,
-                       WrongMessage,
-                       MissingLocation
+                       Missing
                }
 
-               public NegativeChecker (ITester tester, string log_file, string issue_file, bool check_msg):
+               public NegativeChecker (ITester tester, string log_file, string issue_file):
                        base (tester, log_file, issue_file)
                {
-                       this.check_msg = check_msg;
                }
 
-               protected override bool AnalyzeTestFile(int row, string line)
-               {
-                       if (row == 1) {
-                               expected_message = null;
-
-                               int index = line.IndexOf (':');
-                               if (index == -1 || index > 15) {
-                                       LogLine ("IGNORING: Wrong test file syntax (missing error mesage text)");
-                                       ++ignored;
-                                       base.AnalyzeTestFile (row, line);
-                                       return false;
-                               }
-
-                               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);
-               }
-
-
                protected override bool Check (string filename)
                {
                        int start_char = 0;
@@ -545,9 +482,7 @@ namespace TestRunner {
                                return true;
                        }
 
-                       if (result_code == CompilerError.Wrong)
-                               LogLine (tester.Output);
-
+                       LogLine (tester.Output);
                        return false;
                }
 
@@ -561,23 +496,8 @@ namespace TestRunner {
                        bool any_error = false;
                        while (line != null) {
 
-                               if (line.IndexOf (tested_text) != -1) {
-                                       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 ('`', '\'')) {
-                                                       if (check_error_line && line.IndexOf (".cs(") == -1)
-                                                               return CompilerError.MissingLocation;
-                                                       error_message = msg;
-                                                       return CompilerError.WrongMessage;
-                                               }
-                                       }
+                               if (line.IndexOf (tested_text) != -1)
                                        return CompilerError.Expected;
-                               }
 
                                if (line.IndexOf (error_prefix) != -1 &&
                                        line.IndexOf (ignored_error) == -1)
@@ -607,29 +527,13 @@ namespace TestRunner {
                                                return false;
                                        }
                                        if (no_error_list.Contains (file)) {
-                                               LogLine ("REGRESSION (NO ERROR -> WRONG ERROR CODE)");
+                                               LogLine ("REGRESSION (NO ERROR -> WRONG ERROR)");
                                                no_error_list.Remove (file);
                                        }
                                        else {
-                                               LogLine ("REGRESSION (CORRECT ERROR -> WRONG ERROR CODE)");
+                                               LogLine ("REGRESSION (CORRECT ERROR -> WRONG ERROR)");
                                        }
-                                       break;
 
-                               case CompilerError.WrongMessage:
-                                       if (know_issues.Contains (file)) {
-                                               LogLine ("KNOWN ISSUE (Wrong error message reported)");
-                                               know_issues.Remove (file);
-                                               return false;
-                                       }
-                                       if (no_error_list.Contains (file)) {
-                                               LogLine ("REGRESSION (NO ERROR -> WRONG ERROR MESSAGE)");
-                                               no_error_list.Remove (file);
-                                       }
-                                       else {
-                                               LogLine ("REGRESSION (CORRECT ERROR -> WRONG ERROR MESSAGE)");
-                                               LogLine ("Exp: {0}", expected_message);
-                                               LogLine ("Was: {0}", error_message);
-                                       }
                                        break;
 
                                case CompilerError.Missing:
@@ -648,27 +552,6 @@ namespace TestRunner {
                                        }
 
                                        break;
-
-                               case CompilerError.MissingLocation:
-                                       LogLine ("OK (Missing location information)");
-                                       return true;
-
-                                       // Temporary disabled
-/*
-                                       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);
@@ -709,7 +592,7 @@ namespace TestRunner {
                        Checker checker;
                        switch (mode) {
                                case "negative":
-                                       checker = new NegativeChecker (tester, log_fname, issue_file, true);
+                                       checker = new NegativeChecker (tester, log_fname, issue_file);
                                        break;
                                case "positive":
                                        checker = new PositiveChecker (tester, log_fname, issue_file);
@@ -725,7 +608,7 @@ namespace TestRunner {
                                        continue;
                                }
 
-                               if (filename.EndsWith ("-p2.cs"))
+                               if (filename.EndsWith ("-p2.cs") || filename.EndsWith ("-lib.cs") || filename.EndsWith ("-mod.cs"))
                                        continue;
                            
                                checker.Do (filename);