Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SIGINT handling #497

Merged
merged 4 commits into from
Jul 12, 2023
Merged

Conversation

oetr
Copy link
Contributor

@oetr oetr commented Jul 5, 2023

This PR allows the fuzzer to gracefully shut down after the user has pressed CTRL-C. The coverage reports, sync/async suggestions, and registered custom hooks will be printed just like they should be after a regular shut down.

@oetr oetr force-pushed the FUZZ-525_graceful_shutdown_on_ctrl_c branch 4 times, most recently from 177f2b5 to ac5183b Compare July 7, 2023 18:03
@oetr oetr changed the title Add signal handling Add SIGINT handling Jul 7, 2023
@oetr oetr force-pushed the FUZZ-525_graceful_shutdown_on_ctrl_c branch from ac5183b to 3328b13 Compare July 7, 2023 19:41
@oetr oetr changed the title Add SIGINT handling Add SIGINT handling on Linux and macOS Jul 7, 2023
@oetr oetr marked this pull request as ready for review July 7, 2023 20:45
@oetr oetr requested a review from a team July 7, 2023 20:46
packages/core/core.ts Outdated Show resolved Hide resolved
packages/core/core.ts Outdated Show resolved Hide resolved
packages/fuzzer/utils.h Outdated Show resolved Hide resolved
packages/fuzzer/utils.h Outdated Show resolved Hide resolved
packages/core/core.ts Outdated Show resolved Hide resolved
packages/fuzzer/utils.cpp Outdated Show resolved Hide resolved
tests/signal-handlers/signal-handlers.test.js Outdated Show resolved Hide resolved
tests/helpers.js Show resolved Hide resolved
oetr added 3 commits July 11, 2023 10:48
The FuzzTestBuilder previously used for testing bug detectors has
turned out to be quite useful for other tests. Here we move it into
the "tests/" directory so that it can be used by all tests who wish to
run fuzz tests in dedicated processes.
In async mode, we can register a callback directly in Node.  In sync
mode, the event loop is blocked until the fuzzing process has
finished. Hence, we register the callback for SIGINT directly in our
native addon.
@bertschneider bertschneider force-pushed the FUZZ-525_graceful_shutdown_on_ctrl_c branch from 3328b13 to f75fc01 Compare July 11, 2023 09:00
Signal handling in Node.js on Windows is only rudimentary supported.
Specifically using `process.kill`, like the test does to interrupt
itself, will unconditionally terminate the process. The signal
processing works in manual tests, though.
@bertschneider bertschneider force-pushed the FUZZ-525_graceful_shutdown_on_ctrl_c branch from cc322de to 35295be Compare July 12, 2023 12:23
@bertschneider bertschneider changed the title Add SIGINT handling on Linux and macOS Add SIGINT handling Jul 12, 2023
@bertschneider bertschneider merged commit f73164a into main Jul 12, 2023
6 checks passed
@bertschneider bertschneider deleted the FUZZ-525_graceful_shutdown_on_ctrl_c branch July 12, 2023 14:16
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.

None yet

3 participants