test262-runner: Support multi-line YAML flags

The metadata parser only handled inline flags (e.g. `flags: [noStrict]`)
but not the YAML block list format:

  flags:
    - noStrict

This caused ~130 test/staging/sm test262 tests failures from running
them in both strict and sloppy modes by test262-runner.
This commit is contained in:
Ivan Krasilnikov
2026-03-29 17:53:35 +08:00
committed by Andreas Kling
parent 0e438c01d8
commit b2db3574c5
Notes: github-actions[bot] 2026-03-29 11:22:15 +00:00
+38 -22
View File
@@ -287,8 +287,32 @@ static ErrorOr<TestMetadata, String> extract_metadata(StringView source)
Vector<StringView> include_list;
bool parsing_includes_list = false;
bool parsing_flags_block = false;
bool has_phase = false;
auto apply_flag = [&](StringView flag) {
if (flag == "raw"sv) {
metadata.strict_mode = StrictMode::NoStrict;
metadata.harness_files.clear();
} else if (flag == "noStrict"sv) {
metadata.strict_mode = StrictMode::NoStrict;
} else if (flag == "onlyStrict"sv) {
metadata.strict_mode = StrictMode::OnlyStrict;
} else if (flag == "module"sv) {
VERIFY(metadata.strict_mode == StrictMode::Both);
metadata.program_type = JS::RustIntegration::ProgramType::Module;
metadata.strict_mode = StrictMode::NoStrict;
} else if (flag == "async"sv) {
metadata.harness_files.append(async_include);
metadata.is_async = true;
} else if (flag == "CanBlockIsFalse"sv) {
// NOTE: This should only be skipped if AgentCanSuspend is set to true. This is currently always the case.
// Ideally we would check that, but we don't have the VM by this stage. So for now, we rely on that
// assumption.
metadata.skip_test = SkipTest::Yes;
}
};
for (auto raw_line : lines) {
if (!failed_message.is_empty())
break;
@@ -352,30 +376,22 @@ static ErrorOr<TestMetadata, String> extract_metadata(StringView source)
}
}
if (parsing_flags_block) {
if (line.starts_with('-')) {
apply_flag(second_word(line));
continue;
} else {
parsing_flags_block = false;
}
}
if (line.starts_with("flags:"sv)) {
auto flags = parse_list(line);
for (auto flag : flags) {
if (flag == "raw"sv) {
metadata.strict_mode = StrictMode::NoStrict;
metadata.harness_files.clear();
} else if (flag == "noStrict"sv) {
metadata.strict_mode = StrictMode::NoStrict;
} else if (flag == "onlyStrict"sv) {
metadata.strict_mode = StrictMode::OnlyStrict;
} else if (flag == "module"sv) {
VERIFY(metadata.strict_mode == StrictMode::Both);
metadata.program_type = JS::RustIntegration::ProgramType::Module;
metadata.strict_mode = StrictMode::NoStrict;
} else if (flag == "async"sv) {
metadata.harness_files.append(async_include);
metadata.is_async = true;
} else if (flag == "CanBlockIsFalse"sv) {
// NOTE: This should only be skipped if AgentCanSuspend is set to true. This is currently always the case.
// Ideally we would check that, but we don't have the VM by this stage. So for now, we rely on that
// assumption.
metadata.skip_test = SkipTest::Yes;
}
if (!flags.is_empty()) {
for (auto flag : flags)
apply_flag(flag);
} else if (!line.contains('[')) {
parsing_flags_block = true;
}
} else if (line.starts_with("includes:"sv)) {
auto files = parse_list(line);