1.1 test fixes
authorMarek Habersack <grendel@twistedcode.net>
Tue, 18 Aug 2009 23:56:22 +0000 (23:56 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Tue, 18 Aug 2009 23:56:22 +0000 (23:56 -0000)
svn path=/trunk/mcs/; revision=140213

18 files changed:
mcs/class/System.Web/Makefile
mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
mcs/class/System.Web/System.Web_test.dll.sources
mcs/class/System.Web/Test/System.Web.Compilation/TemplateControlCompilerTest.cs
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Global.asax.cs [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax.cs [deleted file]
mono/io-layer/ChangeLog
mono/io-layer/wthreads.c
mono/metadata/ChangeLog
mono/metadata/cil-coff.h
mono/metadata/class.c
mono/metadata/metadata-internals.h
mono/metadata/metadata.c
mono/metadata/reflection.c
mono/metadata/verify.c
mono/tests/verifier/ChangeLog
mono/tests/verifier/valid_generic_type_definition_on_boxing_position.cs [new file with mode: 0644]

index f5a5d9a3904c2feb8a2336476d11f9079412204a..af8857dc5e576e623b586f7b3c4957da4e8b1cfe 100644 (file)
@@ -76,7 +76,6 @@ RESOURCE_FILES_2 = \
 OTHER_RES = $(RESOURCE_FILES_1)
 TEST_RESOURCE_FILES = \
        Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax \
-       Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax.cs \
        Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx \
        Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master \
        Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx \
index d424109d37e5327355b68c06140370ab399e14a0..b29dc60746dbec632a3b9168989e657e97f1646b 100644 (file)
@@ -749,8 +749,15 @@ namespace System.Web.Compilation
                                return type;
                        }
 
+#if NET_2_0
                        Parse ();
-
+#else
+                       try {
+                               Parse ();
+                       } catch (ParseException ex) {
+                               throw new HttpException ("Compilation failed.", ex);
+                       }
+#endif
                        BaseCompiler compiler = GetCompilerFromType ();
                        
                        type = compiler.GetCompiledType ();
index 32637f2cdbd8460b0ba2cf43f06928a7a06b774a..c28a26b87ab01ed95787ae6ce1688febcff46d2b 100644 (file)
@@ -20,6 +20,7 @@ mainsoft/NunitWeb/NunitWeb/BaseWorkerRequest.cs
 mainsoft/NunitWeb/NunitWeb/CustomSection.cs
 mainsoft/NunitWeb/NunitWeb/FakeMembershipProvider.cs
 mainsoft/NunitWeb/NunitWeb/FormRequest.cs
+mainsoft/NunitWeb/NunitWeb/Global.asax.cs
 mainsoft/NunitWeb/NunitWeb/IForeignData.cs
 mainsoft/NunitWeb/NunitWeb/HandlerInvoker.cs
 mainsoft/NunitWeb/NunitWeb/MyHandler.cs
index 4b8a6b99ebd118b2b028b4da7d7d9cc2289d2f05..8d4b331560e9abd9d2eeb71d83d0f772e3f653ad 100644 (file)
@@ -214,15 +214,15 @@ namespace MonoTests.System.Web.Compilation {
                        string originalHtml = "<a href=\"test\">bla</a>";
                        HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
                }
-#endif
 
-               [Test (Description="Bug #525104")]
+               [Test (Description="Bug #524358")]
                [ExpectedException (typeof (HttpException))]
                public void DuplicateControlsInClientComment ()
                {
                        // Just test if it throws an exception
-                       new WebTest ("DuplicateControlsInClientCommment.aspx").Run ();
+                       new WebTest ("DuplicateControlsInClientComment.aspx").Run ();
                }
+#endif
                
                [Test (Description="Bug #517656")]
                public void ServerControlInClientSideComment ()
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Global.asax.cs b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Global.asax.cs
new file mode 100644 (file)
index 0000000..bd70928
--- /dev/null
@@ -0,0 +1,22 @@
+using System;\r
+\r
+namespace MainsoftWebApp\r
+{\r
+       public partial class Global : System.Web.HttpApplication\r
+       {\r
+#if NET_2_0\r
+               protected void Application_Error (object sender, EventArgs e)\r
+               {\r
+                       // Code that runs when an unhandled error occurs\r
+                       Exception objErr = Server.GetLastError ().GetBaseException ();\r
+                       MonoTests.SystemWeb.Framework.WebTest.RegisterException (objErr);\r
+                       Server.ClearError ();\r
+               }\r
+\r
+               protected void Application_OnEndRequest (object sender, EventArgs e) {\r
+                       // Ensure the headers are sent\r
+                       MonoTests.SystemWeb.Framework.WebTest.CurrentTest.SendHeaders ();\r
+               }\r
+#endif\r
+       }\r
+}\r
index bb6b26b484f97e73acd1ca53f6159392713ab3b2..ab0dba324411a130edb999a8bd5a758e54360c60 100644 (file)
@@ -1 +1 @@
-<%@ Application Language="C#" Inherits="MainsoftWebApp20.Global" CodeFile="Global.asax.cs" %>\r
+<%@ Application Language="C#" Inherits="MainsoftWebApp.Global" %>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax.cs b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax.cs
deleted file mode 100644 (file)
index 9ef7daa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;\r
-\r
-namespace MainsoftWebApp20\r
-{\r
-       public partial class Global : System.Web.HttpApplication\r
-       {\r
-               protected void Application_Error (object sender, EventArgs e)\r
-               {\r
-                       // Code that runs when an unhandled error occurs\r
-                       Exception objErr = Server.GetLastError ().GetBaseException ();\r
-                       MonoTests.SystemWeb.Framework.WebTest.RegisterException (objErr);\r
-                       Server.ClearError ();\r
-               }\r
-\r
-               protected void Application_OnEndRequest (object sender, EventArgs e) {\r
-                       // Ensure the headers are sent\r
-                       MonoTests.SystemWeb.Framework.WebTest.CurrentTest.SendHeaders ();\r
-               }\r
-       }\r
-}\r
index 871e6eb48c057736ec3bb56aef975353b0782e29..be13a0462231c8906e06c5af75b2906ad6577ceb 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-18  Christian Hergert  <chris@dronelabs.com>
+
+       * wthreads.c: Roll back change for thread-id as it "embraces
+       and extends" the api by passing word-size for thread id on
+       s390 and amd64.
+
 2009-08-18  Christian Hergert  <chris@dronelabs.com>
 
        * security.c:
index 67004ff143c3cfaba83a3d0f7d754cba6a577663..480db8cabf7004442377c07d2f4ede415eb35a12 100644 (file)
@@ -1122,7 +1122,7 @@ guint32 QueueUserAPC (WapiApcProc apc_callback, gpointer handle,
                return (0);
        }
 
-       g_assert (GPOINTER_TO_INT (thread_handle->id) == GetCurrentThreadId ());
+       g_assert (thread_handle->id == GetCurrentThreadId ());
        /* No locking/memory barriers are needed here */
        thread_handle->has_apc = TRUE;
        return(1);
index 4864011c9d6c011cb908a4773561b82e32efc5e6..3810b82fb048e0793bd9ac38d75da481ee258ecf 100644 (file)
@@ -1,3 +1,60 @@
+2009-08-18  Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * class.c (mono_class_get_field_idx): Add fixme for broken
+       behavior for types with multiple fields with the same name.
+       I would rather fix it, but have no idea on how to generate
+       such artifact for testing.
+
+2009-08-18  Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * verify.c (verifier_load_field): We should allow references to
+       fields to be made using the generic type definition. It's up to
+       the loader system to fail invalid ops.
+
+       * verify.c (get_boxable_mono_type): Only uninstantiated GTDs
+       are invalid.
+
+2009-08-18  Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * class.c: Fix usage of mono_metadata_interfaces_from_typedef_full.
+
+       * metadata-internals.h: Fix declaration of 
+       mono_metadata_interfaces_from_typedef_full.
+
+       * metadata.c (mono_metadata_interfaces_from_typedef_full): Add extra
+       heap_alloc_result parameter that controls if the result should be
+       g_malloc'd.
+
+       * metadata.c (mono_metadata_interfaces_from_typedef): Let the resulting
+       array be g_malloc'd and properly document this public API function.
+
+2009-08-18  Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * cil-coff.h: Fix METHOD_HEADER_FORMAT_MASK to be 2 bits and
+       remove METHOD_HEADER_TINY_FORMAT1.
+
+       * reflection.c: Remove reference to METHOD_HEADER_TINY_FORMAT1.
+
+       * metadata.c (mono_metadata_parse_mh_full): Kill tiny format1.
+
+       Both spec and MS uses only 2 bits to enumerate the kind of header.
+       So given that 0x6 and 0x2 are equal under a 2 bits mask, tiny format1
+       is superfluous, only used for tiny headers with odd code lengths.
+
+       This change also make sure that mono doesn't wronly interpret bit 2
+       of fat header flags, which is currently reserved.
+
+2009-08-18  Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * metadata.c (do_mono_metadata_parse_type): Do error
+       checking for element types. Don't abort if presented
+       with a broken type kind.
+
+2009-08-18  Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * metadata.c (mono_metadata_parse_method_signature_full):
+       Gracefully fail bad vararg signatures.
+
 2009-08-18  Christian Hergert  <chris@dronelabs.com>
 
        * profiler.c:
index 1a3ff48f06f66c94440586b4374cb762b8c71674..290b85dc718436d1db63ae6462928fc067773667 100644 (file)
@@ -7,9 +7,8 @@
 /*
  * 25.2.1: Method header type values
  */
-#define METHOD_HEADER_FORMAT_MASK   7
+#define METHOD_HEADER_FORMAT_MASK   3
 #define METHOD_HEADER_TINY_FORMAT   2
-#define METHOD_HEADER_TINY_FORMAT1  6
 #define METHOD_HEADER_FAT_FORMAT    3
 
 /*
index 9272167192e98c6405bf2b614143a5cc9f025675..17086e0a1ac53ca6ffc5f7917471a01b4daa5157 100644 (file)
@@ -4323,7 +4323,7 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token)
 
        if (!class->enumtype) {
                if (!mono_metadata_interfaces_from_typedef_full (
-                           image, type_token, &interfaces, &icount, context)){
+                           image, type_token, &interfaces, &icount, FALSE, context)){
                        mono_loader_unlock ();
                        mono_profiler_class_loaded (class, MONO_PROFILE_FAILED);
                        return NULL;
@@ -5171,6 +5171,7 @@ mono_class_get_field_idx (MonoClass *class, int idx)
                         * class->field.first points to the FieldPtr table, while idx points into the
                         * Field table, so we have to do a search.
                         */
+                       /*FIXME this is broken for types with multiple fields with the same name.*/
                        const char *name = mono_metadata_string_heap (class->image, mono_metadata_decode_row_col (&class->image->tables [MONO_TABLE_FIELD], idx, MONO_FIELD_NAME));
                        int i;
 
index 58ae36c460b46c4a71ba16d8080cf16df91a3827..4213ce3aa53ce3477a177a9041724f92b4da1aef 100644 (file)
@@ -431,6 +431,7 @@ mono_metadata_interfaces_from_typedef_full  (MonoImage             *image,
                                                                                         guint32                table_index,
                                                                                         MonoClass           ***interfaces,
                                                                                         guint                 *count,
+                                                                                        gboolean               heap_alloc_result,
                                                                                         MonoGenericContext    *context) MONO_INTERNAL;
 
 MonoArrayType *
index 01f388ce49856ec3fbe8436c4c76629a66b4a606..1927bcbc226de47d2c45495807e23e16019e2e07 100644 (file)
@@ -1906,10 +1906,16 @@ mono_metadata_parse_method_signature_full (MonoImage *m, MonoGenericContainer *c
 
        for (i = 0; i < method->param_count; ++i) {
                if (*ptr == MONO_TYPE_SENTINEL) {
-                       if (method->call_convention != MONO_CALL_VARARG || def)
-                               g_error ("found sentinel for methoddef or no vararg method");
-                       if (method->sentinelpos >= 0)
-                               g_error ("found sentinel twice in the same signature");
+                       if (method->call_convention != MONO_CALL_VARARG || def) {
+                               g_warning ("found sentinel for methoddef or no vararg method 0x%08x on image %s", def, m->name);
+                               g_free (pattrs);
+                               return NULL;
+                       }
+                       if (method->sentinelpos >= 0) {
+                               g_warning ("found sentinel twice in the same signature for method 0x%08x on image %s", def, m->name);
+                               g_free (pattrs);
+                               return NULL;
+                       }
                        method->sentinelpos = i;
                        ptr++;
                }
@@ -2729,6 +2735,8 @@ do_mono_metadata_parse_type (MonoType *type, MonoImage *m, MonoGenericContainer
                if (!etype)
                        return FALSE;
                type->data.klass = mono_class_from_mono_type (etype);
+               if (!type->data.klass)
+                       return FALSE;
                break;
        }
        case MONO_TYPE_PTR:
@@ -2738,21 +2746,28 @@ do_mono_metadata_parse_type (MonoType *type, MonoImage *m, MonoGenericContainer
                break;
        case MONO_TYPE_FNPTR:
                type->data.method = mono_metadata_parse_method_signature_full (m, container, 0, ptr, &ptr);
+               if (!type->data.method)
+                       return FALSE;
                break;
        case MONO_TYPE_ARRAY:
                type->data.array = mono_metadata_parse_array_full (m, container, ptr, &ptr);
+               if (!type->data.array)
+                       return FALSE;
                break;
        case MONO_TYPE_MVAR:
                if (container && !container->is_method)
                        return FALSE;
        case MONO_TYPE_VAR:
                type->data.generic_param = mono_metadata_parse_generic_param (m, container, type->type, ptr, &ptr);
+               if (!type->data.generic_param)
+                       return FALSE;
                break;
        case MONO_TYPE_GENERICINST:
                ok = do_mono_metadata_parse_generic_class (type, m, container, ptr, &ptr);
                break;
        default:
-               g_error ("type 0x%02x not handled in do_mono_metadata_parse_type", type->type);
+               g_warning ("type 0x%02x not handled in do_mono_metadata_parse_type on image %s", type->type, m->name);
+               return FALSE;
        }
        
        if (rptr)
@@ -2934,19 +2949,6 @@ mono_metadata_parse_mh_full (MonoImage *m, MonoGenericContainer *container, cons
                mh->code_size = flags >> 2;
                mh->code = (unsigned char*)ptr;
                return mh;
-       case METHOD_HEADER_TINY_FORMAT1:
-               mh = mono_image_alloc0 (m, MONO_SIZEOF_METHOD_HEADER);
-               ptr++;
-               mh->max_stack = 8;
-               local_var_sig_tok = 0;
-
-               /*
-                * The spec claims 3 bits, but the Beta2 is
-                * incorrect
-                */
-               mh->code_size = flags >> 2;
-               mh->code = (unsigned char*)ptr;
-               return mh;
        case METHOD_HEADER_FAT_FORMAT:
                fat_flags = read16 (ptr);
                ptr += 2;
@@ -3416,16 +3418,20 @@ mono_metadata_typedef_from_method (MonoImage *meta, guint32 index)
  * mono_metadata_interfaces_from_typedef_full:
  * @meta: metadata context
  * @index: typedef token
+ * @interfaces: Out parameter used to store the interface array
+ * @count: Out parameter used to store the number of interfaces
+ * @heap_alloc_result: if TRUE the result array will be g_malloc'd
+ * @context: The generic context
  * 
  * The array of interfaces that the @index typedef token implements is returned in
- * @interfaces. The number of elemnts in the array is returned in @count.
+ * @interfaces. The number of elements in the array is returned in @count. 
  *
  * LOCKING: Assumes the loader lock is held.
  *
  * Returns: TRUE on success, FALSE on failure.
  */
 gboolean
-mono_metadata_interfaces_from_typedef_full (MonoImage *meta, guint32 index, MonoClass ***interfaces, guint *count, MonoGenericContext *context)
+mono_metadata_interfaces_from_typedef_full (MonoImage *meta, guint32 index, MonoClass ***interfaces, guint *count, gboolean heap_alloc_result, MonoGenericContext *context)
 {
        MonoTableInfo *tdef = &meta->tables [MONO_TABLE_INTERFACEIMPL];
        locator_t loc;
@@ -3464,7 +3470,10 @@ mono_metadata_interfaces_from_typedef_full (MonoImage *meta, guint32 index, Mono
                ++pos;
        }
 
-       result = mono_image_alloc0 (meta, sizeof (MonoClass*) * (pos - start));
+       if (heap_alloc_result)
+               result = g_new0 (MonoClass*, pos - start);
+       else
+               result = mono_image_alloc0 (meta, sizeof (MonoClass*) * (pos - start));
 
        pos = start;
        while (pos < tdef->rows) {
@@ -3485,6 +3494,20 @@ mono_metadata_interfaces_from_typedef_full (MonoImage *meta, guint32 index, Mono
        return TRUE;
 }
 
+/*
+ * @meta: metadata context
+ * @index: typedef token
+ * @count: Out parameter used to store the number of interfaces
+ * 
+ * The array of interfaces that the @index typedef token implements is returned in
+ * @interfaces. The number of elements in the array is returned in @count. The returned
+ * array is g_malloc'd and the caller must free it.
+ *
+ * LOCKING: Acquires the loader lock .
+ *
+ * Returns: the interface array on success, NULL on failure.
+ */
+
 MonoClass**
 mono_metadata_interfaces_from_typedef (MonoImage *meta, guint32 index, guint *count)
 {
@@ -3492,7 +3515,7 @@ mono_metadata_interfaces_from_typedef (MonoImage *meta, guint32 index, guint *co
        gboolean rv;
 
        mono_loader_lock ();
-       rv = mono_metadata_interfaces_from_typedef_full (meta, index, &interfaces, count, NULL);
+       rv = mono_metadata_interfaces_from_typedef_full (meta, index, &interfaces, count, TRUE, NULL);
        mono_loader_unlock ();
        if (rv)
                return interfaces;
index 8acb1b6aa71b608cef85497a678d66a1609b5062..e472ed31d38c922267bcc6d1d4f094a04080fd2d 100644 (file)
@@ -6694,7 +6694,6 @@ mono_method_body_get_object (MonoDomain *domain, MonoMethod *method)
        format = flags & METHOD_HEADER_FORMAT_MASK;
        switch (format){
        case METHOD_HEADER_TINY_FORMAT:
-       case METHOD_HEADER_TINY_FORMAT1:
                local_var_sig_token = 0;
                break;
        case METHOD_HEADER_FAT_FORMAT:
index 6496ab8b3a787d1b030b29000e0e3f054a472d62..0b44cc8b8937e945a554fb0a91dc5e2a88e346cd 100644 (file)
@@ -813,15 +813,9 @@ verifier_load_field (VerifyContext *ctx, int token, MonoClass **out_klass, const
                return NULL;
        }
 
-       if (!mono_type_is_valid_in_context (ctx, &klass->byval_arg) || !mono_type_is_valid_in_context (ctx, &field->parent->byval_arg))
+       if (!mono_type_is_valid_in_context (ctx, &klass->byval_arg))
                return NULL;
 
-       if (klass->generic_container || field->parent->generic_container) {
-               ADD_VERIFY_ERROR2 (ctx, g_strdup_printf ("Cannot reference a field using the generic type definition for %s at 0x%04x", opcode, ctx->ip_offset), MONO_EXCEPTION_BAD_IMAGE);
-               return NULL;
-       }
-       
-
        *out_klass = klass;
        return field;
 }
@@ -2077,7 +2071,7 @@ get_boxable_mono_type (VerifyContext* ctx, int token, const char *opcode)
        if (!(class = mono_class_from_mono_type (type)))
                ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Could not retrieve type token for %s at 0x%04x", opcode, ctx->ip_offset));
 
-       if (class->generic_container)
+       if (class->generic_container && type->type != MONO_TYPE_GENERICINST)
                CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Cannot use the generic type definition in a boxable type position for %s at 0x%04x", opcode, ctx->ip_offset));      
 
        check_unverifiable_type (ctx, type);
index f82da8345ab7bbe2282e42efcc6ae9b63e0ae035..7d03b185022f79402ba5e5796eeafcf2fb1a1900 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-17 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * valid_generic_type_definition_on_boxing_position.cs: Valid encoding of GTD on
+       box position.
+
 2009-08-14 Rodrigo Kumpera  <rkumpera@novell.com>
 
        *unverifiable_ldobj_with_generic_type_definition.il: Regression test for
diff --git a/mono/tests/verifier/valid_generic_type_definition_on_boxing_position.cs b/mono/tests/verifier/valid_generic_type_definition_on_boxing_position.cs
new file mode 100644 (file)
index 0000000..f527a88
--- /dev/null
@@ -0,0 +1,28 @@
+using System;
+
+public class Bar<T> {
+       public int Z {get;set;}
+}
+
+public class Foo<T> {
+       public T Test {get;set;}
+       public int Z (Bar<T> t) {
+               return t.Z;
+       }
+}
+
+public struct Cat<T> {
+       T t;
+       public void Test () {
+               Console.WriteLine (GetType ());
+       }
+}
+
+
+class Driver {
+       static void Main () {
+               Cat<int> c = new Cat<int> ();
+               c.Test ();
+               new Foo<double> ().Z(new Bar<double>());
+       }
+}
\ No newline at end of file