Commit Graph

928 Commits

Author SHA1 Message Date
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
Raito Bezarius
1ca68deebd nixos/networkd: fix netdev MAC addresses asserts
The `||` condition made it fail no matter what because nothing can be none and a proper MAC address.

Thanks to trofi for catching it.
2023-07-20 11:03:46 +02:00
Florian Klink
6f66c57acc
Merge pull request #241365 from RaitoBezarius/macaddrs-netdevs
nixos/networkd: support netdev MAC addresses
2023-07-19 23:03:34 +03:00
Pogobanane
d7740c24cb nixos/lib/make-disk-image: fix installBootLoader for disabled grub
This commit is a fixup for a regression introduced by
0bdba6c99b.

Before the regression, it was possible to build images without grub or a
kernel (e.g. to boot other kernels with qemu -kernel.
After the regression, such images fail to build. Since
config.boog.loader.grub.enable is false in that scenario, grub.device is
emptystring. While this happens not to be an issue of `ln`, `dirname`
fails on emptystring.

With this change, we guard both commands to only be run when grub is
actually enabled. Images with and without grub succesfully build with
this change.
2023-07-19 20:04:57 +02:00
Robert Hensing
13222d8d86
Merge pull request #242135 from tfc/test-driver-doc-autogen
Integration Test Driver: Improve documentation, Sync Docs with Code docstrings
2023-07-18 21:17:44 +02:00
Felix Buehler
bec27fabee treewide: use lib.optional instead of 'then []' 2023-07-12 09:36:28 +01:00
Jacek Galowicz
846ad444c7 integration test driver: Auto-generate integration test driver's machine
method documentation of nixos docs from python doc strings
2023-07-10 08:51:52 +02:00
Jacek Galowicz
c916884f86 integration test driver: Synchronize integration test driver's docstrings in Machine class methods with nixos documentation 2023-07-09 13:57:07 +02:00
Jacek Galowicz
c97588eedc integration test driver: Adapt test script checking output 2023-07-09 13:57:07 +02:00
K900
8533b23159 nixos/networkd: fix mismerge of #240969 and #241362 2023-07-09 07:34:42 +03:00
K900
008f9f0cd4 nixos/test-driver: actually use the backdoor message to wait for backdoor
New EDK2 sets up the backdoor port as a serial console, which feeds the test driver
a bunch of boot logs it can safely ignore. Do so by waiting for the message the
backdoor shell prints before doing anything else.
2023-07-08 20:21:50 +03:00
r-vdp
50c922e395
nixos/test-driver: use the short form argument to base64 for busybox compatibility.
Fixes #241938
2023-07-06 17:21:10 +02:00
Raito Bezarius
4d38fa043b nixos/networkd: support netdev MAC addresses
According to systemd.netdev manpage:

```
MACAddress=
           Specifies the MAC address to use for the device, or takes the special value "none". When "none", systemd-networkd does not request the MAC address for
           the device, and the kernel will assign a random MAC address. For "tun", "tap", or "l2tp" devices, the MACAddress= setting in the [NetDev] section is
           not supported and will be ignored. Please specify it in the [Link] section of the corresponding systemd.network(5) file. If this option is not set,
           "vlan" device inherits the MAC address of the master interface. For other kind of netdevs, if this option is not set, then the MAC address is
           generated based on the interface name and the machine-id(5).

           Note, even if "none" is specified, systemd-udevd will assign the persistent MAC address for the device, as 99-default.link has
           MACAddressPolicy=persistent. So, it is also necessary to create a custom .link file for the device, if the MAC address assignment is not desired.
```

Therefore, `none` is an acceptable value.
2023-07-04 01:21:35 +02:00
mutantmell
d51ebb6173 nixos/networkd: refactor
Reduces size of networkd module by moving unit file generation code into a util.
2023-07-01 17:17:51 -07:00
Arthur Gautier
18c734d7f2 nixosTest: adds support for lib.extend
When lib overrides were used, before this commit, they would not be made
available in the configuration evaluation of nixosTest's nodes.

Sample code:
``` nix
let
  pkgs = import ./. {
    overlays = [
      (new: old: {
        lib = old.lib.extend (self: super: {
          sorry_dave = builtins.trace "There are no pod bay doors" "sorry dave";
        });
      })
    ];
  };
in
pkgs.testers.nixosTest {
  name = "demo lib overlay";

  nodes = {
    machine = { lib, ... }: {
      environment.etc."got-lib-overlay".text = lib.sorry_dave;
    };
  };

  testScript = { nodes }:
    ''
      start_all()
      machine.succeed('grep dave /etc/got-lib-overlay')
    '';
}
```
2023-06-29 09:13:44 -07:00
Alyssa Ross
3959a7bef5 nixos/qemu: set qemuSerialDevice for loongarch64
Link: https://www.qemu.org/docs/master/system/loongarch/virt.html#boot-options
2023-06-26 08:58:20 +00:00
pennae
c8b4e5d557
Merge pull request #237557 from pennae/dedocbookify-nixos
nixos/doc: dedocbookify
2023-06-19 14:05:03 +02:00
Ryan Lahfa
3d941b6be8
Merge pull request #236656 from nikstur/qemu-vm-persistent-block-device-names 2023-06-17 14:52:26 +02:00
Raito Bezarius
7088e386ff nixosTests.kexec: reconnect properly after 2nd kexec
By some miracle, before, it was possible to reconnect to the `node1` without
doing any relevant dance.

But now we are direct booting (¿), it seems like we need to do the right things.

This introduces a `check_output` flag for `execute` because we do not want to steal the
messages from the backdoor service as we might execute the kexec too fast compared
to when we will reconnect.

Therefore, we will let the message in the pipe if needed.
2023-06-16 19:43:40 +02:00
nikstur
0bdba6c99b nixos/qemu-vm: use persistent block device names
This change removes the bespoke logic around identifying block devices.
Instead of trying to find the right device by iterating over
`qemu.drives` and guessing the right partition number (e.g.
/dev/vda{1,2}), devices are now identified by persistent names provided
by udev in /dev/disk/by-*.

Before this change, the root device was formatted on demand in the
initrd. However, this makes it impossible to use filesystem identifiers
to identify devices. Now, the formatting step is performed before the VM
is started. Because some tests, however, rely on this behaviour, a
utility function to replace this behaviour in added in
/nixos/tests/common/auto-format-root-device.nix.

Devices that contain neither a partition table nor a filesystem are
identified by their hardware serial number which is injecetd via QEMU
(and is thus persistent and predictable). PCI paths are not a reliably
way to identify devices because their availability and numbering depends
on the QEMU machine type.

This change makes the module more robust against changes in QEMU and the
kernel (non-persistent device naming) and by decoupling abstractions
(i.e. rootDevice, bootPartition, and bootLoaderDevice) enables further
improvement down the line.
2023-06-16 19:36:03 +02:00
Jörg Thalheim
4f992e8da0
Merge pull request #237840 from lilyinstarlight/fix/systemd-initrd-vconsole-test
nixos/tests/systemd-initrd-vconsole: fix test and improve reliability
2023-06-15 19:41:08 +01:00
Lily Foster
f1f0d4fbdd
nixos/test-driver: fix timeout option for wait_for_console_text 2023-06-15 06:47:49 -04:00
pennae
f52f531a4e nixos/make-options-doc: deprecate docbook outputs
they're no longer necessary for us and will almost definitely start to
rot now (like commonmark and asciidoc outputs did previously). most
existing users seem to take the docbook output and run it through pandoc
to generate html, those can easily migrate to use commonmark instead.
other users will hopefully pipe up when they notice that things they rely
on are going away.

optionsUsedDocbook has only been around for one release and only exposed
to allow other places to generate warnings, so that does not deserve
such precautions.
2023-06-13 16:56:32 +02:00
pennae
20152b4269 nixos/doc: remove docbook options compatibility
no longer needed or useful, and may even produce false positives now
that markdown is the default language for option docs.
2023-06-13 16:56:31 +02:00
pennae
1418c986b0 nixos/make-options-doc: remove options postprocessing
with everything being rendered from markdown now we no longer need to
postprocess any options.xml that may be requested from elsewhere. we'll
don't need to keep the module path check either since that's done by
optionsJSON now.
2023-06-13 16:56:31 +02:00
pennae
af1f07ff03 nixos/make-options-doc: check for manual paths in options.json
since we no longer use the docbook path the check there will no longer
fire. add one to optionsJSON to not lose this functionality.
2023-06-13 16:56:31 +02:00
pennae
34eeac5544 nixos-render-docs: default to markdown for options
docbook is now gone and we can flip the defaults. we won't keep the
command line args around (unlike the make-options-docs argument) because
nixos-render-docs should not be considered an exposed API.
2023-06-13 16:56:31 +02:00
pennae
c01244394c nixos/make-options-doc: force markdownByDefault
with docbook no longer supported we can default to markdown option docs.
we'll keep the parameter around for a bit to not break external users
who set it to true. we don't know of any users that do, so the
deprecation period may be rather short for this one.
2023-06-13 16:56:30 +02:00