Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StarlingMonkey WPT tests #810

Merged
merged 21 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/starlingmonkey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
if: steps.cache-crate.outputs.cache-hit != 'true'

run_wpt:
if: github.ref != 'refs/heads/main' && false
if: github.ref != 'refs/heads/main'
name: Run Web Platform Tests
needs: [build, ensure_cargo_installs]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:

- name: Run tests
timeout-minutes: 20
run: node ./tests/wpt-harness/run-wpt.mjs --starlingmonkey -vv
run: node ./tests/wpt-harness/run-wpt.mjs -vv
guybedford marked this conversation as resolved.
Show resolved Hide resolved

sdktest:
if: github.ref != 'refs/heads/main'
Expand Down
2 changes: 1 addition & 1 deletion runtime/StarlingMonkey
4 changes: 1 addition & 3 deletions runtime/fastly/builtins/fetch/request-response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2879,9 +2879,7 @@ bool Response::constructor(JSContext *cx, unsigned argc, JS::Value *vp) {
return false;
}
if (!statusText_val.isUndefined()) {
auto statusText_str = core::encode(cx, statusText_val);
std::string s(statusText_str.ptr.get(), statusText_str.len);
auto status_text_result = convertJSValueToByteString(cx, s);
auto status_text_result = convertJSValueToByteString(cx, statusText_val);
if (status_text_result.isErr()) {
JS_ReportErrorNumberASCII(cx, FastlyGetErrorMessage, nullptr,
JSMSG_RESPONSE_CONSTRUCTOR_INVALID_STATUS_TEXT);
Expand Down
7 changes: 5 additions & 2 deletions runtime/fastly/handler.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "../StarlingMonkey/builtins/web/performance.h"
#include "./builtins/fetch-event.h"
#include "./host-api/fastly.h"
#include "./host-api/host_api_fastly.h"
Expand All @@ -14,14 +15,16 @@ namespace fastly::runtime {

api::Engine *ENGINE;

// Install corresponds to Wizer time, so we configure the engine here
bool install(api::Engine *engine) {
ENGINE = engine;
engine->enable_module_mode(false);
return true;
}

void handle_incoming(host_api::Request req) {
// TODO(GB): reimplement
// builtins::Performance::timeOrigin.emplace(std::chrono::high_resolution_clock::now());
builtins::web::performance::Performance::timeOrigin.emplace(
std::chrono::high_resolution_clock::now());

double total_compute = 0;
auto start = system_clock::now();
Expand Down
18 changes: 10 additions & 8 deletions runtime/fastly/host-api/host_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ void sleep_until(uint64_t time_ns, uint64_t now) {
}
}

size_t api::AsyncTask::select(std::vector<api::AsyncTask *> *tasks) {
size_t tasks_len = tasks->size();
size_t api::AsyncTask::select(std::vector<api::AsyncTask *> &tasks) {
size_t tasks_len = tasks.size();
std::vector<fastly_compute_at_edge_async_io_handle_t> handles;
handles.reserve(tasks_len);
uint64_t now = 0;
uint64_t soonest_deadline = 0;
size_t soonest_deadline_idx = -1;
for (size_t idx = 0; idx < tasks_len; ++idx) {
auto *task = tasks->at(idx);
auto *task = tasks.at(idx);
uint64_t deadline = task->deadline();
// Select for completed task deadlines before performing the task select host call.
if (deadline > 0) {
Expand Down Expand Up @@ -86,7 +86,7 @@ size_t api::AsyncTask::select(std::vector<api::AsyncTask *> *tasks) {
// non-timer task.
size_t task_idx = 0;
for (size_t idx = 0; idx < tasks_len; ++idx) {
if (tasks->at(idx)->id() != NEVER_HANDLE) {
if (tasks.at(idx)->id() != NEVER_HANDLE) {
if (ret.val == task_idx) {
return idx;
}
Expand Down Expand Up @@ -1819,11 +1819,13 @@ const std::optional<std::string> FastlySendError::message() const {
/// The system encountered a DNS error when trying to find an IP address for the backend
/// hostname. The fields dns_error_rcode and dns_error_info_code may be set in the
/// send_error_detail.
// TODO(GB): reenable DNS error codes
case dns_error: {
return "DNS error (rcode={}, info_code={})" /*, this->dns_error_rcode,
this->dns_error_info_code*/
;
// allocate maximum len of error message
char *buf = (char *)malloc(34 + 10 + 1);
int written = sprintf(buf, "DNS error (rcode=%d, info_code=%d)", this->dns_error_rcode,
this->dns_error_info_code);
MOZ_ASSERT(written > 34);
return std::string(buf, written);
guybedford marked this conversation as resolved.
Show resolved Hide resolved
}
/// The system cannot determine which backend to use, or the specified backend was invalid.
case destination_not_found: {
Expand Down
12 changes: 6 additions & 6 deletions runtime/js-compute-runtime/rust-url/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion runtime/js-compute-runtime/rust-url/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
crate-type = ["staticlib"]

[dependencies]
url = "2.5.0"
url = "2.5.2"

[profile.release]
lto = true
Expand Down
2 changes: 1 addition & 1 deletion tests/wpt-harness/expectations/url/url-setters.any.js.json
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@
"status": "PASS"
},
"URL: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased": {
"status": "FAIL"
"status": "PASS"
},
"URL: Setting <foo:///some/path>.pathname = '' Non-special URLs with an empty host can have their paths erased": {
"status": "FAIL"
Expand Down
2 changes: 0 additions & 2 deletions tests/wpt-harness/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
"fetch/api/response/response-stream-disturbed-by-pipe.any.js",
"fetch/api/response/response-stream-with-broken-then.any.js",
"fetch/api/basic/text-utf8.any.js",
"hr-time/basic.any.js",
"hr-time/idlharness.any.js",
"hr-time/monotonic-clock.any.js",
"html/webappapis/atob/base64.any.js",
Expand Down Expand Up @@ -198,7 +197,6 @@
"WebCryptoAPI/sign_verify/hmac.https.any.js",
"html/webappapis/structured-clone/structured-clone.any.js",
"html/webappapis/timers/clearinterval-from-callback.any.js",
"html/webappapis/timers/cleartimeout-clearinterval.any.js",
"html/webappapis/timers/evil-spec-example.any.js",
"html/webappapis/timers/missing-timeout-setinterval.any.js",
"html/webappapis/timers/negative-setinterval.any.js",
Expand Down
Loading