Commit Graph

2273 Commits

Author SHA1 Message Date
Ashwin Naren
6bce35f93a storage: Run storage tests (#40546)
These were accidentally disabled when creating the storage crate.

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-11-11 02:31:07 +00:00
Jonathan Schwender
1410a8f2a6 bootstrap: Run apt update before apt-cache (#40505)
In a fresh container skipping the apt-update will cause only 4 packages
to be installed and the rest filtered. Also add a debug print to inform
the user if packages were skipped.

Testing: Manually tested

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-11-08 20:12:40 +00:00
eri
eb6ca612c3 Remove tshark from mach bootstrap (#40506)
`mach bootstrap` no longer installs Wireshark, as it isn't useful for
people not working directly on DevTools support. The linux runner that
runs `mach test-scripts` now installs it manually, skipping the security
prompt.

Testing: Manual test of `mach test-scripts`
Fixes: #40503

Signed-off-by: eri <eri@igalia.com>
2025-11-08 18:42:33 +00:00
eri
f621e54b54 tools: Update DevTools parser flags (#40488)
Rename the `--scan` argument to `-w/--write-file` and the `--use`
argument to `-r/--read-file`. This is more aligned with `tshark`'s
syntax, and I think it is a more intuitive naming scheme.

Remove the `--filter` and `--range` arguments. They are very easily
replaced by more powerful tools like `grep` and `jq`. It seems
unnecessary to have them in this script (specially when the most useful
thing it does is exporting the capture as NDJSON for other tools to
process). This fixes an issue with the last message not being exported.

Change the default port to `6080`. This matches the current information
[in the
book](https://book.servo.org/hacking/using-devtools.html#connecting-to-servo)
on how to run Servo with DevTools enabled.

Testing: Checked with `math test-scripts`

---------

Signed-off-by: eri <eri@igalia.com>
2025-11-08 14:51:29 +00:00
Jonathan Schwender
05d3615cef mach try: Don't run commit hooks (#40486)
An implementation detail of `./mach try` is that it creates a git commit
containing information about the try configuration. Adding `--no-verify`
skips running git pre-commit hooks, which could cause the commit to
fail. This is useful for draft / work-in-progress branches, where you
quickly want to commit something and test CI works, before fixing lints
/ formatting etc.

Testing: Manually tested with `./mach try`.
Fixes: #40475

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-11-08 09:10:33 +00:00
Martin Robinson
3f285fb675 wpt: Run in headless mode by default unless --no-headless is passed (#40495)
This is a more reasonable default as the detection of running one or
more tests is a bit inconsistent. It also makes the behavior of the
command a bit more predictable IMO.

Testing: This was tested manually as there is no tests for this
layer of the test runner
Fixes: #40407.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-11-07 18:32:36 +00:00
Jonathan Schwender
38d977343c Add code-coverage option to mach run, test-wpt and test-devtools (#39916)
Add a `--coverage` flag to `./mach build` and a `./mach coverage-report`
command to use `cargo llvm-cov` to generate a coverage report from the
raw profiles.

The workflow is: 
```
./mach build --coverage [--profile <cargo_profile>]
# Or test-wpt or test-devtools
./mach run --coverage [--profile <cargo_profile>]
# Note, that coverage-report needs to know the cargo build profile.
./mach coverage-report [--profile <cargo_profile>] [optional parameters for cargo-llvm-cov]
```
According to the LLVM documentation on source based coverage, the
optimization profile should not influence the accuracy of the coverage
profile, so we can gather coverage data from optimized builds.

Note that `./mach test-devtools --coverage` will not produce any
coverage profiles yet, since the test runner kills the servo binary,
which prevents writing the profile data at shutdown.
The same problem also affects `test-wpt` with `servodriver`, which will
be fixed by https://github.com/servo/servo/pull/40455.

Testing: Manually tested. A CI workflow to test wpt coverage will be
added in a follow-up PR.

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-11-07 14:38:24 +00:00
Jonathan Schwender
a5d2e324de ci: Fix ohos libservoshell.so artifact path (#40468)
cargo places the shared library artifact under
`target/<target_triple>/<profile>/libservoshell.so`. The openharmony
prefix, is something we do in mach for the hap, and is not relevant for
the .so (essentially a copy-paste mistake).
Can be compared by looking at the job run of
https://github.com/servo/servo/actions/runs/19125758002/job/54655560361
which failed due to the wrong path.

Testing: Not tested
Fixes: #40467

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-11-06 19:49:13 +00:00
WaterWhisperer
c23491f1a6 Disallow running clippy and --use-crown together (#40427)
Prevent users from running `./mach clippy --use-crown` together, which
doesn't work as expected.

Testing: Verified error message appears when running `./mach clippy
--use-crown`
<img width="1171" height="151" alt="image"
src="https://github.com/user-attachments/assets/1a665915-d97c-4c80-9b23-4da815ff82fc"
/>
Fixes: #39334

Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com>
2025-11-05 14:06:48 +00:00
Martin Robinson
efc9091550 wpt: Ensure that the correct argument is read when outputting stable unexpected log (#40409)
In the review for #40369, the name of a command-line argument was
changed, but not the code that accessed the argument. This meant that
the unexpected log was never dumped, even when there are stable
unexpected results. This change fixes that.

Testing: This should ensure that the `stable-unexpected-results-linux`
artifact
is not empty when running WPT on CI.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-11-04 23:10:57 +00:00
Ashwin Naren
610303a99c Add bump-version command (#40357)
Comprehensively sets the version across Cargo.toml and all
installer/config files (i.e. `Info.plist`, `Servo.wxs.mako`, etc.)

Testing: Manual
Fixes: #40312

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Co-authored-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-11-04 09:22:27 +00:00
Martin Robinson
b96d88bd8b wpt: Enable WebDriver by default when running WPT (#40291)
This change switches the default test runner for WPT to be WebDriver,
enabling testdriver tests by default. In addition, it update results to
reflect the ones that you would expect when running with WebDriver.
While there are some failures that require more investigation, in
general the differences in results are fairly explicable.

Testing: This change modifies the way that tests are run and is thus
tested by all WPT-like tests.
Fixes: #34683

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-11-03 22:54:04 +00:00
Martin Robinson
c1f939f9e0 wpt: Filter non-stable expected results and create an artifact for it (#40369)
This change ensures that the filtered raw log file of WPT results only
contains stable unexpected results and uploads a resulting aggregated
log file as an artifact. This artifact can be used to generate new
baselines of *only* stable unexpected results, so is useful for updating
results given a CI run. A future change will add a `mach` command to do
this automatically.

Testing: The CI should run the code to produce this artifact for every
WPT run.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-11-03 21:42:54 +00:00
Jonathan Schwender
d87a40592f ohos CI: Compile nightly in production and upload libservoshell.so (#40373)
- Compile the nightly in production mode
- Additionally also upload `libservoshell.so` as an artifact. This makes
it easier for interested users on HarmonyOS to test the demo app, since
we can't provide a signed version for HarmonyOS, but users can self-sign
easily if we provide the pre-compiled binary.

Testing: Not tested

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-11-03 15:22:08 +00:00
Martin Robinson
0ac912c981 wpt: Properly process the --headless argument (#40289)
Instead of ignoring the `--headless` argument to the WPT test runner,
properly use it to turno on headless mode in Servo when its provided.
Additionally, when more than a single test is run, turn on headless mode
automatically to preserve existing behavior.

Although this change is for the legacy test driver, this will allow the
WebDriver test runner to run properly without providing the `--headless`
argument.

Testing: This modifies the way the test harness works, but the test
harness is untested.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-10-30 16:07:38 +00:00
Kingsley Yung
e061e5c1b9 script: Implement Compression API (#39658)
The patch implements Compression (https://compression.spec.whatwg.org/)
with the compression and decompression provided by the `flate2` crate
(https://crates.io/crates/flate2).

`flate2` supports several different backends, controlled through the
crate's features. By default, it uses `miniz_oxide`
(https://crates.io/crates/miniz_oxide).

`flate2` provides three modules `read`, `write` and `bufread` which work
on instances of the `std::io::Read`, `std::io::Write` and
`std::io::Bufread` traits, respectively. The `write` module is chosen in
the patch since it matches the streaming model in the specification.

Testing: Enable WPT for Compression API, and introduce WPT expectation.

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-10-27 08:21:35 +00:00
Jonathan Schwender
889ffc9880 ohos: Fix JIT detection (#40130)
On recent versions of HarmonyOS the previous JIT detection does not
appear to work anymore, since the second `mmap` succeeds. This moves the
failure in spidermonkey to a later point, when SM remaps memory to be
writable. On recent versions of HOS I observed that the `PROT_WRITE`
permission was silently ignored by mprotect, which lead to a crash later
on the first attempt to write to the memory region.
It's not exactly easy to determine if one can write to a memory location
(if mprotect lies to you), but we can use `read` to check if the memory
region is writable (without triggering a segfault), since `read` will
return an error for invalid addresses (which is possible since the
writing is handled in the kernel).

Since this solution does add more unsafe code than before, we only use
this detection on OpenHarmony, although we could use it on more
platforms later if there are other platforms which also may have JIT
forbidden.

Testing: Removing the explicit `--pref js_disable_jit=true` means the
detection is tested in CI.
Fixes: #40029

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Sam <16504129+sagudev@users.noreply.github.com>
2025-10-24 18:03:29 +00:00
Jonathan Schwender
205b049fcd mach: Android: Support custom profiles (#39982)
Use Release mode for gradle for production builds and Debug for any
other builds.
This fixes an exception when building for android with a custom cargo
profile.
`SERVO_TARGET_DIR` is read in `apk/jni/Android.mk` and specifies the
folder
libservoshell.so is expected to be in.

Testing: Tested manually with `./mach build --android --production`
Fixes: #34564

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
2025-10-20 17:00:00 +00:00
Sam
3ce49c3a4f webgpu: Update CTS to gpuweb/cts@4adb750 (#39962)
Update WebGPU CTS to
4adb750084

Testing: These are tests updates.

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Sam <16504129+sagudev@users.noreply.github.com>
2025-10-18 20:11:01 +00:00
Jonathan Schwender
84d0919a7f Fix nightly upload with arm64 (#39981)
Changes the asset name on github releases to include the platform. We
map the default platform name (e.g. linux) to something closer to the
target triple (x86_64-linux-gnu), since the architecture and env are
important details.
This allows uploading more than one artifact per OS, which is important
for macos nightlies now.

We additionally continue uploading the artifacts under the old name,
which effectively duplicates assets, to keep the asset name stable
during a transition period. This is useful for easily bisecting servo
using release assets, without needing to consider name changes.

Testing: Tested by manually triggering a release workflow
Fixes: #39973

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-10-18 14:25:11 +00:00
Jonathan Schwender
f8ffa13855 CI: Don't run macos (x86) in full (#39968)
Only do x86 builds on macos on push and on nightly builds. Also test
building libservo on arm mac instead of x86 mac. Also fixes an issue
when merging macos arm jobs in the try parser.
The main goal of this PR is to improve CI merge times again (since the
concurrency limit of github-hosted runners, has been slowing down the MQ
a lot).

Testing: This changes a CI workflow.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-10-17 19:27:52 +00:00
Sam
533c5192f3 ci: Add MacOS Arm64 workflow and run it in full (#38460)
Resurrection of #31234

Testing: Manual CI runs
Full try run: https://github.com/sagudev/servo/actions/runs/17894587434

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-10-17 11:44:28 +00:00
Jonathan Schwender
6781909bdb CI: skip nextest installation if not required. (#39949)
Add --skip-nextest parameter to bootstrap and apply it where nextest is
not required.

Testing: Not tested.
Fixes: #39942

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-10-17 08:24:26 +00:00
Gae24
ca254c1edd tidy: remove dead code and unused files (#39902)
Removes files that once were used for testing tidy checks which are no
longer performed, such as:
- json formatting 
- lock files check which was superseded by cargo deny,
- checking for long lines and multiline strings
- sorting alphabetically #![feature(...)] statements

Testing: Not required, unused files removed

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2025-10-15 16:44:15 +00:00
Jonathan Schwender
4b578671b0 testing: Use nextest for unit-tests (#39812)
Nextest is a powerful test runner, with many advantages over cargo test.
Among others it will run each test in a separate process, provide a
summary of the completed test execution, supports output formats like
JUnit, and can handle flaky test by retrying. This PR does not use most
of these advanced features yet though, that will be left to future PRs.

The change also uncovered racy tests in `net` which rely on someone
initializing the `ASYNC_RUNTIME` before the test in questions is run. By
explicitly accessing the lazy static in a common setup routine, we make
sure it is initialized.

CLI differences of `cargo test` vs `cargo nextest`: 

- The `--profile` option in nextest is not the cargo profile, but refers
to nextest configuration profiles.
- `--nocapture` is a direct argument to nextest, not to the testharness,
so we can remove the preceding `--` seperator.

Testing: Tested by running unit-tests in CI
Fixes: #39797

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-10-14 19:29:54 +00:00
Jonathan Schwender
967c92fa6c Add unittest code coverage to CI (#39855)
Re-land #39789, which was reverted due to #39842. The missing coverage
input in the try-label workflow is added now.

Testing: Manually verified that all occurrences of `uses:
./.github/workflows/dispatch-workflow.yml` have the `coverage` parameter
added.

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Sam <16504129+sagudev@users.noreply.github.com>
2025-10-14 11:16:58 +00:00
Oriol Brufau
f82a604268 Revert "Add unittest code coverage to CI " (#39843)
Reverts servo/servo#39789

Reason: It broke try labels

Testing: Unneeded, just a revert
Fixes: #39842

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-10-13 20:59:37 +00:00
Jonathan Schwender
07ff87754d Add unittest code coverage to CI (#39789)
Add a CI workflow to determine the code coverage. For now we only run
unit-tests, wpt-tests with code coverage can be added later.
We use `lld` to avoid OOM errors during linking (with `ld`, we would
need to reduce the build-concurrency drastically to prevent OOM errors
in CI)
For now, coverage would run during `full` and on-demand (i.e explicitly
requested via try). This workflow failing should not influence the
merge-queue, since we intentionally don't add this workflow to the
required status checks (yet).

Future work: It still needs some investigation to figure out if we can
get pull-request comments from the codecov bot, for coverage runs on try
branches.


Testing: [try
run](https://github.com/servo/servo/actions/runs/18431480782/job/52519348479),
[codecov report from the try
run](f41a50f321)

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Sam <16504129+sagudev@users.noreply.github.com>
2025-10-13 18:17:24 +00:00
shuppy
b675180fe7 ci: Run bencher jobs on self-hosted runners (#39272)
some bencher jobs, specifically linux release profile jobs, measure
runtime perf by running speedometer and dromaeo. doing this on
GitHub-hosted runners is suboptimal, because GitHub-hosted runners are
not under our control and their performance can vary wildly depending on
what hosts we get and how busy they are.

this patch depends on #39270 and #39271, and the new
[ci3](https://ci3.servo.org/) and [ci4](https://ci4.servo.org/) servers
deployed in servo/ci-runners#49. these servers provide a more controlled
environment for benchmarking by using known hardware that runs one job
at a time and no other work (servo/project#160), with some of the
[techniques](https://github.com/servo/servo/wiki/Servo-Benchmarking-Report-(October-2024)#methodology)
[we’ve](https://github.com/servo/servo/wiki/Servo-Benchmarking-Report-(November-2024)#methodology)
[developed](https://github.com/servo/servo/wiki/Servo-Benchmarking-Report-%28December-2024%29#methodology)
for accurate measurement:
- [we disable CPU frequency boost and
hyperthreading](364719f210...5c02999bbc (diff-e6f17b25776ca26c2880cc3a4e3b99a0642ea968a8d6214763cb6467cc1251cfR239-R256))
- [we pin guest CPUs to specific host
CPUs](364719f210...5c02999bbc (diff-cdaac247bfd7d30f8c835083adab39c7ead8791802498285ea2ce9e023cc5f06R15-R26))
- [we isolate a subset of CPUs from all processes and scheduling
interrupts](364719f210...5c02999bbc (diff-e6f17b25776ca26c2880cc3a4e3b99a0642ea968a8d6214763cb6467cc1251cfR97-R102))
- the bencher workflow does not take advantage of this yet, but it will
in a later patch

to use ci3 and ci4 for bencher jobs, we add them to the list of
self-hosted runner servers, then make the bencher workflow try to find a
servo-ubuntu2204-bench runner if speedometer and/or dromaeo have been
requested. to avoid mixing data, we set the bencher “testbed” based on
where the runner came from:
- for GitHub-hosted runners, we continue to use “ubuntu-22.04”
- for runners on ci3 or ci4, we use
“self-hosted-image:[servo-ubuntu2204-bench](e911a23eff/profiles/servo-ubuntu2204-bench)”

Testing:
- before, always GitHub-hosted: [job
run](https://github.com/servo/servo/actions/runs/18276911520/job/52032330450)
→
[report](https://bencher.dev/perf/servo/reports/86aa60cc-9d42-418f-a639-07b8604b30fb)
- after, self-hosted: [job
run](https://github.com/servo/servo/actions/runs/18404778338/job/52442477058)
→
[report](https://bencher.dev/perf/servo/reports/6feed0ac-655a-4e17-9351-41cba8d283b2)
- after, GitHub-hosted: [job
run](https://github.com/servo/servo/actions/runs/18404806546/job/52442697457)
→
[report](https://bencher.dev/perf/servo/reports/235a4ee0-340d-458b-9be4-953568b0923d)
- there are also counterparts for other platforms in the workflow runs
above

Fixes: #39269

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-10-13 12:29:40 +00:00
Jonathan Schwender
11664e4ab0 Add code-coverage option for ./mach test-unit using llvm-cov (#39387)
Add a `--code-coverage` option for `./mach test-unit` and an option to
pass additional arguments.
The additional options are required to e.g. pass `--codecov
--output-path=codecov.json` to generate a codecov compatible report in
CI.
We use [cargo-llvm-cov](https://github.com/taiki-e/cargo-llvm-cov) to
simplify our workflow, since it handles both the required compile flags
and creating the report.

Testing: Manual testing of the new flags
First step towards https://github.com/servo/servo/issues/37768

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-10-09 22:17:30 +00:00
Narfinger
423800eec4 Script: Lazily transform the DOMString into Rust String instead of immediately. (#39509)
This implements LazyDOMString (from now on DOMString) as outlined in
https://github.com/servo/servo/issues/39479.
Constructing from a *mut JSString we keep the in a
RootedTraceableBox<Heap<*mut JSString>> and transform
the string into a rust string if necessary via the `make_rust_string`
method.
Methods used in script are implemented on this string. Currently we
transform the string at all times.
But in the future more efficient implementations are possible.

We implement the safety critical sections in a separate module
DOMStringInner which allows simple constructors, `make_rust_string` and
the `bytes` method.
This method returns the new type `EncodedBytes` which contains the
reference to the underlying string in either format.

Testing: WPT tests still seem to work, so this should test this
functionality.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-10-09 18:18:03 +00:00
Simon Wülker
2fae95db3b mach: Run XPath unit tests with mach test-unit (#39729)
Fixes: https://github.com/servo/servo/issues/39551

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-10-09 10:39:08 +00:00
Gregory Terzian
5887e1e963 script: implement url matches about:blank (#39645)
Implement
[matches-about:blank](https://html.spec.whatwg.org/multipage/#matches-about:blank),
and uses it to compute the fallback url of a document.

This will also be useful as part of [fixing iframe
loading](https://github.com/servo/servo/issues/31973).

There is one unrelated change to origin.rs, which is the result of an
fmt.

Testing: added unit-tests and the fallback url should be covered by wpt
tests.

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
2025-10-06 16:35:15 +00:00
Martin Robinson
19a8f826a5 wpt: Capture test output when running WPT in WebDriver mode (#39656)
We were capturing test output (such as stack traces) by using the "test"
key in the data provided to the `process_output` log handler. This
doesn't work for WebDriver mode because the test runner runs in another
process entirely and it may reuse Servo executable instances for tests.

This change maps browser process output to tests using the "browser_pid"
key that is often provided while in WebDriver mode.

Testing: This modifies the test harness, so the tests are running tests.
Fixes: #39176

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-10-05 11:41:42 +00:00
Ashwin Naren
1448fd5967 Remove test_mapping.json and python/servo/mutation (#39617)
As per #39585.

>It used to run on our old buildbot CI for a couple years. It was never
migrated, and we should clean it up.

_Originally posted by @jdm in
https://github.com/servo/servo/issues/39585#issuecomment-3351054660_

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-10-02 04:31:54 +00:00
Ashwin Naren
65588cd5df script: Stubs for geolocation interfaces (#39584)
Needed for #39526; stubs out all the necessary interface from
https://www.w3.org/TR/geolocation/.

Testing: WPT

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-10-02 04:17:36 +00:00
Narfinger
f4c618924f OHOS CI: Abort early when speedometer crashes in test-speedometer-ohos (#39511)
Check for the pid of servo for test-speedometer-ohos to see if it did
not crash and abort early if it crashed.

Testing: Ran test-speedometer-ohos with closing servo and without
closing servo on the phone.
Fixes: https://github.com/servo/servo/issues/37742

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-10-01 08:41:07 +00:00
Simon Wülker
6c062bbea8 Remove references to stylo from mach test-unit (#39562)
`stylo` does not live in the servo repository anymore.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-29 07:55:02 +00:00
Integral
466641310f mach: Format package hash files to ensure sha256sum command compatibility (#39432)
Format the package hash files to include the package hash and filename
separated by two spaces, ensuring compatibility with the `sha256sum -c`
and `shasum -c` command.

---

Before:
```
╰─❯ sha256sum -c servo-latest.tar.gz.sha256
sha256sum: servo-latest.tar.gz.sha256: no properly formatted checksum lines found
```

After:
```
╰─❯ sha256sum -c servo-latest.tar.gz.sha256
servo-latest.tar.gz: OK
```

Signed-off-by: Integral <integral@member.fsf.org>
2025-09-22 14:39:47 +00:00
Simon Wülker
4d43844ece Remove test-content subcommand from mach (#39412)
Content tests have been replaced by web platform tests 10 years ago (see
9be71b941f).
I think it is fair to assume that no one is going to run the relevant
subcommand anymore. Let's remove it.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-21 00:36:07 +00:00
shuppy
b685c2f424 devtools: Fix race in tests due to asynchronous termination (#39309)
one of the flaky failure modes we found in #38658 was that on linux,
geckordp occasionally fails to connect to servoshell’s devtools server.
this happens despite our preliminary connect check passing, which should
imply that the devtools server is listening and ready to use. we closed
the issue without any fix for that failure mode, because we were
ultimately unable to reproduce it, but it still happens in the wild
(#39273). we’ve now found a way to reproduce it, and we think it’s
caused by a race that occurs when moving from one test to the next. for
example:

- test 1 finishes
- we send SIGTERM to test 1’s servoshell, but it does not stop its
devtools server yet
- test 2 begins
- we spawn test 2’s servoshell, but it does not start its devtools
server yet
- we try to do our preliminary connects, and it succeeds against test
1’s servoshell immediately (the failure logs on GitHub never make this
clear, due to some kind of buffering problem that delays the `.` and `+`
outputs)
- test 1’s servoshell stops its devtools server
- we try to do our actual connect, and it fails because no devtools
server is listening
- test 2 fails

very rarely, one test’s servoshell may even fail to start its devtools
server, which we think happens because the previous test’s servoshell is
still listening. this has only ever happened once, and we’ve been unable
to reproduce it since, but we think it’s caused by the same kind of
race. for example:

- test 1 finishes
- we send SIGTERM to test 1’s servoshell, but it does not stop its
devtools server yet
- test 2 begins
- we spawn test 2’s servoshell, but it does not start its devtools
server yet
- test 2’s servoshell tries to start its devtools server, but fails
because test 1’s servoshell is still listening
- test 2 fails

in both cases, the failure can be explained by the fact that we send
SIGTERM to the previous test’s servoshell without actually waiting for
the process to exit. this patch ensures that we wait, and also moves all
of the output we do in the test suite from stdout to stderr to avoid it
getting mangled in GitHub Actions.

Testing: see [this
comment](https://github.com/servo/servo/pull/39309#issuecomment-3291007931)
(before) vs [this
comment](https://github.com/servo/servo/pull/39309#issuecomment-3291188997)
(after)
Fixes: #39273

Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-09-15 10:28:08 +00:00
Abdelrahman Hossam
7a28fd786c ohos: Adding support for running WPT on OHOS devices using WebDriver (#38846)
Architecture:
```
Desktop (Test Controller)        OHOS Device (Test Target)
┌─────────────────────────┐     ┌─────────────────────────┐
│ WPT Server (port 8000)  │     │ Servo Browser           │
│ Test Runner Script      │---->│ WebDriver Server (7000) │
│ HDC Port Forwarding     │     │ Test Execution          │
└─────────────────────────┘     └─────────────────────────┘
```
After the test is finished, the script will parse the results and print
them in a readable format.

Tried to handle as many errors as possible and find workarounds for each
error to ensure the testing can be completed, or at least provide
comprehensive logs or information to identify exactly where the problem
is. Note that the used ports are just for testing; you can change them
to any other available ports, but make sure that the ports are
consistent in the script and given commands.

To run a WPT test on an OHOS device, you need to:
1. Connect OHOS device to the desktop via a cable (didn't try any other
way of communication)
2. Build and deploy servo with the changes in this PR using
[servoDemo](https://github.com/jschwe/ServoDemo). You can find there the
instructions to build and deploy servo to OHOS device.
3. While deploying servo to OHOS you need to ensure WebDriver is enabled
with the argument --webdriver=7000
4. Ensure OHOS SDK with HDC in PATH
5. Start WPT server on the desktop on a different terminal in servo
directory: ```bash python -m wpt serve --port 8000 ```
6. Update desktop IP in test scripts:
```python
desktop_ip = "192.168.1.100"  # Your desktop's IP
```
You can find your desktop IP with:
```bash
# Windows
ipconfig | findstr "IPv4"

# macOS/Linux
ifconfig | grep "inet "
```
script can be modified to detect the desktop's IP automatically ...
later.
7. Run tests using the new mach command:

```bash
./mach test-ohos-wpt \
    --test <test relative path> \
    --webdriver-port 7000 \
    --wpt-server-port 8000 \
    --verbose
```

The script will:
1. Set up HDC port forwarding and reverse port forwarding for WPT
automatically
2. Connect to WebDriver server on the device
3. Navigate to the test URL
4. Wait for test completion
5. Show test results

Troubleshooting common Issues and Solutions:

1. HDC command not found:
   - Install OHOS SDK and add HDC to PATH
   - Verify: `hdc --version`

2. Failed to connect to WebDriver:
   - Ensure Servo is running with `--webdriver=7000` argument
   - Check device connection: `hdc list targets`
   - Verify port forwarding: `hdc fport ls`
   - Test WebDriver directly: `curl http://localhost:7000/status`

3. Failed to navigate to test URL:
   - Update `desktop_ip` in the script
   - Ensure both devices are on same network or connected via cable
   - Test connectivity: ping from device to desktop

4. Test timeouts:
   - Increase timeout in script (default: 30 seconds)
   - Check if test requires specific dependencies
   - Verify WPT server is serving the test file

---------

Signed-off-by: abdelrahman1234567 <abdelrahman.hossameldin.awadalla@huawei.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Co-authored-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-09-09 08:57:36 +00:00
Ashwin Naren
3ac8875697 script: Initial stubs for Credential Management API (#38839)
Stubs `Credential`, `CredentialContainer`, and `PasswordCredential` and
adds the credentials attribute to navigator.

Testing: WPT
Fixes: Partially #38788

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-09-06 19:48:38 +00:00
Kenzie Raditya Tirtarahardja
9c840b05bc CI: Enable webdriver classic on wpt workflow (#39087)
Since WebDriver is quite stable now, enable the `webdriver/classic`
tests on wpt CI.

---------

Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
2025-09-03 03:50:44 +00:00
atbrakhi
eaab71d335 devtools: Fix flaky source list test assertions (#38969)
In the sources list tests, we assert that the sources for each target
are given to us in the same order as we specified in the test case, but
this is only true for classic &lt;script> and &lt;script src>. ES module
scripts and async/defer scripts are loaded asynchronously, so we can’t
rely on the order being the same every time.

this patch changes the test assertions to use a frozen multiset for each
target’s sources, rather than a frozen list (tuple), so the sources can
appear in any order but must still appear the expected number of times.
we also change the test assertions to use a multiset
([Counter](https://docs.python.org/3/library/collections.html#counter-objects))
of frozen multisets, rather than a set of multisets, so now two targets
can have the same set of sources without breaking tests.

Testing: this patch improves existing tests, but does not change
coverage
Fixes: part of #38658

---------

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: delan azabani <dazabani@igalia.com>
2025-08-27 13:19:58 +00:00
atbrakhi
5909eb7684 devtools: Use correct servoshell path on Windows (#38938)
When we landed #38614, the devtools tests consistently failed on
GitHub-hosted Windows builds, because we were hardcoding the target
directory. This patch fixes that by taking the `CARGO_TARGET_DIR` into
account.

- before: `[D:\a\servo\servo\]target/release/servo`
- after: `C:\a\servo\servo\target\release\servo.exe`

Testing (cherry picked onto #38614 so it runs in CI):
- GitHub-hosted, before:
<https://github.com/atbrakhi/servo/actions/runs/17231549981/job/48886505825>
- GitHub-hosted, after:
<https://github.com/atbrakhi/servo/actions/runs/17232856662/job/48890768590>
- self-hosted, after:
<https://github.com/servo/servo/actions/runs/17234485907/job/48896322465>

Fixes: part of #38658

---------

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
2025-08-27 09:14:21 +00:00
atbrakhi
ad91c6e461 devtools: Fix test_source_breakable_lines_and_positions_with_functions (#38964)
In #38933 we removed `start_web_server` but
`test_source_breakable_lines_and_positions_with_functions` was not
updated because it was added later. In this patch we remove
`start_web_server` in that test as well.

Testing: fixes an existing test
Fixes: Part of #36325

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: delan azabani <dazabani@igalia.com>
2025-08-27 08:15:02 +00:00
Sam
3dc9184121 canvas: Use vello_cpu as default canvas backend (#38844)
We really want to remove font-kit from dep tree, so this is the first
step into removing raqote from servo. While vello_cpu is not perfect
replacement, I am confident that we will resolve all issues eventually:
https://github.com/servo/servo/issues/38345 (most important ones already
have PRs).

Reviewable per commit.

Testing: Existing WPT tests.
Try run: https://github.com/sagudev/servo/actions/runs/17138369290

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-08-27 07:22:20 +00:00
shuppy
7aad72838a devtools: Reland test improvements from #38614 minus CI changes (#38933)
#38614 was reverted due to CI flakiness, but it also included several
improvements to the devtools tests. this patch relands those
improvements, described below.

we make three changes that speed up the devtools tests from 73 → 65 → 56
→ 51 seconds:

- we replace the hardcoded sleep(1) after starting servoshell with a
loop that waits until the devtools port is open (this also fixes
intermittent failures when servoshell starts too slowly, especially on
macOS)
- we start the internal web servers once, and reuse them across all
tests
- we run servoshell in headless mode (this is also required because most
CI runners have no GUI)

and we fix two bugs that cause very noisy but not very interesting error
messages:

- in the test code, we use a [context
manager](https://docs.python.org/3/reference/datamodel.html#context-managers)
to ensure the devtools client is disconnected unconditionally, even if
test methods or assert helper methods raise exceptions (this was causing
errors on all platforms)
- in the devtools server, we treat “connection reset” errors when
reading from the client like a normal EOF, rather than as a failure
(this was causing errors on Windows)

on self-hosted linux builds, there are still spurious error messages
like the following, but we can fix them later:

```
error: XDG_RUNTIME_DIR not set in the environment.
libEGL warning: egl: failed to create dri2 screen
```

Testing: this patch improves the devtools tests, but does not change
their coverage
Fixes: part of #36325

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
2025-08-26 10:06:51 +00:00
Jonathan Schwender
0a8146143a mach: Improve test-speedometer error reporting (#38887)
Currently speedometer results are parsed by parsing the console output
from stdout (or a file in the case of ohos). Currently json decode
errors just cause mach to crash. Instead print an error message, point
to the problematic location and exit.
A crash can happen if something else also prints, e.g. on macos, we have
the `xx threads are still running` message at shutdown. Hence this PR
doesn't really fix the unreliable nature of the current implementation,
but at least adds a helpful error message, which would point people in
the right direction.

Testing: test-speedometer is run in CI

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-08-23 11:36:57 +00:00