Skip to content

EW-8447 Add regression test for CPU profiling#2558

Merged
harrishancock merged 4 commits intomainfrom
harris/inspector-test
Aug 20, 2024
Merged

EW-8447 Add regression test for CPU profiling#2558
harrishancock merged 4 commits intomainfrom
harris/inspector-test

Conversation

@harrishancock
Copy link
Copy Markdown
Collaborator

This PR adds a regression test for the CPU profiling bug reported in #1754 and fixed in #2497. It is based on @mrbbot's original reproduction.

I backported the test to the commit just prior to #2497, and confirmed that the test caught the original breakage.

I wrote the test in JavaScript, because it seemed to have the richest ecosystem of tools for working with the Chrome Devtool Protocol. I originally intended to use Playwright to initiate a CDP connection to workerd, but it seemed to make too many assumptions that it was connecting to a browser. I tried the chrome-remote-interface library next, and it seemed to work well.

Fixes #1754.

@harrishancock harrishancock requested review from a team as code owners August 20, 2024 12:50
@harrishancock harrishancock requested review from a-robinson, danlapid, hoodmane and penalosa and removed request for a-robinson and hoodmane August 20, 2024 12:50
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try

npm install -g pnpm@latest-7
pnpm install

I believe it should revert most changes to this file :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that helped.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amusingly I had to redo this because #2555 just updated us to pnpm 9.

@harrishancock harrishancock force-pushed the harris/inspector-test branch from d842722 to 9a6acf3 Compare August 20, 2024 13:09
@harrishancock harrishancock force-pushed the harris/inspector-test branch from 9a6acf3 to 54212f1 Compare August 20, 2024 13:15
Copy link
Copy Markdown
Collaborator

@danlapid danlapid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! very concise and clear

In a subsequent commit, I want to make a //src/workerd/server/tests package, which requires this preliminary refactoring.
This commit adds a JavaScript helper library to make workerd subprocess management easier in JavaScript tests. It uses workerd's `--control-fd` feature to fulfill promises once expected ports have come online, similar to how compile-tests/ works.

A subsequent commit will depend on this in a new js_test() target.
I needed to update our pnpm-lock.yaml file so I can use chrome-remote-interface in a Bazel js_test() target.

Process:
- npm install --save-dev chrome-remote-interface
- npm install -g pnpm@latest
- pnpm install
This commit adds a regression test for the CPU profiling bug reported in #1754 and fixed in #2497. It is based on @mrbbot's original reproduction.

I backported the test to the commit just prior to #2497, and confirmed that the test caught the original breakage.

I wrote the test in JavaScript, because it seemed to have the richest ecosystem of tools for working with the Chrome Devtool Protocol. I originally intended to use Playwright to initiate a CDP connection to workerd, but it seemed to make too many assumptions that it was connecting to a browser. I tried the [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface) library next, and it seemed to work well.

Fixes #1754.
@harrishancock harrishancock force-pushed the harris/inspector-test branch from 0feda66 to c6223da Compare August 20, 2024 14:12
@harrishancock harrishancock merged commit 249464f into main Aug 20, 2024
@harrishancock harrishancock deleted the harris/inspector-test branch August 20, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug Report — CPU profiling reports entire execution as (program)

3 participants