aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThéophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>2023-01-13 11:00:56 +0100
committerGitHub <noreply@github.com>2023-01-13 11:00:56 +0100
commitbdeb6de889219cb9d1ba94b4adc75b0d8000e1b2 (patch)
tree7248384116e25e1078aa884972337de198ba493b /tests
parentdda71d3726a1767dbd4674cde6e130093e290183 (diff)
parente5eb05c5990d837e0bbc1529e3b5b167f7015be0 (diff)
Merge pull request #7430 from tweag/ca/fix-nix-log
Ca/fix nix log
Diffstat (limited to 'tests')
-rw-r--r--tests/build-hook-ca-floating.nix55
-rw-r--r--tests/build-hook.nix11
-rw-r--r--tests/build-remote.sh9
3 files changed, 16 insertions, 59 deletions
diff --git a/tests/build-hook-ca-floating.nix b/tests/build-hook-ca-floating.nix
index 67295985f..dfdbb82da 100644
--- a/tests/build-hook-ca-floating.nix
+++ b/tests/build-hook-ca-floating.nix
@@ -1,53 +1,6 @@
{ busybox }:
-with import ./config.nix;
-
-let
-
- mkDerivation = args:
- derivation ({
- inherit system;
- builder = busybox;
- args = ["sh" "-e" args.builder or (builtins.toFile "builder-${args.name}.sh" "if [ -e .attrs.sh ]; then source .attrs.sh; fi; eval \"$buildCommand\"")];
- outputHashMode = "recursive";
- outputHashAlgo = "sha256";
- __contentAddressed = true;
- } // removeAttrs args ["builder" "meta"])
- // { meta = args.meta or {}; };
-
- input1 = mkDerivation {
- shell = busybox;
- name = "build-remote-input-1";
- buildCommand = "echo FOO > $out";
- requiredSystemFeatures = ["foo"];
- };
-
- input2 = mkDerivation {
- shell = busybox;
- name = "build-remote-input-2";
- buildCommand = "echo BAR > $out";
- requiredSystemFeatures = ["bar"];
- };
-
- input3 = mkDerivation {
- shell = busybox;
- name = "build-remote-input-3";
- buildCommand = ''
- read x < ${input2}
- echo $x BAZ > $out
- '';
- requiredSystemFeatures = ["baz"];
- };
-
-in
-
- mkDerivation {
- shell = busybox;
- name = "build-remote";
- buildCommand =
- ''
- read x < ${input1}
- read y < ${input3}
- echo "$x $y" > $out
- '';
- }
+import ./build-hook.nix {
+ inherit busybox;
+ contentAddressed = true;
+}
diff --git a/tests/build-hook.nix b/tests/build-hook.nix
index 643334caa..7effd7903 100644
--- a/tests/build-hook.nix
+++ b/tests/build-hook.nix
@@ -1,15 +1,22 @@
-{ busybox }:
+{ busybox, contentAddressed ? false }:
with import ./config.nix;
let
+ caArgs = if contentAddressed then {
+ outputHashMode = "recursive";
+ outputHashAlgo = "sha256";
+ __contentAddressed = true;
+ } else {};
+
mkDerivation = args:
derivation ({
inherit system;
builder = busybox;
args = ["sh" "-e" args.builder or (builtins.toFile "builder-${args.name}.sh" "if [ -e .attrs.sh ]; then source .attrs.sh; fi; eval \"$buildCommand\"")];
- } // removeAttrs args ["builder" "meta" "passthru"])
+ } // removeAttrs args ["builder" "meta" "passthru"]
+ // caArgs)
// { meta = args.meta or {}; passthru = args.passthru or {}; };
input1 = mkDerivation {
diff --git a/tests/build-remote.sh b/tests/build-remote.sh
index e73c37ea4..25a482003 100644
--- a/tests/build-remote.sh
+++ b/tests/build-remote.sh
@@ -63,12 +63,9 @@ nix path-info --store $TEST_ROOT/machine3 --all \
| grep builder-build-remote-input-3.sh
-# Temporarily disabled because of https://github.com/NixOS/nix/issues/6209
-if [[ -z "$CONTENT_ADDRESSED" ]]; then
- for i in input1 input3; do
- nix log --store $TEST_ROOT/machine0 --file "$file" --arg busybox $busybox passthru."$i" | grep hi-$i
- done
-fi
+for i in input1 input3; do
+nix log --store $TEST_ROOT/machine0 --file "$file" --arg busybox $busybox passthru."$i" | grep hi-$i
+done
# Behavior of keep-failed
out="$(nix-build 2>&1 failing.nix \