1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:12:08 +00:00

test-js: Run with the JavaScript bytecode VM by default

The AST interpreter is still available behind a new `--ast` flag.

We switch to testing with bytecode in the big run-tests battery on
SerenityOS. Lagom CI continues running both AST and BC.
This commit is contained in:
Andreas Kling 2023-07-25 18:47:27 +02:00
parent 72516ca101
commit 96d5a1edb0
2 changed files with 8 additions and 8 deletions

View file

@ -667,10 +667,10 @@ if (BUILD_LAGOM)
set_tests_properties(JS PROPERTIES ENVIRONMENT SERENITY_SOURCE_DIR=${SERENITY_PROJECT_ROOT}) set_tests_properties(JS PROPERTIES ENVIRONMENT SERENITY_SOURCE_DIR=${SERENITY_PROJECT_ROOT})
add_test( add_test(
NAME JS-Bytecode NAME JS-AST
COMMAND test-js -b --show-progress=false COMMAND test-js --ast --show-progress=false
) )
set_tests_properties(JS-Bytecode PROPERTIES ENVIRONMENT SERENITY_SOURCE_DIR=${SERENITY_PROJECT_ROOT}) set_tests_properties(JS-AST PROPERTIES ENVIRONMENT SERENITY_SOURCE_DIR=${SERENITY_PROJECT_ROOT})
# Extra tests from Tests/LibJS # Extra tests from Tests/LibJS
lagom_test(../../Tests/LibJS/test-invalid-unicode-js.cpp LIBS LibJS) lagom_test(../../Tests/LibJS/test-invalid-unicode-js.cpp LIBS LibJS)

View file

@ -93,7 +93,7 @@ int main(int argc, char** argv)
#endif #endif
bool print_json = false; bool print_json = false;
bool per_file = false; bool per_file = false;
bool use_bytecode = false; bool use_ast_interpreter = false;
StringView specified_test_root; StringView specified_test_root;
DeprecatedString common_path; DeprecatedString common_path;
DeprecatedString test_glob; DeprecatedString test_glob;
@ -119,7 +119,7 @@ int main(int argc, char** argv)
args_parser.add_option(print_json, "Show results as JSON", "json", 'j'); args_parser.add_option(print_json, "Show results as JSON", "json", 'j');
args_parser.add_option(per_file, "Show detailed per-file results as JSON (implies -j)", "per-file", 0); args_parser.add_option(per_file, "Show detailed per-file results as JSON (implies -j)", "per-file", 0);
args_parser.add_option(g_collect_on_every_allocation, "Collect garbage after every allocation", "collect-often", 'g'); args_parser.add_option(g_collect_on_every_allocation, "Collect garbage after every allocation", "collect-often", 'g');
args_parser.add_option(use_bytecode, "Use the bytecode interpreter", "run-bytecode", 'b'); args_parser.add_option(use_ast_interpreter, "Enable JavaScript AST interpreter (deprecated)", "ast", 0);
args_parser.add_option(JS::Bytecode::g_dump_bytecode, "Dump the bytecode", "dump-bytecode", 'd'); args_parser.add_option(JS::Bytecode::g_dump_bytecode, "Dump the bytecode", "dump-bytecode", 'd');
args_parser.add_option(test_glob, "Only run tests matching the given glob", "filter", 'f', "glob"); args_parser.add_option(test_glob, "Only run tests matching the given glob", "filter", 'f', "glob");
for (auto& entry : g_extra_args) for (auto& entry : g_extra_args)
@ -137,12 +137,12 @@ int main(int argc, char** argv)
AK::set_debug_enabled(false); AK::set_debug_enabled(false);
} }
if (JS::Bytecode::g_dump_bytecode && !use_bytecode) { if (JS::Bytecode::g_dump_bytecode && use_ast_interpreter) {
warnln("--dump-bytecode can only be used when --run-bytecode is specified."); warnln("--dump-bytecode can not be used when --ast is specified.");
return 1; return 1;
} }
JS::Bytecode::Interpreter::set_enabled(use_bytecode); JS::Bytecode::Interpreter::set_enabled(!use_ast_interpreter);
DeprecatedString test_root; DeprecatedString test_root;