Skip to content

Commit 1421420

Browse files
committed
test: Move unusual-logging to run only in logging test case
1 parent 03d4bfd commit 1421420

3 files changed

Lines changed: 19 additions & 15 deletions

File tree

tests/functional/dependencies.nix

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,6 @@ let
3333
outputHash = "1dq9p0hnm1y75q2x40fws5887bq1r840hzdxak0a9djbwvx0b16d";
3434
};
3535

36-
unusual-logging = mkDerivation {
37-
name = "unusual-logging";
38-
buildCommand = ''
39-
{
40-
echo "@nix 1"
41-
echo "@nix {}"
42-
echo '@nix {"action": null}'
43-
echo '@nix {"action": 123}'
44-
echo '@nix ]['
45-
} >&$NIX_LOG_FD
46-
touch $out
47-
'';
48-
};
49-
5036
in
5137
mkDerivation {
5238
name = "dependencies-top";
@@ -56,7 +42,6 @@ mkDerivation {
5642
input1_drv = input1;
5743
input2_drv = input2;
5844
input0_drv = input0;
59-
unusual_logging_drv = unusual-logging;
6045
fod_input_drv = fod_input;
6146
meta.description = "Random test package";
6247
}

tests/functional/logging.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ outp="$(nix-build -E \
2828
test -d "$outp"
2929

3030
nix log "$outp"
31+
32+
# Build works despite ill-formed structured build log entries.
33+
expectStderr 0 nix build -f ./logging/unusual-logging.nix --no-link | grepQuiet 'warning: Unable to handle a JSON message from the derivation builder:'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
let
2+
inherit (import ../config.nix) mkDerivation;
3+
in
4+
mkDerivation {
5+
name = "unusual-logging";
6+
buildCommand = ''
7+
{
8+
echo "@nix 1"
9+
echo "@nix {}"
10+
echo '@nix {"action": null}'
11+
echo '@nix {"action": 123}'
12+
echo '@nix ]['
13+
} >&$NIX_LOG_FD
14+
touch $out
15+
'';
16+
}

0 commit comments

Comments
 (0)