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

fuzzer: add a cargo-bolero fuzz target type #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ekleog
Copy link
Contributor

@Ekleog Ekleog commented Jul 19, 2022

This is untested yet, but I'm opening before doing a try-deploy on one of the nayduck machines so there's a trace of what's being deployed

@Ekleog
Copy link
Contributor Author

Ekleog commented Jul 20, 2022

I have now tested it on one worker (worker2), and can confirm that the current fuzzers seem to still work well with this change.

@mina86 mina86 force-pushed the master branch 3 times, most recently from 57fcdaf to 0b2d8da Compare August 1, 2022 20:56
@mina86
Copy link
Contributor

mina86 commented Aug 18, 2022

Didn’t notice this PR. Is this still a thing?

@Ekleog-NEAR
Copy link
Contributor

Yup it is! I have deployed it only on worker2 for now and am planning on checking it actually works well with cargo-bolero fuzz targets too before proceeding with deployment, but it can already be reviewed and should undergo only minor changes on the cargo-bolero branch of the if :)

Comment on lines +507 to +541
if self.target.get('type') == 'bolero':
self.proc = subprocess.Popen(
[
'cargo',
'bolero',
'test',
'--fake-nightly-toolchain',
f'--corpus-dir={corpus.corpus_for(self.target)}',
f'--crashes-dir={corpus.artifacts_for(self.target)}',
'-p',
self.target['crate'],
self.target['runner'],
] + [f'--engine-args="{flag}"' for flag in flags],
cwd = self.repo_dir,
start_new_session = True,
stdout = self.log_file,
stderr = subprocess.STDOUT,
)
else:
self.proc = subprocess.Popen( # pylint: disable=consider-using-with
[
'cargo',
'fuzz',
'run',
self.target['runner'],
'--',
str(corpus.corpus_for(self.target)),
str(corpus.artifacts_for(self.target)),
f'-artifact_prefix={corpus.artifacts_for(self.target)}/',
] + flags,
cwd=self.repo_dir / self.target['crate'],
start_new_session=True,
stdout=self.log_file,
stderr=subprocess.STDOUT,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatively:

Suggested change
if self.target.get('type') == 'bolero':
self.proc = subprocess.Popen(
[
'cargo',
'bolero',
'test',
'--fake-nightly-toolchain',
f'--corpus-dir={corpus.corpus_for(self.target)}',
f'--crashes-dir={corpus.artifacts_for(self.target)}',
'-p',
self.target['crate'],
self.target['runner'],
] + [f'--engine-args="{flag}"' for flag in flags],
cwd = self.repo_dir,
start_new_session = True,
stdout = self.log_file,
stderr = subprocess.STDOUT,
)
else:
self.proc = subprocess.Popen( # pylint: disable=consider-using-with
[
'cargo',
'fuzz',
'run',
self.target['runner'],
'--',
str(corpus.corpus_for(self.target)),
str(corpus.artifacts_for(self.target)),
f'-artifact_prefix={corpus.artifacts_for(self.target)}/',
] + flags,
cwd=self.repo_dir / self.target['crate'],
start_new_session=True,
stdout=self.log_file,
stderr=subprocess.STDOUT,
)
if self.target.get('type') == 'bolero':
cmd = [
'cargo',
'bolero',
'test',
'--fake-nightly-toolchain',
f'--corpus-dir={corpus.corpus_for(self.target)}',
f'--crashes-dir={corpus.artifacts_for(self.target)}',
'-p',
self.target['crate'],
self.target['runner'],
] + [f'--engine-args="{flag}"' for flag in flags]
cwd = self.repo_dir
else:
cmd = [
'cargo',
'fuzz',
'run',
self.target['runner'],
'--',
str(corpus.corpus_for(self.target)),
str(corpus.artifacts_for(self.target)),
f'-artifact_prefix={corpus.artifacts_for(self.target)}/',
] + flags
cwd = self.repo_dir / self.target['crate']
self.proc = subprocess.Popen( # pylint: disable=consider-using-with
cmd,
cwd=cwd,
start_new_session=True,
stdout=self.log_file,
stderr=subprocess.STDOUT,
)

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.

3 participants