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

1  2 
mono/tests/verifier/BatchCompiler.cs
mono/tests/verifier/ChangeLog
mono/tests/verifier/Makefile
mono/tests/verifier/invalid_ldsfld_no_fld.il
mono/tests/verifier/unverifiable_ldsfld_no_fld.il

index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..b8d06790ea83349401c881d07452a91435fefba7
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,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,c14c1f59cf745f2764ea93d200abaf364f57393c..fcd0023ee2335811e71095d96fdd03b7e723c5b8
@@@ -1,11 -1,3 +1,21 @@@
++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
 +      for a truncated IL stream.
 +
 +      * make_tests.sh: Fixed generation script. Added
 +      tests using the new generator.
 +
  2008-04-23 Rodrigo Kumpera <rkumpera@novell.com>
  
        * make_tests.sh: Add some tests for overlapping
index e208f1856dc9527203f5fcbc37af2d955495a7df,e208f1856dc9527203f5fcbc37af2d955495a7df..fcfa0a82441368335bbc2d24c9a2758e6d34296c
@@@ -1,10 -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 -20,7 +28,7 @@@ generate-stamp: make_tests.sh make_bin_
  
  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 -29,7 +37,7 @@@
                then \
                        RES=3; \
                fi; \
--              if [ "$$FIRST" == "unverifiable" ]; \
++              if [ "$$FIRST" == "unverifiable" ] || [ "$FIRST" == "typeunverifiable" ]; \
                then \
                        RES=2; \
                fi; \
@@@ -64,7 -64,7 +72,7 @@@
                        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 \
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..7007ac9c26c53f3a9f0e5faccfe2f958f5927209
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,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 --cc mono/tests/verifier/unverifiable_ldsfld_no_fld.il
index e89ede2104f7c06f897caae4ac59ed1a60beafe5,e89ede2104f7c06f897caae4ac59ed1a60beafe5..0000000000000000000000000000000000000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,56 -1,56 +1,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
--}