2009-05-12 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Tue, 12 May 2009 14:49:26 +0000 (14:49 -0000)
committerZoltan Varga <vargaz@gmail.com>
Tue, 12 May 2009 14:49:26 +0000 (14:49 -0000)
* TestDriver.cs: Add a CategoryAttribute class and an --exclude option
to exclude tests belonging to a category.

* generics.cs: Mark some tests with a !FULLAOT category.

* Makefile.am (fullaotcheck): Run tests with --exclude !FULLAOT. Include
generics tests.

svn path=/trunk/mono/; revision=133968

mono/mini/ChangeLog
mono/mini/Makefile.am
mono/mini/TestDriver.cs
mono/mini/generics.cs

index 5fa3e92ee00bf0483267571965996d6c659c6d3f..4a7d79d26da7b7ba597d342db41ce6859d80acb7 100644 (file)
@@ -1,3 +1,13 @@
+2009-05-12  Zoltan Varga  <vargaz@gmail.com>
+
+       * TestDriver.cs: Add a CategoryAttribute class and an --exclude option
+       to exclude tests belonging to a category.
+
+       * generics.cs: Mark some tests with a !FULLAOT category.
+
+       * Makefile.am (fullaotcheck): Run tests with --exclude !FULLAOT. Include
+       generics tests.
+
 2009-05-11  Zoltan Varga  <vargaz@gmail.com>
 
        * aot-compiler.c (emit_and_reloc_code): Move the implementation of
index 8ded24c5b667ba2da7bfa4fab1e07b9386ed40cb..c0d96afb68567ea0e386385c2cba357f11e2dbcb 100644 (file)
@@ -519,7 +519,7 @@ fullaotcheck: mono $(regtests)
        cp $(CLASS)/mscorlib.dll $(CLASS)/Mono.Simd.dll $(regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
        cp $(regtests) fullaot-tmp/
        MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --aot=full fullaot-tmp/* || exit 1
-       for i in $(regtests); do echo $$i; if [ $$i != generics.exe ]; then MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i || exit 1; fi; done
+       for i in $(regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i --exclude '!FULLAOT' || exit 1; done
 
 bench: mono test.exe
        time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
index 58f59b97d502b27336c296f64b44ef153002ca8a..71f9de906fec8b054dd37072bc98da849d4cc024 100644 (file)
@@ -2,6 +2,17 @@ using System;
 using System.Reflection;
 using System.Collections.Generic;
 
+public class CategoryAttribute : Attribute
+{
+       public CategoryAttribute (string category) {
+               Category = category;
+       }
+
+       public string Category {
+               get; set;
+       }
+}
+
 public class TestDriver {
 
        static public int RunTests (Type type, string[] args) {
@@ -17,26 +28,27 @@ public class TestDriver {
 
                iterations = 1;
 
+               var exclude = new Dictionary<string, string> ();
                List<string> new_args = new List<string> ();
                if (args != null && args.Length > 0) {
                        for (j = 0; j < args.Length; j++) {
-                               bool found = false;
                                if (args [j] == "--time") {
                                        do_timings = true;
-                                       found = true;
                                        j ++;
                                } else if (args [j] == "--iter") {
                                        iterations = Int32.Parse (args [j + 1]);
                                        j += 2;
-                                       found = true;
                                } else if ((args [j] == "-v") || (args [j] == "--verbose")) {
                                        verbose = true;
-                                       found = true;
+                               } else if (args [j] == "--exclude") {
+                                       exclude [args [j + 1]] = args [j + 1];
+                                       j += 2;
                                } else {
                                        new_args.Add (args [j]);
                                }
                        }
                }
+               int nskipped = 0;
                methods = type.GetMethods (BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Static);
                for (int iter = 0; iter < iterations; ++iter) {
                        for (i = 0; i < methods.Length; ++i) {
@@ -54,6 +66,20 @@ public class TestDriver {
                                        if (!found)
                                                continue;
                                }
+                               if (exclude.Count > 0) {
+                                       var attrs = methods [i].GetCustomAttributes (typeof (CategoryAttribute), false);
+                                       bool skip = false;
+                                       foreach (CategoryAttribute attr in attrs) {
+                                               if (exclude.ContainsKey (attr.Category))
+                                                       skip = true;
+                                       }
+                                       if (skip) {
+                                               if (verbose)
+                                                       Console.WriteLine ("Skipping '{0}'.", name);
+                                               nskipped ++;
+                                               continue;
+                                       }
+                               }
                                for (j = 5; j < name.Length; ++j)
                                        if (!Char.IsDigit (name [j]))
                                                break;
@@ -79,7 +105,10 @@ public class TestDriver {
                        if (do_timings) {
                                Console.WriteLine ("Total ms: {0}", tms);
                        }
-                       Console.WriteLine ("Regression tests: {0} ran, {1} failed in {2}", ran, failed, type);
+                       if (nskipped > 0)
+                               Console.WriteLine ("Regression tests: {0} ran, {1} skipped, {2} failed in {3}", ran, nskipped, failed, type);
+                       else
+                               Console.WriteLine ("Regression tests: {0} ran, {1} failed in {2}", ran, failed, type);
                }
 
                //Console.WriteLine ("Regression tests: {0} ran, {1} failed in [{2}]{3}", ran, failed, type.Assembly.GetName().Name, type);
index f7c8393e77fa601a0d4bdc481c9a6704905957fd..398ac0ef5b2c0dd71c9be396779aa73488b41376 100644 (file)
@@ -31,9 +31,9 @@ class Tests {
                }
        }
 
-       static int Main ()
+       static int Main (string[] args)
        {
-               return TestDriver.RunTests (typeof (Tests));
+               return TestDriver.RunTests (typeof (Tests), args);
        }
 
        public static int test_1_nullable_unbox ()
@@ -330,6 +330,8 @@ class Tests {
                return 0;
        }
 
+       // FIXME:
+       [Category ("!FULLAOT")]
     public static int test_0_generic_virtual_call_on_vtype_unbox () {
                object o = new Object ();
         IFoo h = new Handler(o);
@@ -401,6 +403,10 @@ class Tests {
                return 0;
        }
 
+       // This cannot be made to work with full-aot, since there it is impossible to
+       // statically determine that Foo<string>.Bar <int> is needed, the code only
+       // references IFoo.Bar<int>
+       [Category ("!FULLAOT")]
        public static int test_0_generic_virtual_on_interfaces () {
                Foo<string>.count1 = 0;
                Foo<string>.count2 = 0;