Skip to content

Commit

Permalink
test: use gdb to capture core on tests
Browse files Browse the repository at this point in the history
gdb let us save core dumps on Linux (similar to what we do on OS X). For
some reason, GitHub Actions are not generating system core dumps, so
this is a good alternative to keep tests working when we move.

PR-URL: #323
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
mmarchini committed Jan 9, 2020
1 parent 9a58d8c commit 6f27d84
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,14 @@ function spawnWithTimeout(cmd, cb) {
}

function saveCoreLinux(executable, scenario, core, cb) {
const cmd = `ulimit -c unlimited && ${executable} ` +
`--abort_on_uncaught_exception --expose_externalize_string ` +
`${path.join(exports.fixturesDir, scenario)}; `;
// TODO(mmarchini): Let users choose if they want system generated core dumps
// or gdb generated core dumps.
const cmd = `gdb ${executable} --batch -ex 'run ` +
`--abort-on-uncaught-exception --expose-externalize-string ` +
`${path.join(exports.fixturesDir, scenario)}' -ex 'generate-core-file ` +
`${core}'`;
spawnWithTimeout(cmd, () => {
// FIXME (mmarchini): Should also handle different core system settings.
spawnWithTimeout(`mv ./core ${core}`, cb);
cb()
});
}

Expand Down

0 comments on commit 6f27d84

Please sign in to comment.