2008-05-01 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 1 May 2008 20:33:03 +0000 (20:33 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 1 May 2008 20:33:03 +0000 (20:33 -0000)
* unverifiable_ldsfld_no_fld.il: Fixed compilation
and renamed to invalid_ldsfld_no_fld.il.

* BatchCompiler.cs: New driver to fast compile the
verifier test suite. It's about 20x faster now.

* Makefile: Use the ilasm driver for faster compilation.

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

mono/tests/verifier/BatchCompiler.cs [new file with mode: 0644]
mono/tests/verifier/ChangeLog
mono/tests/verifier/Makefile
mono/tests/verifier/invalid_ldsfld_no_fld.il [new file with mode: 0644]
mono/tests/verifier/unverifiable_ldsfld_no_fld.il [deleted file]

diff --git a/mono/tests/verifier/BatchCompiler.cs b/mono/tests/verifier/BatchCompiler.cs
new file mode 100644 (file)
index 0000000..b8d0679
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// AssemblyRunner.cs
+//
+// Author:
+//   Rodrigo Kumpera (rkumpera@novell.com)
+//
+// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.IO;
+using System.Reflection;
+
+
+namespace Verifier {
+       public class BatchCompiler : MarshalByRefObject {
+               static BatchCompiler NewBatchCompiler () {
+                       AppDomain domain = AppDomain.CreateDomain ("test");
+                       BatchCompiler compiler = (BatchCompiler) domain.CreateInstanceAndUnwrap(
+                               Assembly.GetExecutingAssembly().FullName,
+                               "Verifier.BatchCompiler");
+                       return compiler;
+               }
+
+               public static void Main (String[] args) {
+                       int total = 0;
+                       BatchCompiler bc = NewBatchCompiler ();
+
+                       foreach (string src in Directory.GetFiles (".", "*.il")) {
+                               if (!bc.Compile (src)) 
+                                       bc = NewBatchCompiler ();
+                               else
+                                       ++total;
+                       }
+                       Console.WriteLine ("Total compiled successfully {0}", total);
+               }
+
+               public bool Compile (String src) {
+                       try {
+                               Mono.ILASM.Driver.Main (new string[] { src });
+                               string binary = src.Substring (0, src.Length - 3) + ".exe";
+                               return File.Exists (binary);
+                       } catch (Exception e) {
+                               Console.WriteLine ("Error compiling {0}", e);
+                               return false;
+                       }
+               }
+       }
+}
+
index 4b6d83c172bebb23bd238f49d4029d218dd7f67e..fcd0023ee2335811e71095d96fdd03b7e723c5b8 100644 (file)
@@ -1,3 +1,13 @@
+2008-05-01 Rodrigo Kumpera <rkumpera@novell.com>
+
+       * unverifiable_ldsfld_no_fld.il: Fixed compilation
+       and renamed to invalid_ldsfld_no_fld.il.
+
+       * BatchCompiler.cs: New driver to fast compile the
+       verifier test suite. It's about 20x faster now.
+
+       * Makefile: Use the ilasm driver for faster compilation.
+
 2008-04-30 Rodrigo Kumpera <rkumpera@novell.com>
 
        * make_il_overflow_test.sh: New test generator
index e208f1856dc9527203f5fcbc37af2d955495a7df..fcfa0a82441368335bbc2d24c9a2758e6d34296c 100644 (file)
@@ -1,10 +1,18 @@
 
 %.exe: %.cil
-       ilasm -out:$@ $<
+       ilasm2 -out:$@ $<
 
-compile-stamp: generate-stamp
-       for i in *.il; do ilasm2 $$i; done
-       for i in *.cs; do gmcs /unsafe $$i; done
+BatchCompiler.exe: BatchCompiler.cs
+       gmcs -r:../../../../mcs/class/lib/net_2_0/ilasm.exe BatchCompiler.cs
+
+compile-stamp: generate-stamp BatchCompiler.exe
+       for i in *.cs; do \
+               EXE="`echo $$i | cut -d. -f1`.exe"; \
+               if ! [ -f $$EXE ]; then \
+                       gmcs /unsafe $$i; \
+               fi \
+       done 
+       MONO_PATH=../../../../mcs/class/lib/net_2_0/ mono BatchCompiler.exe
        touch compile-stamp
 
 clean:
@@ -20,7 +28,7 @@ generate-stamp: make_tests.sh make_bin_test.sh make_exception_branch_test.sh mak
 
 test: compile-stamp run-test
 
-run-test:
+run-test: compile-stamp
        @for i in *.exe; do \
                TEST=`echo $$i | cut -d '.' -f 1`; \
                RES=99; \
@@ -29,7 +37,7 @@ run-test:
                then \
                        RES=3; \
                fi; \
-               if [ "$$FIRST" == "unverifiable" ]; \
+               if [ "$$FIRST" == "unverifiable" ] || [ "$FIRST" == "typeunverifiable" ]; \
                then \
                        RES=2; \
                fi; \
@@ -64,7 +72,7 @@ run-test:
                        if [ $$R2 != 0 ]; then \
                                echo "$$TEST is type unverifiable but did not pass under non-strict check, got $${R2} but expected 0"; \
                        fi \
-               else \
+               elif [ $RES != 99 ]; then \
                        ../../metadata/pedump --verify error,warn,cls,code $$TEST.exe >/dev/null 2>/dev/null; \
                        R=$$?; \
                        if [ $$R != $$RES ]; then \
diff --git a/mono/tests/verifier/invalid_ldsfld_no_fld.il b/mono/tests/verifier/invalid_ldsfld_no_fld.il
new file mode 100644 (file)
index 0000000..7007ac9
--- /dev/null
@@ -0,0 +1,29 @@
+// Invalid CIL which breaks the ECMA-335,III,4.14 rules. 
+// This CIL should fail verification by a conforming CLI verifier.
+
+.assembly 'test_generated'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+
+
+.class public auto ansi beforefieldinit c
+       extends [mscorlib]System.Object
+{
+}
+
+.method public static int32 Main() cil managed
+{
+       .entrypoint
+       .maxstack 2
+       .locals init (
+               class c V_0
+       )
+       ldloc.0
+       ldsfld int32 c::invalid // Invalid, no field invalid in class c.
+       pop
+       ldc.i4.0
+       ret
+}
+
diff --git a/mono/tests/verifier/unverifiable_ldsfld_no_fld.il b/mono/tests/verifier/unverifiable_ldsfld_no_fld.il
deleted file mode 100644 (file)
index e89ede2..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-// Invalid CIL which breaks the ECMA-335,III,4.14 rules. 
-// This CIL should fail verification by a conforming CLI verifier.
-
-.assembly 'test_generated'
-{
-  .hash algorithm 0x00008004
-  .ver  0:0:0:0
-}
-
-
-.class public auto ansi beforefieldinit c
-       extends [mscorlib]System.Object
-{
-}
-
-.method public static int32 Main() cil managed
-{
-       .entrypoint
-       .maxstack 2
-       .locals init (
-               class c V_0
-       )
-       ldloc.0
-       ldsfld int32 c::invalid // Invalid, no field invalid in class c.
-       pop
-       ldc.i4.0
-       ret
-}
-// Invalid CIL which breaks the ECMA-335,III,4.14 rules. 
-// This CIL should fail verification by a conforming CLI verifier.
-
-.assembly 'test_generated'
-{
-  .hash algorithm 0x00008004
-  .ver  0:0:0:0
-}
-
-
-.class public auto ansi beforefieldinit c
-       extends [mscorlib]System.Object
-{
-}
-
-.method public static int32 Main() cil managed
-{
-       .entrypoint
-       .maxstack 2
-       .locals init (
-               class c V_0
-       )
-       ldloc.0
-       ldsfld int32 c::invalid // Invalid, no field invalid in class c.
-       pop
-       ldc.i4.0
-       ret
-}