+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
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
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) {
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) {
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;
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);
}
}
- 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 ()
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);
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;