Commit Graph

2283 Commits

Author SHA1 Message Date
dyegoaurelio
bc81a4f11a nix: Add FHS wrappers for venv binaries (ruff, pyrefly) on NixOS (#40860)
On NixOS, dynamically linked binaries from the Python venv (installed
via uv/pip) cannot run directly because they expect standard Linux
library paths that don't exist on NixOS.

This commit adds FHS wrappers that allow these binaries to run in an
FHS-compatible environment at runtime, without patching them.

I considered using the nixpkgs versions of ruff and pyrefly directly, or
overriding their derivations to match the versions in requirements.txt.
However, decided against it because:
- Version mismatches between nixpkgs and requirements.txt caused type
checking incompatibilities (pyrefly 0.34.0 vs 0.23.1)
- Building these tools from source in nix is slow and adds significant
time to nix-shell initialization (both are rust packages that take quite
some time to build)


Testing: just improvements to the NixOS development environment, no test
needed

**Before:**
```
➜ servo (main) ✔ nix-shell
➜ servo (main) ✔ ./mach fmt
Could not start dynamically linked executable: /home/dyego/coding/random/servo/.venv/bin/ruff
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
➜ servo (main) ✔ ./mach test-tidy
 ➤  Checking config file (./servo-tidy.toml)...
 ➤  Checking directories for correct file extensions...
Could not start dynamically linked executable: ruff
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
Error running mach:

    ['test-tidy']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

  File "/home/dyego/coding/random/servo/python/servo/testing_commands.py", line 322, in test_tidy
    tidy_failed = tidy.scan(not all_files, not no_progress, github_annotations)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dyego/coding/random/servo/python/tidy/tidy.py", line 919, in scan
    for error in errors:
  File "/home/dyego/coding/random/servo/python/tidy/tidy.py", line 401, in check_ruff_lints
    for error in json.loads(e.output):
                 ^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2g9b898aq9kmizmhmhbdip5mixrc5wrk-python3-3.11.14/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2g9b898aq9kmizmhmhbdip5mixrc5wrk-python3-3.11.14/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2g9b898aq9kmizmhmhbdip5mixrc5wrk-python3-3.11.14/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
➜ servo (main) ✔
```

(note that the `JSONDecodeError` is because we're trying to parse the
"NixOS cannot run dynamically linked executables intended..." string as
JSON)

**Now:**
```
➜ servo (fix-nix-mach) ✔ nix-shell
➜ servo (fix-nix-mach) ✔ ./mach fmt
➜ servo (fix-nix-mach) ✔ ./mach test-tidy
 ➤  Checking config file (./servo-tidy.toml)...
 ➤  Checking directories for correct file extensions...
 ➤  Checking type annotations in python files ...
 ➤  Skipping WPT lint checks, because no relevant files changed.
 ➤  Running `cargo-deny` checks...
 ➤  Checking formatting of Rust files...
 ➤  Checking formatting of python files...
 ➤  Checking formatting of toml files...

  test-tidy reported no errors.
➜ servo (fix-nix-mach) ✔
```

Signed-off-by: Dyego Aurélio <dyegoaurelio@gmail.com>
2025-11-25 15:20:49 +00:00
Josh Matthews
d89b1aa871 testing: Remove ahem.css user stylesheet injection. (#40817)
The current user stylesheet use in our tests is a hack that hides real
issues like #40419. Any test that requires ahem.ttf needs to include the
stylesheet like any other webpage.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-11-22 17:35:27 +00:00
Mukilan Thiyagarajan
e127129a99 mach: Normalize the --profile argument to build commands (#40753)
The current logic treats the explict version of release and dev build
specification i.e the `--profile release` and `--profile dev` options as
custom profiles. This breaks other logic that explictly check for
release and dev profile types, like the android build.

Normalize the `--profile` argument so that the strings `release` and
`dev` are treated correctly as `BuildType.Kind.RELEASE` and
`BuildType.Kind.DEV` respectively.

Fixes: #40752

Testing: Tested manually that building android with `--profile release`
creates the correct directory structure.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-11-20 07:01:14 +00:00
Martin Robinson
386de5fadf python: Remove notify-py from Python dependencies (#40717)
Support for sending build notifications was removed in #37818, but the
dependency in `requirements.txt` was not removed. This PR fixest that.

Testing: This change just removes an unsued build dependency, so no
testing is necessary.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-11-18 14:54:25 +00:00
Jonathan Schwender
eca996ada3 Upload junit report of unit-tests in CI (#39897)
This should help identify flaky unit tests, since codecov will gather
statistics of tests (of the last 60 days) and allow us to easily
identify flaky unit-tests. [Test page on
codecov](https://app.codecov.io/github/servo/servo/tests) based on an
uploaded report from a try run.
Additionally add a catch-all parameter for `test-unit` which is passed
through to the `cargo nextest` invocation, useful for e.g. stressing a
test via `--stress-count`.

Testing: Manually tested with [try
run](https://github.com/servo/servo/actions/runs/18529823800)

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-11-17 15:07:56 +00:00
Sam
1f5747f34f CI: Limit github runner mac to macos-arm-unit-tests only on merge queue (#40617)
Based on the chat here:
https://github.com/servo/servo/issues/40596#issuecomment-3528514438 we
limit mac-arm (those are bottlenecks as they are not self hosted) to
merge queue (so we know that main is good so we can skip run there) and
we do not run MSRV check there to further limit uses.

Testing: None, because it's just infra.
Temp fixes: #40596

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-11-13 20:58:40 +00:00
Ashwin Naren
7c94188315 Add servo:license (#40319)
Similar to about:license in firefox. Generated with `cargo-about`.

A few open questions:
- When/how should it be updated (the command I used was `cargo about
generate etc/about.hbs > resources/resource_protocol/license.html`, it
takes ~20 seconds)
- How should `about.toml` be kept in sync with `deny.toml`
- What about licenses for packages that are not crates (i.e. gstreamer)

Fixes: #40266

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-11-13 08:48:01 +00:00
Jonathan Schwender
7095bb4b09 tidy: Minor cleanup of licenseck.py (#40585)
- Remove unused accepted Copyright line `See
http://rust-lang.org/COPYRIGHT`. This URL now yields a 404, and we don't
seem to use this line anywhere in the project so we can remove it. Note:
We should probably use a regex anyway, so we can match the whole
required expression, but thats a different topic.
- Remove unused `licenses_dep_toml` table. We use cargo deny for
checking the licenses of our rust dependencies.

Testing: Changing tidy is covered by `./mach test-tidy` in CI

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-11-12 10:41:46 +00:00
Jonathan Schwender
88398204e9 ohos: Make test-speedometer-ohos more robust (#40558)
The main change is running `hdc shell power-shell setmode 602`, which
sets the device to performance mode, increasing the screen timeout and
manually waking the device up.
We add a helper class for that, so that we can use the `with` syntax to
undo these changes at the end of scope.
We also add a small HDC wrapper class, which slightly simplifies and
abstracts over some common functionality like running commands or making
a screenshot.

Testing: This is a CI script change.
Fixes: Speculative fix for speedometer sometimes timing out on HOS and
the screenshot showing a locked device screen.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-11-12 04:36:43 +00:00
Ashwin Naren
370f205032 mach: Remove unused setup/config (#40547)
Removed `setup.py`, `setup.cfg`, `mach.egg-info/`, and `PKG-INFO`. I
don't see these being used anywhere and mach isn't packaged by us. I
checked the firefox source tree and couldn't find them:
45fd8b48b2/python/mach.

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-11-11 03:24:54 +00:00
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