[wasm] Fix debugger tests (#49206)
authorAnkit Jain <radical@gmail.com>
Wed, 10 Mar 2021 14:52:35 +0000 (09:52 -0500)
committerGitHub <noreply@github.com>
Wed, 10 Mar 2021 14:52:35 +0000 (09:52 -0500)
* [wasm][debugger] Correctly skip static properties when iterating type

.. members.

* [wasm][debugger][tests] cleanup

* [wasm][debugger][tests] Use SingleLine for the logger

src/mono/mono/mini/mini-wasm-debugger.c
src/mono/wasm/debugger/BrowserDebugHost/Startup.cs
src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
src/mono/wasm/debugger/DebuggerTestSuite/Inspector.cs
src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs
src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs
src/mono/wasm/debugger/tests/debugger-test/debugger-cfo-test.cs

index 8795abc..e93320a 100644 (file)
@@ -1272,6 +1272,9 @@ handle_parent:
                                continue;
                        }
 
+                       if (p->get->flags & METHOD_ATTRIBUTE_STATIC)
+                               continue;
+
                        EM_ASM ({
                                MONO.mono_wasm_add_properties_var ($0, { field_offset: $1, is_own: $2, attr: $3, owner_class: $4 });
                        }, p->name, pnum, is_own, p->attrs, klass_name);
index 0a28e88..c4de27f 100644 (file)
@@ -153,8 +153,10 @@ namespace Microsoft.WebAssembly.Diagnostics
                     var endpoint = new Uri($"ws://{devToolsHost.Authority}{context.Request.Path}");
                     try
                     {
-                        using ILoggerFactory loggerFactory = LoggerFactory.Create(
-                            builder => builder.AddConsole().AddFilter(null, LogLevel.Information));
+                        using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
+                            builder.AddSimpleConsole(options => options.SingleLine = true)
+                                   .AddFilter(null, LogLevel.Information)
+                        );
 
                         context.Request.Query.TryGetValue("urlSymbolServer", out StringValues urlSymbolServerList);
                         var proxy = new DebuggerProxy(loggerFactory, urlSymbolServerList.ToList());
index 1e9f155..fdd23b0 100644 (file)
@@ -5,13 +5,9 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-using System.Net.WebSockets;
 using System.Reflection;
-using System.Text;
-using System.Text.RegularExpressions;
 using System.Threading;
 using System.Threading.Tasks;
-using Microsoft.Extensions.Logging;
 using Microsoft.WebAssembly.Diagnostics;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
@@ -430,7 +426,6 @@ namespace DebuggerTests
                 AssertEqual(function_name, wait_res["callFrames"]?[0]?["functionName"]?.Value<string>(), top_frame?.ToString());
             }
 
-            Console.WriteLine(top_frame);
             if (script_loc != null && line >= 0)
                 CheckLocation(script_loc, line, column, scripts, top_frame["location"]);
 
index 8c9edc6..c555cd0 100644 (file)
@@ -41,8 +41,9 @@ namespace DebuggerTests
             _cancellationTokenSource = new CancellationTokenSource();
             Token = _cancellationTokenSource.Token;
 
-            _loggerFactory = LoggerFactory.Create(
-                builder => builder.AddConsole().AddFilter(null, LogLevel.Trace));
+            _loggerFactory = LoggerFactory.Create(builder =>
+                    builder.AddSimpleConsole(options => options.SingleLine = true)
+                           .AddFilter(null, LogLevel.Trace));
 
             Client = new InspectorClient(_loggerFactory.CreateLogger<InspectorClient>());
             _logger = _loggerFactory.CreateLogger<Inspector>();
index d50a845..7a5c30d 100644 (file)
@@ -38,7 +38,8 @@ namespace Microsoft.WebAssembly.Diagnostics
                     })
                     .ConfigureLogging(logging =>
                     {
-                        logging.AddConsole();
+                        logging.AddSimpleConsole(options => options.SingleLine = true)
+                               .AddFilter(null, LogLevel.Information);
                     })
                     .ConfigureServices((ctx, services) =>
                     {
index 9e96455..d168447 100644 (file)
@@ -718,7 +718,7 @@ namespace DebuggerTests
                     Day = TNumber(2),
                     Year = TNumber(2020),
                     DayOfWeek = TEnum("System.DayOfWeek", "Thursday")
-                }, "dto_props", num_fields: 22);
+                }, "dto_props", num_fields: 20);
 
             var DT = new DateTime(2004, 10, 15, 1, 2, 3);
             var DTO = new DateTimeOffset(dt0, new TimeSpan(2, 14, 0));
index 66a964a..31dfe11 100644 (file)
@@ -58,6 +58,9 @@ namespace DebuggerTests
         public DateTime[] DTArray { get { return new DateTime[] { new DateTime(6, 7, 8, 9, 10, 11), new DateTime(1, 2, 3, 4, 5, 6) }; } }
         public DateTime DTAutoProperty { get; set; }
         public string StringField;
+
+        private static DateTime PrivateStaticDTProp => new DateTime(6, 5, 4, 3, 2, 1);
+        public static DateTime PublicStaticDTProp => new DateTime(3, 6, 1, 7, 9, 4);
     }
 
     struct StructWithProperties
@@ -71,5 +74,8 @@ namespace DebuggerTests
         public DateTime[] DTArray { get { return new DateTime[] { new DateTime(6, 7, 8, 9, 10, 11), new DateTime(1, 2, 3, 4, 5, 6) }; } }
         public DateTime DTAutoProperty { get; set; }
         public string StringField;
+
+        private static DateTime PrivateStaticDTProp => new DateTime(6, 5, 4, 3, 2, 1);
+        public static DateTime PublicStaticDTProp => new DateTime(3, 6, 1, 7, 9, 4);
     }
 }