aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/fetchurl.sh2
-rw-r--r--tests/init.sh1
-rw-r--r--tests/lang/eval-okay-attrs6.exp1
-rw-r--r--tests/lang/eval-okay-attrs6.nix4
-rw-r--r--tests/lang/eval-okay-tojson.exp2
-rw-r--r--tests/lang/eval-okay-tojson.nix1
-rw-r--r--tests/nix-copy-closure.nix4
-rw-r--r--tests/nix-shell.sh8
-rw-r--r--tests/referrers.sh4
-rw-r--r--tests/remote-builds.nix4
-rw-r--r--tests/setuid.nix2
-rw-r--r--tests/shell.nix3
12 files changed, 22 insertions, 14 deletions
diff --git a/tests/fetchurl.sh b/tests/fetchurl.sh
index 7319ced2b..2535651b0 100644
--- a/tests/fetchurl.sh
+++ b/tests/fetchurl.sh
@@ -35,7 +35,7 @@ clearStore
hash=$(nix hash-file --type sha512 --base64 ./fetchurl.sh)
hash32=$(nix hash-file --type sha512 --base16 ./fetchurl.sh)
-mirror=$TMPDIR/hashed-mirror
+mirror=$TEST_ROOT/hashed-mirror
rm -rf $mirror
mkdir -p $mirror/sha512
ln -s $(pwd)/fetchurl.sh $mirror/sha512/$hash32
diff --git a/tests/init.sh b/tests/init.sh
index 19a12c1e2..6a119aad0 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -17,6 +17,7 @@ cat > "$NIX_CONF_DIR"/nix.conf <<EOF
build-users-group =
keep-derivations = false
sandbox = false
+experimental-features = nix-command
include nix.conf.extra
EOF
diff --git a/tests/lang/eval-okay-attrs6.exp b/tests/lang/eval-okay-attrs6.exp
new file mode 100644
index 000000000..b46938032
--- /dev/null
+++ b/tests/lang/eval-okay-attrs6.exp
@@ -0,0 +1 @@
+{ __overrides = { bar = "qux"; }; bar = "qux"; foo = "bar"; }
diff --git a/tests/lang/eval-okay-attrs6.nix b/tests/lang/eval-okay-attrs6.nix
new file mode 100644
index 000000000..2e5c85483
--- /dev/null
+++ b/tests/lang/eval-okay-attrs6.nix
@@ -0,0 +1,4 @@
+rec {
+ "${"foo"}" = "bar";
+ __overrides = { bar = "qux"; };
+}
diff --git a/tests/lang/eval-okay-tojson.exp b/tests/lang/eval-okay-tojson.exp
index 33588493f..e92aae323 100644
--- a/tests/lang/eval-okay-tojson.exp
+++ b/tests/lang/eval-okay-tojson.exp
@@ -1 +1 @@
-"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3,\"j\":1.44}"
+"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3,\"j\":1.44,\"k\":\"foo\"}"
diff --git a/tests/lang/eval-okay-tojson.nix b/tests/lang/eval-okay-tojson.nix
index c046ba4ae..ce67943be 100644
--- a/tests/lang/eval-okay-tojson.nix
+++ b/tests/lang/eval-okay-tojson.nix
@@ -9,4 +9,5 @@ builtins.toJSON
h = [ "a" [ "b" { "foo\nbar" = {}; } ] ];
i = 1 + 2;
j = 1.44;
+ k = { __toString = self: self.a; a = "foo"; };
}
diff --git a/tests/nix-copy-closure.nix b/tests/nix-copy-closure.nix
index 0dc147fb3..bb5db7410 100644
--- a/tests/nix-copy-closure.nix
+++ b/tests/nix-copy-closure.nix
@@ -8,11 +8,11 @@ makeTest (let pkgA = pkgs.cowsay; pkgB = pkgs.wget; pkgC = pkgs.hello; in {
nodes =
{ client =
- { config, pkgs, ... }:
+ { config, lib, pkgs, ... }:
{ virtualisation.writableStore = true;
virtualisation.pathsInNixDB = [ pkgA ];
nix.package = nix;
- nix.binaryCaches = [ ];
+ nix.binaryCaches = lib.mkForce [ ];
};
server =
diff --git a/tests/nix-shell.sh b/tests/nix-shell.sh
index ee502dddb..235e2a5ff 100644
--- a/tests/nix-shell.sh
+++ b/tests/nix-shell.sh
@@ -7,9 +7,9 @@ export IMPURE_VAR=foo
export SELECTED_IMPURE_VAR=baz
export NIX_BUILD_SHELL=$SHELL
output=$(nix-shell --pure shell.nix -A shellDrv --run \
- 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX"')
+ 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX - $TEST_inNixShell"')
-[ "$output" = " - foo - bar" ]
+[ "$output" = " - foo - bar - true" ]
# Test --keep
output=$(nix-shell --pure --keep SELECTED_IMPURE_VAR shell.nix -A shellDrv --run \
@@ -19,10 +19,10 @@ output=$(nix-shell --pure --keep SELECTED_IMPURE_VAR shell.nix -A shellDrv --run
# Test nix-shell on a .drv
[[ $(nix-shell --pure $(nix-instantiate shell.nix -A shellDrv) --run \
- 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX"') = " - foo - bar" ]]
+ 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX - $TEST_inNixShell"') = " - foo - bar - false" ]]
[[ $(nix-shell --pure $(nix-instantiate shell.nix -A shellDrv) --run \
- 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX"') = " - foo - bar" ]]
+ 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX - $TEST_inNixShell"') = " - foo - bar - false" ]]
# Test nix-shell on a .drv symlink
diff --git a/tests/referrers.sh b/tests/referrers.sh
index 8ab8e5ddf..614dd8f5b 100644
--- a/tests/referrers.sh
+++ b/tests/referrers.sh
@@ -4,9 +4,9 @@ clearStore
max=500
-reference=$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+reference=$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bla
touch $reference
-(echo $reference && echo && echo 0) | nix-store --register-validity
+(echo $reference && echo && echo 0) | nix-store --register-validity
echo "making registration..."
diff --git a/tests/remote-builds.nix b/tests/remote-builds.nix
index b867f13b4..18d490830 100644
--- a/tests/remote-builds.nix
+++ b/tests/remote-builds.nix
@@ -40,7 +40,7 @@ in
builder2 = builder;
client =
- { config, pkgs, ... }:
+ { config, lib, pkgs, ... }:
{ nix.maxJobs = 0; # force remote building
nix.distributedBuilds = true;
nix.buildMachines =
@@ -60,7 +60,7 @@ in
virtualisation.writableStore = true;
virtualisation.pathsInNixDB = [ config.system.build.extraUtils ];
nix.package = nix;
- nix.binaryCaches = [ ];
+ nix.binaryCaches = lib.mkForce [ ];
programs.ssh.extraConfig = "ConnectTimeout 30";
};
};
diff --git a/tests/setuid.nix b/tests/setuid.nix
index 77e83c8d6..63d3c05cb 100644
--- a/tests/setuid.nix
+++ b/tests/setuid.nix
@@ -10,7 +10,7 @@ makeTest {
{ config, lib, pkgs, ... }:
{ virtualisation.writableStore = true;
nix.package = nix;
- nix.binaryCaches = [ ];
+ nix.binaryCaches = lib.mkForce [ ];
nix.nixPath = [ "nixpkgs=${lib.cleanSource pkgs.path}" ];
virtualisation.pathsInNixDB = [ pkgs.stdenv pkgs.pkgsi686Linux.stdenv ];
};
diff --git a/tests/shell.nix b/tests/shell.nix
index eb39f9039..6cb4f082b 100644
--- a/tests/shell.nix
+++ b/tests/shell.nix
@@ -1,4 +1,4 @@
-{ }:
+{ inNixShell ? false }:
with import ./config.nix;
@@ -22,6 +22,7 @@ let pkgs = rec {
name = "shellDrv";
builder = "/does/not/exist";
VAR_FROM_NIX = "bar";
+ TEST_inNixShell = if inNixShell then "true" else "false";
inherit stdenv;
};