nixpkgs/nixos/lib
rnhmjoj ca1b1f6dc0
nixos/test-driver: highlight driver log lines
There is a whole lot of noise in a NixOS test log due to journal,
commands, and test driver messages all being mixing together.
With this commit the test driver messages are highlighted so you don't
have to squint too much to see where a subtest starts and ends or what
was the last command being run.

Here's an excerpt from a highlighted log:

    machine # [    6.647826] dhcpcd[668]: eth0: adding default route via 10.0.2.2
    machine # I've had a great day!
    (finished: must succeed: curl -sfL https://example.com/how-are-you? | tee /dev/stderr, in 0.19 seconds)
    (finished: subtest: Privoxy can filter https requests, in 0.22 seconds)
    subtest: Blocks are working
    machine: waiting for TCP port 443
    machine # Connection to localhost (::1) 443 port [tcp/https] succeeded!
    (finished: waiting for TCP port 443, in 0.03 seconds)
    machine: must fail: curl -f https://example.com/ads 1>&2
    machine # [    6.730608] nscd[742]: 742 monitored file `/etc/resolv.conf` was written to
    machine # [    6.733071] privoxy[814]: 2022-04-14 09:41:01.695 7fa995c39640 Actions: +block{Fake ads} ...
    machine # curl: (22) The requested URL returned error: 403
    machine # [    6.753098] systemd[1]: Stopping Name Service Cache Daemon...
    machine # [    6.755632] systemd[1]: nscd.service: Deactivated successfully.
    machine # [    6.757069] systemd[1]: Stopped Name Service Cache Daemon.
    (finished: must fail: curl -f https://example.com/ads 1>&2, in 0.07 seconds)
    machine: must succeed: curl -f https://example.com/PRIVOXY-FORCE/ads 1>&2
    machine # [    6.765099] systemd[1]: Starting Name Service Cache Daemon...
    machine # [    6.781519] nscd[925]: 925 monitoring file `/etc/passwd` (1)
    machine # [    6.844105] systemd[1]: Reached target Network is Online.
    machine # [    6.848860] privoxy[814]: 2022-04-14 09:41:01.805 7fa995c39640 Actions: +block{Fake ads} ...
    machine # [    6.856068] nscd[925]: 925 monitoring file `/etc/nsswitch.conf` (8)
    machine # [    6.858229] systemd[1]: Reached target Multi-User System.
    machine # [    6.858934] nscd[925]: 925 monitoring directory `/etc` (2)
    machine # [    6.861315] systemd[1]: Startup finished in 2.374s (kernel) + 4.451s (userspace) = 6.826s.
    machine # Hot Nixpkgs PRs in your area. Click here!
    machine # [    6.873055] nscd[925]: 925 monitoring directory `/etc` (2)
    machine # [    6.874489] nscd[925]: 925 monitoring file `/etc/nsswitch.conf` (8)
    machine # [    6.875599] nscd[925]: 925 monitoring directory `/etc` (2)
    (finished: must succeed: curl -f https://example.com/PRIVOXY-FORCE/ads 1>&2, in 0.12 seconds)
    (finished: subtest: Blocks are working, in 0.22 seconds)
    subtest: Temporary certificates are cleaned
    machine: must succeed: test $(ls /run/privoxy/certs | wc -l) -gt 0
    (finished: must succeed: test $(ls /run/privoxy/certs | wc -l) -gt 0, in 0.02 seconds)
    machine: must succeed: date -s "$(date --date '12 days')"
    (finished: must succeed: date -s "$(date --date '12 days')", in 0.02 seconds)
    machine # [    6.959589] systemd[1]: Started Logrotate Service.
    machine # [    6.966685] systemd[1]: Starting Cleanup of Temporary Directories...
    machine # [    6.974783] systemd[1]: logrotate.service: Deactivated successfully.
    machine # [    7.004493] systemd[1]: systemd-tmpfiles-clean.service: Deactivated successfully.
    machine # [    7.005457] systemd[1]: Finished Cleanup of Temporary Directories.
    machine: must succeed: test $(ls /run/privoxy/certs | wc -l) -eq 0
    (finished: must succeed: test $(ls /run/privoxy/certs | wc -l) -eq 0, in 0.01 seconds)
    (finished: subtest: Temporary certificates are cleaned, in 0.15 seconds)
    (finished: run the VM test script, in 7.44 seconds)
    test script finished in 7.48s
    cleanup
    kill machine (pid 8)
2022-04-14 11:54:21 +02:00
..
make-options-doc lib/modules: Document _module.args 2022-04-05 18:26:40 +02:00
test-driver nixos/test-driver: highlight driver log lines 2022-04-14 11:54:21 +02:00
build-vms.nix nixosTest: Provide system.build.networkConfig 2021-10-17 23:56:52 +02:00
default.nix nixos/lib: Add featureFlags, use it for minimal modules 2022-01-10 12:36:57 +01:00
eval-cacheable-options.nix nixos/documentation: split options doc build 2022-01-02 19:46:13 +01:00
eval-config-minimal.nix nixos/lib: Clarify that nixos.evalModules impl is NOT experimental 2022-01-10 12:36:57 +01:00
eval-config.nix nixos: move default module location logic to eval-config.nix 2022-01-27 22:13:35 +01:00
from-env.nix
make-channel.nix Remove incorrect sentence from make-channel comment 2018-11-04 20:45:49 +01:00
make-disk-image.nix make-disk-image: add systemdMinimal to PATH 2022-04-05 11:57:53 +02:00
make-ext4-fs.nix nixos/lib/make-ext4-fs: Fix: `resize2fs -M' can leave insufficient slack 2021-05-31 21:35:51 +02:00
make-iso9660-image.nix nixos: use nativeBuildInputs in make- iso9660-image and system-tarball 2020-11-18 14:05:30 +01:00
make-iso9660-image.sh installer/cd-dvd/iso-image: avoid leaking build timestamps on non-x86 2022-01-05 12:05:15 -06:00
make-squashfs.nix make-squashfs: use $NIX_BUILD_CORES or 48 cores if above 48 2021-12-08 19:23:31 +02:00
make-system-tarball.nix nixos: use nativeBuildInputs in make- iso9660-image and system-tarball 2020-11-18 14:05:30 +01:00
make-system-tarball.sh use closure-info for building system tarball 2018-11-07 12:52:53 +08:00
make-zfs-image.nix treewide: refactor isi686 && isx86_64 -> isx86 2021-11-20 17:50:41 -08:00
qemu-common.nix Revert "qemu, runInLinuxVM: change default cpu to qemu64" 2022-01-20 15:29:33 +00:00
systemd-lib.nix Merge pull request #164943 from ElvishJerricco/systemd-initrd-reuse-systemd-module 2022-04-03 15:53:02 +02:00
systemd-types.nix nixos/systemd-initrd: Remove unit options that don't work 2022-04-01 11:58:30 +02:00
systemd-unit-options.nix nixos/systemd-unit-options: Fix indentation 2022-04-04 13:53:58 +01:00
testing-python.nix nixosTest: Simplify doc by deprecating syntax sugar 2022-03-28 14:11:58 +02:00
utils.nix nixos: systemd: Split unit types into separate module 2022-03-21 10:25:27 -04:00