Skip to content

How to configure the corpus for jest in regression mode? #637

@karfau

Description

@karfau

I read through https://github.com/CodeIntelligenceTesting/jazzer.js/blob/main/docs/jest-integration.md and am also aware about https://github.com/CodeIntelligenceTesting/jazzer.js/blob/main/packages/core/options.ts but I was not able to derive, how to configure those tests where to pick the data from.

Do they have to stay in the top level as crash-<hash> files?

I would love to point to a separate directory like when passing "corpus" as an argument, so that the test runner picks up the files contained in it and uses those for the regression test.
Is that possible?

I enabled verbose logging and even though the test is being reported as being run, what data is passed to it if no input is being found in regression mode?

Because I found this code:

static readonly defaultCorpusDirectory = ".cifuzz-corpus";

I tried to add my crash- files to the .cifuzz-corpus directory, but didn't see anything happening.
When running the tests in regression mode I observed that it creates a directory structure inside that folder, which reflects the name of the test file, the describe message and the it.fuzz/test.fuzz messages, so I also added my crash files there, but it didn't change anything.

To understand what is being passed to the targets, I added the following to my test suite:

describe('ensure previous fuzzer findings are not reintroduced', () => {
	test.fuzz('console.log', (data) => console.log(data.toString()));
});

which only leads to the following output:
image

Here is where you can see all the changes I did so far: xmldom/xmldom#556
(2 commits pushed to that branch at the point of posting this)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions