summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/test-js.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/test-js.cpp b/Userland/test-js.cpp
index a724f9e267..10c0810ec7 100644
--- a/Userland/test-js.cpp
+++ b/Userland/test-js.cpp
@@ -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")) {