mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
LibJS: Skip test262 tests with the CanBlockIsFalse flag
From test262 documentation, this flag means: The test file should only be run when the [[CanBlock]] property of the Agent Record executing the file is `false`. This patch stubs out the accessor for that internal slot and skips tests with the CanBlockIsFalse if that internal slot is true.
This commit is contained in:
parent
a7ff65a0c6
commit
a7073c3f1f
5 changed files with 49 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <LibJS/Bytecode/Interpreter.h>
|
||||
#include <LibJS/Contrib/Test262/GlobalObject.h>
|
||||
#include <LibJS/Parser.h>
|
||||
#include <LibJS/Runtime/Agent.h>
|
||||
#include <LibJS/Runtime/VM.h>
|
||||
#include <LibJS/Runtime/ValueInlines.h>
|
||||
#include <LibJS/Script.h>
|
||||
|
@ -169,6 +170,11 @@ enum class StrictMode {
|
|||
OnlyStrict
|
||||
};
|
||||
|
||||
enum class SkipTest {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
static constexpr auto sta_harness_file = "sta.js"sv;
|
||||
static constexpr auto assert_harness_file = "assert.js"sv;
|
||||
static constexpr auto async_include = "doneprintHandle.js"sv;
|
||||
|
@ -176,6 +182,8 @@ static constexpr auto async_include = "doneprintHandle.js"sv;
|
|||
struct TestMetadata {
|
||||
Vector<StringView> harness_files { sta_harness_file, assert_harness_file };
|
||||
|
||||
SkipTest skip_test { SkipTest::No };
|
||||
|
||||
StrictMode strict_mode { StrictMode::Both };
|
||||
JS::Program::Type program_type { JS::Program::Type::Script };
|
||||
bool is_async { false };
|
||||
|
@ -364,6 +372,9 @@ static Result<TestMetadata, DeprecatedString> extract_metadata(StringView source
|
|||
} else if (flag == "async"sv) {
|
||||
metadata.harness_files.append(async_include);
|
||||
metadata.is_async = true;
|
||||
} else if (flag == "CanBlockIsFalse"sv) {
|
||||
if (JS::agent_can_suspend())
|
||||
metadata.skip_test = SkipTest::Yes;
|
||||
}
|
||||
}
|
||||
} else if (line.starts_with("includes:"sv)) {
|
||||
|
@ -733,6 +744,10 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
auto& metadata = metadata_or_error.value();
|
||||
if (metadata.skip_test == SkipTest::Yes) {
|
||||
result_object.set("result", "skipped");
|
||||
continue;
|
||||
}
|
||||
|
||||
bool passed = true;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue