Skip to content

Commit

Permalink
[wasm][debugger] Run debugger test in codespace (dotnet#64746)
Browse files Browse the repository at this point in the history
* Tmp change for debugging.

* Added chromium, needed for running debugger tests.

* Corrected line breaking, removed suso.

* Removed update duplicate.

* Prevent regex on null.

* Set special env variable only for containers.

* Locally docker build crashes without it.

* Applied @eerhardt suggestion.

* Moved env assignment to a place that is executed by onCreateCommand.sh

* Revert accidential new line removal.

* Upgrade is unnecessary, works without it.

* Moved all logic to C# code.

* Remove duplicated line.

* Applied @Thays's and @lewing's comments.

* Enabling @radical approach for chromium installation.

Co-authored-by: Ankit Jain <radical@gmail.com>
  • Loading branch information
ilonatommy and radical committed Feb 25, 2022
1 parent 31bd72d commit ef785f5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
17 changes: 16 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,19 @@ RUN curl -sSL "https://netcorenativeassets.blob.core.windows.net/resource-packag
&& unzip ./v8.zip -d /usr/local/v8 \
&& echo $'#!/usr/bin/env bash\n\
"/usr/local/v8/d8" --snapshot_blob="/usr/local/v8/snapshot_blob.bin" "$@"\n' > /usr/local/bin/v8 \
&& chmod +x /usr/local/bin/v8
&& chmod +x /usr/local/bin/v8

# install chromium dependencies to run debugger tests:
RUN sudo apt-get install libnss3 -y \
&& apt-get install libatk1.0-0 -y \
&& apt-get install libatk-bridge2.0-0 -y \
&& apt-get install libcups2 -y \
&& apt-get install libdrm2 -y \
&& apt-get install libxkbcommon-x11-0 -y \
&& apt-get install libxcomposite-dev -y \
&& apt-get install libxdamage1 -y \
&& apt-get install libxrandr2 -y \
&& apt-get install libgbm-dev -y \
&& apt-get install libpango-1.0-0 -y \
&& apt-get install libcairo2 -y \
&& apt-get install libasound2 -y
14 changes: 11 additions & 3 deletions src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,13 @@ public async Task LaunchAndServe(ProcessStartInfo psi,
if (tcs.Task.IsCompleted)
return;
var match = parseConnection.Match(str);
if (match.Success)
if (!string.IsNullOrEmpty(str))
{
tcs.TrySetResult(match.Groups[1].Captures[0].Value);
var match = parseConnection.Match(str);
if (match.Success)
{
tcs.TrySetResult(match.Groups[1].Captures[0].Value);
}
}
};

Expand Down Expand Up @@ -197,6 +200,11 @@ public void Configure(IApplicationBuilder app, IOptionsMonitor<TestHarnessOption
var psi = new ProcessStartInfo();
psi.Arguments = $"--headless --disable-gpu --lang=en-US --incognito --remote-debugging-port={devToolsUrl.Port} http://{TestHarnessProxy.Endpoint.Authority}/{options.PagePath}";
if (File.Exists("/.dockerenv"))
{
Logger.LogInformation("Detected a container, disabling sandboxing for debugger tests.");
psi.Arguments = "--no-sandbox " + psi.Arguments;
}
psi.UseShellExecute = false;
psi.FileName = options.ChromePath;
psi.RedirectStandardError = true;
Expand Down

0 comments on commit ef785f5

Please sign in to comment.