LibJS: Add support for running test-js with the bytecode interpreter

This obviously won't actually successfully run the test suite until
more of the AST expressions used by the test suite are supported.
This commit is contained in:
Gunnar Beutner 2021-06-12 05:49:25 +02:00 committed by Andreas Kling
parent 6a78b44c22
commit a612c22278
Notes: sideshowbarker 2024-07-18 12:22:53 +09:00
2 changed files with 46 additions and 2 deletions
Userland/Libraries/LibTest

View file

@ -14,6 +14,8 @@ namespace Test::JS {
RefPtr<::JS::VM> g_vm;
bool g_collect_on_every_allocation = false;
bool g_run_bytecode = false;
bool g_dump_bytecode = false;
String g_currently_running_test;
String g_test_glob;
HashMap<String, FunctionWithLength> s_exposed_global_functions;
@ -103,6 +105,8 @@ int main(int argc, char** argv)
});
args_parser.add_option(print_json, "Show results as JSON", "json", 'j');
args_parser.add_option(g_collect_on_every_allocation, "Collect garbage after every allocation", "collect-often", 'g');
args_parser.add_option(g_run_bytecode, "Use the bytecode interpreter", "run-bytecode", 'b');
args_parser.add_option(g_dump_bytecode, "Dump the bytecode", "dump-bytecode", 'd');
args_parser.add_option(g_test_glob, "Only run tests matching the given glob", "filter", 'f', "glob");
for (auto& entry : g_extra_args)
args_parser.add_option(*entry.key, entry.value.get<0>().characters(), entry.value.get<1>().characters(), entry.value.get<2>());
@ -116,6 +120,11 @@ int main(int argc, char** argv)
AK::set_debug_enabled(false);
}
if (g_dump_bytecode && !g_run_bytecode) {
warnln("--dump-bytecode can only be used when --run-bytecode is specified.");
return 1;
}
String test_root;
if (specified_test_root) {