Commit Graph

34 Commits

Author SHA1 Message Date
Aliaksandr
9921d05da3 treewide: replace stdenv.is* with stdenv.hostPlatform.is*
Assisted-by: claude-code with claude-opus-4-8
2026-08-12 20:27:00 +02:00
K900
caea65bc86 Merge remote-tracking branch 'origin/master' into staging-next 2026-06-27 17:13:58 +03:00
Arthur Gautier
956eb0479a nixos/test-driver: add utils to manipulate efi variables
```python
machine.create_efi_vars()
machine.write_efi_vars([
    EfiVariable(
        uuid.UUID("65a72bd9-f42b-4039-8084-66cd1702cb24"),
        "AbrNextBoot",
        b"a",
        flags=EfiVariable.Flags.NON_VOLATILE
    )
])

machine.start()
```
2026-05-30 22:22:03 -07:00
Jacek Galowicz
cdb35b67b3 nixos-test-driver: drop unneeded qemu dep 2026-05-23 21:40:22 +02:00
Vladimír Čunát
ea9c3ae589 nixos-test-driver: reduce unnecessary rebuilds for now 2026-04-23 14:43:46 +02:00
Jacek Galowicz
6c0ab2edd5 nixos-test-driver: only depend on vsock things on linux 2026-04-23 11:09:45 +01:00
Jacek Galowicz
f1bcb61731 nixos-test-driver: use configuration file instead of scattered env vars 2026-04-17 14:55:56 +01:00
Michael Schneider
df17d7a149 nixos/test-driver: add remaining tests to passthru.tests 2026-04-17 12:35:06 +01:00
Jacek Galowicz
ea044acd82 nixos/test-driver: use vhost-device-vsock for SSH backdoor (#453305) 2026-04-15 18:15:52 +00:00
Maximilian Bosch
1987c483d8 nixos/test-driver: use vhost-device-vsock for SSH backdoor
`vhost-device-vsock`[1] is a custom implementation of AF_VSOCK, but the
application on the host-side uses a UNIX domain-socket. This gives us
the following nice properties:

* We don't need to do `--arg sandbox-paths /dev/vhost-vsock` anymore for
  debugging builds within the sandbox. That means, untrusted users can
  also debug these kinds of tests now.

* This prevents CID conflicts on the host-side, i.e. there's no need for
  using `sshBackdoor.vsockOffset` for tests anymore.

A big shout-out goes to Allison Karlitskaya, the developer of test.thing[2]
who talked about this approach to do AF_VSOCK on All Systems Go 2025.

This patch requires systemd 258[3] because this contains `vhost-mux` in
its SSH config which is needed to connect to the VMs from now on.

To not blow up the patches even more, this only uses AF_VSOCK for the
debugger. A potential follow-up for the future would be a removal of the
current `backdoor.service` and replace it entirely by this
functionality.

The internal implementation tries to be consistent with how VLANs and
machines are handled, i.e. the processes are started when the Driver's
context is entered and cleaned up in __exit__().

I decided to push the process management and creation of sockets for
vhost-device-vsock into its own class, that's an implementation detail
and not a concern for the test-driver. In fact, `vhost-device-vsock` is
something we can drop once QEMU implements native support for using
AF_UNIX on the host-side[4]. `VsockPair` is its own class since
returning e.g. a triple of `(Path, Path, Int)` would be ambiguous in
what is the guest and what the host path (and frankly, I found it hard
to distinguish the two when reading the docs of `vhost-device-vsock`
initially).

Finally, now that we can do the SSH backdoor without adding additional
devices to the sandbox, I figured, it's time to write a test-case for
it.

[1] https://github.com/rust-vmm/vhost-device/blob/main/vhost-device-vsock/README.md
[2] https://codeberg.org/lis/test.thing
[3] https://github.com/NixOS/nixpkgs/pull/427968
[4] https://gitlab.com/qemu-project/qemu/-/issues/2095
2026-04-15 15:45:33 +01:00
Jacek Galowicz
bffdf7c2a8 nixos-test-driver: Use ty instead of mypy for test driver package 2026-04-15 12:13:45 +01:00
Kierán Meinhardt
184674895e nixos/test-driver: remove systemd dependency if no containers are configured 2026-03-03 16:32:01 +01:00
Kierán Meinhardt
23f1e6370d nixos/test-driver: add support for nspawn containers
Co-authored-by: Jeremy Fleischman <jeremyfleischman@gmail.com>
2026-01-28 11:28:32 +01:00
Jacek Galowicz
0024056f2b test driver: normalize callpackage call 2025-12-08 21:15:00 +01:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Jacek Galowicz
d6b326d659 test-driver: Implement debugging breakpoint hooks
Co-authored-by: Maximilian Bosch <maximilian@mbosch.me>
2025-07-18 17:39:01 +02:00
Maximilian Bosch
e2b3517f59 nixos/test-driver: use ipython via ptpython
Closes #180089

I realized that the previous commits relying on `sys.exit` for dealing
with `MachineError`/`RequestedAssertionFailed` exit the interactive
session which is kinda bad.

This patch uses the ipython driver: it seems to have equivalent features
such as auto-completion and doesn't stop on SystemExit being raised.

This also fixes other places where this happened such as things calling
`log.error` on the CompositeLogger.
2025-03-21 12:34:59 +00:00
Emily
f6ce575a03 nixos/test-driver: avoid lib.fileset 2024-12-31 02:30:18 +00:00
Nick Cao
e23f1733c6 nixos/test-driver: use ruff format in place of black 2024-11-22 10:49:31 -05:00
Nick Cao
ef2d3c542a nixos/test-driver: modernize 2024-11-22 10:49:31 -05:00
Nick Cao
42d4046e94 nixos/test-driver: format with nixfmt 2024-11-22 10:49:30 -05:00
Silvan Mosberger
b3ad661e9f nixos/lib/test-driver: Prevent unnecessary rebuilds
E.g. when only Nix files change
2024-06-14 20:42:16 +02:00
Dawid Dziurla
f8a88fd22c nixos/test-driver: adjust to ruff changes 2024-05-22 11:29:02 +02:00
Stefan Hertrampf
c2c525f5bc nixos/test-driver: add junit-xml python package 2024-04-22 13:35:24 +02:00
K900
9490738be7 nixos/lib/test-driver: add setuptools build dep 2024-01-12 13:58:07 +03:00
Raito Bezarius
05dd78cf4b nixos/lib/test-driver: add driver-timeout as a passthru test
From now on, we will aim to ensure that the test driver
gets tested by OfBorg using all our available tests.

This commit adds the driver timeout test to the driver.
2023-10-29 12:45:00 +01:00
Jörg Thalheim
a1666863fd nixos/test-driver: convert to pyproject from setup.py
This also makes configuration available if you just run those tools locally.
Also use ruff instead of pylint because it's faster and more
comprehensive.
2023-09-30 10:17:47 +02:00
Guillaume Girol
33afbf39f6 treewide: switch to nativeCheckInputs
checkInputs used to be added to nativeBuildInputs. Now we have
nativeCheckInputs to do that instead. Doing this treewide change allows
to keep hashes identical to before the introduction of
nativeCheckInputs.
2023-01-21 12:00:00 +00:00
Robert Hensing
793180cf55 Merge branch 'master' into 172325-nixostest-override-python-pkgs-additional-param 2022-06-03 14:22:13 +02:00
Michael Schneider
814027378b nixos/test-driver: Typecheck TestScript 2022-06-02 10:05:45 +02:00
tljuniper
a99736e399 nixos/test-driver: add option to add extra python packages to test code 2022-05-29 11:22:23 +02:00
Patrick Hilhorst
793a2f50f1 nixos/test-driver: remove unused imports, add pylint unused-import check 2022-01-02 23:12:21 +01:00
Patrick Hilhorst
ac6c06c549 nixos/test-driver: bump version 2022-01-01 23:17:37 +01:00
Marijan Petričević
ab693de868 nixos/test-driver: make the test-driver a python package 2021-12-10 12:27:45 +00:00