Commit Graph

1055 Commits

Author SHA1 Message Date
K900
e758ca61fe nixos/lib/test-driver: make the warning message more noticeable 2024-03-01 13:20:09 +03:00
Franz Pletz
317a383090
Merge pull request #292189 from nagisa/fixes-systemd-upheldBy-propagation 2024-02-29 02:08:56 +01:00
Simonas Kazlauskas
34c5cc74a1 systemd: fix propagation of upheldBy option to units 2024-02-29 02:01:24 +02:00
K900
d53c203739
Merge pull request #291544 from K900/ovmf-oof
nixos/tests: drop LegacyStartCommand
2024-02-28 09:32:26 +03:00
K900
bdacdc46e4 nixos/lib/test-driver: provide legacy path for create_machine({"startCommand": "..."}) 2024-02-28 09:32:11 +03:00
Will Fancher
f5622df470
Merge pull request #290946 from ju1m/systemd-option-list
nixos/systemd: merge unit options as lists when at least one value is a list
2024-02-27 20:49:39 -05:00
Will Fancher
a587a6a357
Merge pull request #285401 from sdht0/systemd-boot-xbootldr
nixos/systemd-boot: Add support for an XBOOTLDR partition
2024-02-27 20:35:03 -05:00
K900
d93db9066a nixos/lib/testing: remove yet another source of unnecessary test rebuilds 2024-02-27 23:35:05 +03:00
K900
423098c284 nixos/lib/test-driver: drop LegacyStartCommand, clean up create_machine API
We can finally do this now that it's no longer used.
2024-02-27 23:15:59 +03:00
K900
d9a37adc04 lib/test-driver: don't swallow qemu stderr 2024-02-27 23:15:58 +03:00
K900
bde7471aa2 nixos/lib/testing: remove another source of unnecessary test rebuilds 2024-02-27 18:00:58 +03:00
Siddhartha
04beb0aea2 nixos/lib/make-disk-image: Add ability to setup an XBOOTLDR partition 2024-02-26 21:51:41 -05:00
Adam C. Stephens
af810fc67e
Merge pull request #284874 from shlevy/ovmf-ms
Enable MS-compatible secure boot with OVMF
2024-02-25 22:34:05 -05:00
Julien Moutinho
7d0c812963 nixos/systemd: merge unit options as lists when at least one value is a list 2024-02-25 01:20:29 +01:00
Michael Schneider
fe4edb712c nixos/testDriver: remove pinned mypy python version 2024-02-23 02:36:58 +00:00
Shea Levy
9188bb5186
OVMF: Add test with secure boot enabled
Co-authored-by: Arthur Gautier <arthur.gautier@arista.com>
2024-02-15 12:13:05 -05:00
Silvan Mosberger
1cd71881f2 nixos/systemd: Support notify-reload service Type
Support for this was added in systemd 253:
https://github.com/systemd/systemd/releases/tag/v253
2024-02-14 17:52:13 +01:00
Simonas Kazlauskas
fd5664871f review 2024-02-10 22:25:24 +02:00
Simonas Kazlauskas
74eeb75af1 systemd: add support for upholds and upheldBy 2024-02-10 13:48:40 +02:00
Yureka
c94d63a527
nixos/utils: fix stack overflow in genJqReplacementSnippet (#284027)
When the input contains derivations, don't attempt to recurse into them
2024-01-30 11:00:08 +01:00
K900
07e7fcc46f nixos/test-driver: black 2024-01-26 16:27:53 +03:00
Jacek Galowicz
d6318f4a86
Merge pull request #262772 from RaitoBezarius/qemu-vm/wait-for-event
nixos/lib/test-driver: add `wait_for_qmp_event`
2024-01-26 08:27:06 +01:00
Raito Bezarius
1196ae6e6b nixos/lib/test-driver: add wait_for_qmp_event
Adds a function to wait for a new QMP event with a model filter
so that you can expect specific type of events with specific payloads.

e.g. a guest-reset-induced shutdown event.
2024-01-25 20:50:20 +01:00
Robert Hensing
e0000983db
Merge pull request #279170 from SuperSandro2000/nixos-repl-lib
nixos-rebuild: add lib to repl to make debugging even easier
2024-01-19 12:29:04 +01:00
K900
3d6a5ad604 systemd-lib: fix automount generation after 9fbf82d9cb
This one got missed in the refactor.
2024-01-18 08:33:46 +03:00
Will Fancher
59ba511744
Merge pull request #266370 from SuperSandro2000/systemd-install-wantedby
systemd-lib: add Install WantedBy section to make units similar to upstream ones
2024-01-17 13:04:03 -05:00
Robert Hensing
8e934650ce nixos: Expose lib attribute on configuration for repl 2024-01-15 00:28:07 +01:00
Ryan Lahfa
b5a944511d
Merge pull request #256709 from colemickens/make-squashfs-skip-compression
nixos/lib/make-squashfs.nix: allow disabling compression
2024-01-13 20:23:25 +01:00
Ryan Lahfa
f520eb3f0c
Merge pull request #263658 from siriobalmelli-foss/sb/zfs-image
openstack-image-zfs and make-single-disk-zfs-image: optionally specify qemu instance memory
2024-01-12 20:25:26 +01:00
K900
9490738be7 nixos/lib/test-driver: add setuptools build dep 2024-01-12 13:58:07 +03:00
Cole Mickens
5a718794d0
nixos/lib/make-squashfs.nix: allow disabling compression 2024-01-07 22:46:20 -06:00
Sandro Jäckel
9fbf82d9cb
systemd-lib: add Install WantedBy section to make units similar to upstream ones
and make them better grepable
2024-01-02 23:09:03 +01:00
github-actions[bot]
b3ceb9c6b7
Merge staging-next into staging 2023-12-26 18:01:24 +00:00
Martin Weinelt
0392a07511
nixos/lib/make-disk-image: Create build products metadata
For hydra to expose built images for direct download, listing the
relevant files in nix-support/hydra-build-products is required.
2023-12-26 16:02:51 +01:00
Sandro Jäckel
e2702f5aee
treewide: don't use python3Minimal where it is not required
Building a python environment with python3Minimal requires hydra
to bootstrap pip and build all packages used in the environment
which would otherwise not be built. This reduces cache re-use and duplicates things.

Also common dependencies normally included in python itself
are not properly checked and can cause hard to debug errors
because everyone just assumes those modules are there.
2023-12-21 02:21:48 +01:00
Jacek Galowicz
66ca9c90e2
Merge pull request #267937 from SomeoneSerge/fix/test-driver-activestate
nixos/lib/test-driver: make wait_for_unit ask for ActiveState only
2023-12-14 06:55:06 +01:00
Philip Taron
bc7a939ced nixos/networkd: add [IPVLAN] and [IPVTAP] configuration options to systemd.netdev files
[IPVLAN](https://www.freedesktop.org/software/systemd/man/latest/systemd.netdev.html#%5BIPVLAN%5D%20Section%20Options)
[IPVTAP](https://www.freedesktop.org/software/systemd/man/latest/systemd.netdev.html#%5BIPVTAP%5D%20Section%20Options)
2023-11-18 08:43:21 +01:00
Someone Serge
392fbc90a8
nixos/lib/test-driver: make wait_for_unit ask for ActiveState only
This is a hotfix for https://github.com/NixOS/nixpkgs/issues/266690,
where `systemctl show $unit` sometimes randomly leaves ActiveState out
2023-11-16 18:25:42 +00:00
Ryan Lahfa
b8218af2e6
Merge pull request #256226 from ElvishJerricco/systemd-stage-1-testing-backdoor 2023-11-10 14:08:07 +01:00
Will Fancher
9a0f523372 systemd-stage-1: Enable backdoor in nixos tests 2023-11-09 17:53:48 -05:00
Will Fancher
c20ad5d379
Merge pull request #266369 from SuperSandro2000/systemd-unit-empty-lines
systemd-lib: cleanup empty lines in unit files
2023-11-09 16:49:11 -05:00
Sandro Jäckel
ae0bbc00e8
systemd-lib: cleanup empty lines in unit files 2023-11-09 02:08:57 +01:00
Robert Hensing
87391b681f
Merge pull request #265836 from hercules-ci/nixosTests-no-surprises
nixos/testing/nodes: Do allow aliases
2023-11-08 00:55:32 +01:00
Samuel Cormier-Iijima
61bdb29a05
nixos/lib/make-btrfs-fs: Use fakeroot and faketime (#265686) 2023-11-07 02:17:38 +02:00
Robert Hensing
ae5cb919f5 nixos/testing/nodes: Do allow aliases
Aliases exist for a reason. Sure it is nice to make sure that
some aliases aren't used within Nixpkgs, but this creates two problems
which are far worse than your failing to meet your neatness compulsions.

- Users encounter missing attributes, https://github.com/NixOS/nixpkgs/issues/264577
  wasting their time, stalling their progress, and even occupying others
  time that would be better spent on fixing *real* issues.

- Hydra doesn't treat evaluation errors seriously enough, with the
  effect that actual relevant test failures are masked by evaluation
  failures such as those caused by this no aliases business.

- We don't even have the infrastructure to get rid of aliases, because
  all warnings in package attributes are disallowed by Nixpkgs CI
  tooling, last I checked.

Before re-disabling this, make sure that

- An actually helpful deprecation process is in place.

- Aliases are still allowed when `nixos-lib.runTests` and
  `pkgs.testers.runNixOSTest` are invoked by external projects.
  For instance, `all-tests.nix` could provide such an
  override (e.g. with `newScope`).
2023-11-06 12:30:28 +01:00
emilylange
6c7ad5e732
nixos/systemd-lib: fix building of empty unit files
This is a fixup for c1ae82f448.

nix' `passAsFile` does not create empty files for variables that are
`null`.

This results in the following error for units that have no overrides or
content, but are, e.g. `wantedBy`:
`mv: cannot stat '': No such file or directory`.

Minimal reproducer:
`systemd.units.empty.wantedBy = [ "multi-user.target" ];`

This is often necessary when a unit is loaded in via `systemd.packages`.
2023-11-02 01:18:46 +01:00
Sirio Balmelli
30d1e55e25
make-single-disk-zfs-image: make memSize configurable
Signed-off-by: Sirio Balmelli <sirio@b-ad.ch>
2023-10-31 08:28:45 +01:00
5aaee9
c1ae82f448 nixos/systemd: fix make unit failed when unit too large 2023-10-31 01:06:37 +08:00
Ryan Lahfa
92fdbd284c
Merge pull request #262839 from RaitoBezarius/qemu-vm/timeout 2023-10-29 17:21:10 +01: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
Raito Bezarius
a0dc17bd57 nixos/lib/testing/run: expose rawTestDerivation
For `testBuildFailure` and similar functions, we need a full blown derivation and not a lazy one.
This is an internal option for test framework developers.
2023-10-29 12:45:00 +01:00
Raito Bezarius
d4d7550108 nixos/test-driver: provide a global timeout
Since the debut of the test-driver, we didn't obtain
a race timer with the test execution to ensure that tests doesn't run beyond
a certain amount of time.

This is particularly important when you are running into hanging tests
which cannot be detected by current facilities (requires more pvpanic wiring up, QMP
API stuff, etc.).

Two easy examples:

- Some QEMU tests may get stuck in some situation and run for more than 24 hours → we default to 1 hour max.
- Some QEMU tests may panic in the wrong place, e.g. UEFI firmware or worse → end users can set a "reasonable" amount of time

And then, we should let the retry logic retest them until they succeed and adjust
their global timeouts.

Of course, this does not help with the fact that the timeout may need to be
a function of the actual busyness of the machine running the tests.
This is only one step towards increased reliability.
2023-10-29 12:45:00 +01:00
Robert Hensing
5dfc78a8ad
Merge pull request #262021 from Enzime/linux-builder-cross
linux-builder: support `x86_64-linux` on `aarch64`
2023-10-24 14:34:29 +02:00
Michael Hoang
ab1f45f3d3 linux-builder: support x86_64-linux on aarch64 2023-10-24 13:35:37 +02:00
Maciej Krüger
1ecbbb6e3f
Merge pull request #260595 from adamcstephens/lxc/squashfs
lxc-container: add squashfs image support and release output
2023-10-24 02:06:36 +02:00
Jacek Galowicz
dda77fcc55
Merge pull request #257535 from RaitoBezarius/vmstate
nixos/lib/test-driver: use QMP API to watch for VM state
2023-10-22 14:22:34 +01:00
Ryan Lahfa
c5442c247f
Merge pull request #257262 from dongcarl/2023-09-nginx-fixes
nixos/nginx: Allow empty port for listen directive (for unix socket)
2023-10-21 17:26:57 +01:00
Raito Bezarius
f94876a65c nixos/lib/test-driver: wire up QMP client
Now that we have a QMP client, we can wire it up in the test driver.

For now, it is almost completely useless because of the need of a constant "event loop", especially
for event listening.

In the next commits, we will slowly enable more and more usecases.
2023-10-21 13:03:15 +02:00
Philip Taron
989cca26c4
systemd.network.netdev: Add support for WLAN devices
These are virtual interface, where one physical wifi adapter can have
more than one interface.

See https://systemd.network/systemd.netdev.html#%5BWLAN%5D%20Section%20Options
and dedf2d0054
2023-10-16 15:04:44 -07:00
Adam Stephens
a91bd0b468
make-squashfs: add support for pseudoFiles, custom name, and disabling strip 2023-10-12 10:51:41 -04:00
Robert Hensing
a14f3f829d nixos/eval-config.nix: Rename arg nixosSystem -> configuration
For some time now the attrset returned by `evalModules` has
`type = "configuration"`.

This is a clean refactor because the name is not exposed.
(never is for simple lambda)
2023-10-10 13:25:15 +02:00
Robert Hensing
1c0427862e nixos/eval-config.nix: Rename let withExtraArgs -> withExtraAttrs
Presumably it only used to add `extraArgs`, but it also adds other
attributes now.
2023-10-10 13:24:55 +02:00
Carl Dong
e5c2c71280 nixos/nginx: Allow empty port for listen directive
When listening on unix sockets, it doesn't make sense to specify a port
for nginx's listen directive.

Since nginx defaults to port 80 when the port isn't specified (but the
address is), we can change the default for the option to null as well
without changing any behaviour.
2023-10-09 21:16:03 -04:00
K900
93cfbb253c eval-config.nix: set nixpkgs.pkgs instead of _module.args.pkgs
This allows nixpkgs.overlays to work, and also the nixpkgs.config check.
2023-10-08 20:41:44 +03:00
K900
80cc25eb51 nixos/testing: fix eval for tests created without make-python-test.nix
We have too many test entrypoints and this is a problem.
2023-10-06 23:52:04 +03:00
K900
8a7282f90b nixosTest: fix tests defined with pkgs.nixosTest 2023-10-06 16:33:15 +03:00
Florian Klink
42f2e2dadd
Merge pull request #257510 from ign0tus/fix/wake-on-lan-policy
Fix: WakeOnLan policy
2023-10-04 11:36:16 +03:00
Reno Reckling
612035c45f
Fix broken genJqSecretsReplacementSnippet for jq 1.7 (#257932)
jq 1.7 updated it's behaviour and now throws an error
if the first argument is an empty string. It now needs
"." to pass the input through.
2023-09-30 14:00:13 +02:00
Jörg Thalheim
f1450e660f nixos/test-driver: whitelist variable names that don't follow pep8
https://docs.astral.sh/ruff/rules/invalid-argument-name/
2023-09-30 10:31:22 +02:00
Jörg Thalheim
1810265b57 nixos/test-driver: name exception according to pep8
see https://docs.astral.sh/ruff/rules/error-suffix-on-exception-name/
2023-09-30 10:31:22 +02:00
Jörg Thalheim
a1f01abe53 nixos/test-driver: apply ruff fixes & suggestions 2023-09-30 10:31:22 +02:00
Jörg Thalheim
93b1fa09d5 nixos/test-driver: disable typecheck for dependencies where don't have typing 2023-09-30 10:18:07 +02:00
Jörg Thalheim
d746557260 nixos/test-driver: add shell.nix
this useful for local development
2023-09-30 10:18:07 +02:00
Jörg Thalheim
9ac9e8407f nixos/test-driver: fix type errors in extract-docstrings 2023-09-30 10:18:06 +02: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
Raito Bezarius
81becd3c44 nixos/lib/test-driver: reduce spam at boot hangs
Since 008f9f0cd4
 ("nixos/test-driver: actually use the backdoor message to wait for backdoor"),

when boot is still computering, we can get a tons of empty strings in response to the shell.

This is not really useful to print and waste the disk space for any CI system that logs them.

We stop logging chunks whenever they are empty.
2023-09-29 03:45:31 +02:00
ign0tus
237f7ba7d2 networkd: Allow combinations of WakeOnLan policies
To comply with the systemd.link WakeOnLan[^1] specification, the option
"off" and all other possible policy combinations must be allowed.

[^1]: https://www.freedesktop.org/software/systemd/man/systemd.link.html#WakeOnLan=
2023-09-28 17:04:35 +02:00
Maciej Krüger
03762aa42a
test-driver: revert stderr nullpipe
Removes 2>/dev/null which re-adds stderr output breaking execute
2023-09-22 15:14:13 +02:00
Artturi
7f45760504
Merge pull request #192593 from jlesquembre/test-driver 2023-09-21 00:47:45 +03:00
José Luis Lafuente
c25c10e919 nixos/tests: make wait_for timeouts configurable
While working on #192270, I noticed that only some wait_for_* helper
functions make the timeout configurable. I think we should be able to
customize it in all cases
2023-09-20 21:56:46 +03:00
Maciej Krüger
922926cfbc
Merge pull request #253876 from nbraud/nixos/sudo-rs 2023-09-20 13:55:33 +02:00
Will Fancher
c6db677b1c
Merge pull request #255008 from SuperSandro2000/x-triggers-name
systemd-lib: add name to X-{Reloads,Restart}-Triggers to easily ident…
2023-09-19 17:38:05 -04:00
Maciej Krüger
4729358fa5 nixos/test-driver: do not break if the command writes to stderr
Capturing `stderr` as part of the return `output` could break existing tests.
2023-09-18 17:36:16 +00:00
Artturin
38f37080c5 nixos/lib/make-btrfs-fs: copy improvements from
https://git.sr.ht/~c00w/nixpkgs/tree/sdimagebtrfs/item/nixos/lib/make-btrfs-fs.nix

I made only one change which was to use `btrfs check` instead of
`fsck.btrfs` because of this warning

```
btrfs-fs.img> ++ fsck.btrfs /nix/store/6d46rc768c140asy6rjpc5rk568r36zq-btrfs-fs.img
btrfs-fs.img> If you wish to check the consistency of a BTRFS filesystem or
btrfs-fs.img> repair a damaged filesystem, see btrfs(8) subcommand 'check'.
```

Co-authored-by: Colin L Rice <colin@daedrum.net>
2023-09-15 08:04:40 +03:00
Artturi
fc21cde24b
Merge pull request #91956 from c00w/makebtrfs 2023-09-15 07:37:07 +03:00
Sandro Jäckel
9e5aa81a22
systemd-lib: add name to X-{Reloads,Restart}-Triggers to easily identify to which service/unit/... they belong 2023-09-13 21:03:37 +02:00
Artturi
7b33eb656c
Merge pull request #250318 from Artturin/copycrossfix 2023-09-06 00:37:15 +03:00
Artturin
053e69578f nixos/testing/driver: Copy cross fix from modules/misc/nixpkgs.nix
f7077ba131

Fixes `error: makeWrapper/makeShellWrapper must be in nativeBuildInputs`

`pkgsCross.aarch64-multiplatform.nixosTests.sway`
2023-09-03 00:19:29 +03:00
Rick van Schijndel
12701f7a26
Merge pull request #250248 from Artturin/onlylimiti686
make-squashfs: Only limit cores to 48 on i686
2023-08-20 11:26:28 +02:00
Artturin
91dd8b9324 make-squashfs: Only limit cores to 48 on i686
There shouldn't be a need to limit it on other systems
2023-08-19 23:40:07 +03:00
Jacek Galowicz
36e94693b7
Merge pull request #245879 from teto/test-driver
test-driver: add persistent history
2023-08-17 11:57:37 +02:00
Bobby Rong
a0c846a05a
nixos/test-driver: format
There is a `black --check --diff ${src}/test_driver` check in
nixos-test-driver's checkPhase so this format change will be needed.
2023-07-30 21:24:49 +08:00
Jacek Galowicz
b1b263e5f7
Merge pull request #246093 from blaggacao/fix-nixos-tests-log-backdoor-service-failure
nixos/test-driver: log what to do if backdoor service doesn't come oneline
2023-07-30 13:20:44 +02:00
David Arnold
84d9a1e808
nixos/test-driver: log what to do if backdoor service doesn't come oneline 2023-07-29 15:01:58 -05:00
Matthieu Coudron
3a7597b8a6 test-driver: add persistent history
across sessions of interactive testing
2023-07-29 16:52:31 +02:00
r-vdp
5054472759
nixos: make extendModules retain pkgs on nixos configs 2023-07-28 18:36:05 +02:00
nikstur
a662dc8b73 nixos/lib: systemd definition files function
Add a re-usable function that converts an attrset to a directory
containing systemd definition files.
2023-07-26 23:30:08 +02:00
Jacek Galowicz
f59913bad8
Merge pull request #241949 from R-VdP/nixos_test_busybox
nixos/test-driver: use the short form argument to base64 for busybox compatibility.
2023-07-24 18:05:06 +02:00
Florian Klink
77f8c78bea
Merge pull request #244466 from RaitoBezarius/networkd/netdev-mac
nixos/networkd: fix netdev MAC addresses asserts
2023-07-20 16:39:32 +03:00
Ryan Lahfa
faa1bc7353
Merge pull request #244395 from pogobanane/master 2023-07-20 13:08:17 +02:00