mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
test-js: Add -g option to run a garbage collection on each allocation
This is very slow, but very good at flushing out GC bugs. :^)
This commit is contained in:
parent
01ff17d374
commit
687aad01be
1 changed files with 5 additions and 0 deletions
|
@ -43,6 +43,8 @@
|
|||
|
||||
#define TOP_LEVEL_TEST_NAME "__$$TOP_LEVEL$$__"
|
||||
|
||||
static bool collect_on_every_allocation = false;
|
||||
|
||||
enum class TestResult {
|
||||
Pass,
|
||||
Fail,
|
||||
|
@ -257,6 +259,8 @@ JSFileResult TestRunner::run_file_test(const String& test_path)
|
|||
double start_time = get_time_in_ms();
|
||||
auto interpreter = JS::Interpreter::create<TestRunnerGlobalObject>();
|
||||
|
||||
interpreter->heap().set_should_collect_on_every_allocation(collect_on_every_allocation);
|
||||
|
||||
if (!m_test_program) {
|
||||
auto result = parse_file(String::format("%s/test-common.js", m_test_root.characters()));
|
||||
if (result.is_error()) {
|
||||
|
@ -567,6 +571,7 @@ int main(int argc, char** argv)
|
|||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(print_times, "Show duration of each test", "show-time", 't');
|
||||
args_parser.add_option(collect_on_every_allocation, "Collect garbage after every allocation", "collect-often", 'g');
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
if (getenv("DISABLE_DBG_OUTPUT")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue