Files
lix/tests/functional/logging.sh
T
Robert HensingandLinus Heckemann 66da3fd63f libstore: more precise origin info for strange structured logs
Robert made these improvements on the PR that cherry-picked
e55cd3beea /
https://gerrit.lix.systems/c/lix/+/2057
from Lix into CppNix:
https://github.com/NixOS/nix/pull/11921

Push log source description out of libutil and report build hook @nix warning correctly

(cherry picked from commit 03d4bfd852dce9a050f984e887c887a43581796c)

test: Move unusual-logging to run only in logging test case

(cherry picked from commit 1421420e862434321c46511a3152016e443dd479)

Remove redundant warning: prefix from structured build log warning

(cherry picked from commit f3c722cab24f7a0de8c3573d25e91749f4f16234)
Change-Id: I7da99046f2a41b3c58e62351119bc89bcc25a703
2025-02-16 14:15:36 +01:00

30 lines
846 B
Bash

source common.sh
clearStore
path=$(nix-build dependencies.nix --no-out-link)
# Test nix-store -l.
[ "$(nix-store -l $path)" = FOO ]
# Test compressed logs.
clearStore
rm -rf $NIX_LOG_DIR
(! nix-store -l $path)
nix-build dependencies.nix --no-out-link --compress-build-log
[ "$(nix-store -l $path)" = FOO ]
# test whether empty logs work fine with `nix log`.
builder="$(realpath "$(mktemp)")"
echo -e "#!/bin/sh\nmkdir \$out" > "$builder"
outp="$(nix-build -E \
'with import ./config.nix; mkDerivation { name = "fnord"; builder = '"$builder"'; }' \
--out-link "$(mktemp -d)/result")"
test -d "$outp"
nix log "$outp"
# Build works despite ill-formed structured build log entries.
expectStderr 0 nix build -f ./logging/unusual-logging.nix --no-link | grepQuiet 'warning: Unable to handle a JSON message from the derivation builder:'