summary refs log tree commit diff
path: root/pkgs/test/make-binary-wrapper
diff options
context:
space:
mode:
authorTobias Bergkvist <tobias@bergkv.ist>2021-12-10 21:21:14 +0100
committerTobias Bergkvist <tobias@bergkv.ist>2021-12-16 21:12:59 +0100
commit228d451e0388118572e4113afbf34ea2eaf3f55f (patch)
treed71e3151d4f49403ab2b6b318ccedad50e5fcacf /pkgs/test/make-binary-wrapper
parentf7b5083cb6f175834dc6dfc49c78cedb90eb0b0b (diff)
downloadnixpkgs-228d451e0388118572e4113afbf34ea2eaf3f55f.tar
nixpkgs-228d451e0388118572e4113afbf34ea2eaf3f55f.tar.gz
nixpkgs-228d451e0388118572e4113afbf34ea2eaf3f55f.tar.bz2
nixpkgs-228d451e0388118572e4113afbf34ea2eaf3f55f.tar.lz
nixpkgs-228d451e0388118572e4113afbf34ea2eaf3f55f.tar.xz
nixpkgs-228d451e0388118572e4113afbf34ea2eaf3f55f.tar.zst
nixpkgs-228d451e0388118572e4113afbf34ea2eaf3f55f.zip
makeBinaryWrapper: Fix chdir golden test for darwin
On macOS, /tmp is a symlink to /private/tmp. When performing cd /tmp, and checking cwd - it won't match since it follows the symlink.

This caused test breakage on macOS but not Linux. Instead, use a folder which is not a symlink, and consistent across Linux and macOS.
Diffstat (limited to 'pkgs/test/make-binary-wrapper')
-rw-r--r--pkgs/test/make-binary-wrapper/chdir.c2
-rw-r--r--pkgs/test/make-binary-wrapper/chdir.cmdline2
-rw-r--r--pkgs/test/make-binary-wrapper/chdir.env2
-rw-r--r--pkgs/test/make-binary-wrapper/default.nix2
4 files changed, 4 insertions, 4 deletions
diff --git a/pkgs/test/make-binary-wrapper/chdir.c b/pkgs/test/make-binary-wrapper/chdir.c
index c67c695b1c3..9e0b7e2c7f5 100644
--- a/pkgs/test/make-binary-wrapper/chdir.c
+++ b/pkgs/test/make-binary-wrapper/chdir.c
@@ -5,7 +5,7 @@
 #define assert_success(e) do { if ((e) < 0) { perror(#e); abort(); } } while (0)
 
 int main(int argc, char **argv) {
-    assert_success(chdir("/tmp/foo"));
+    assert_success(chdir("./tmp/foo"));
     argv[0] = "/send/me/flags";
     return execv("/send/me/flags", argv);
 }
diff --git a/pkgs/test/make-binary-wrapper/chdir.cmdline b/pkgs/test/make-binary-wrapper/chdir.cmdline
index 15235f20621..d6ab081e8d3 100644
--- a/pkgs/test/make-binary-wrapper/chdir.cmdline
+++ b/pkgs/test/make-binary-wrapper/chdir.cmdline
@@ -1 +1 @@
-    --chdir /tmp/foo
+    --chdir ./tmp/foo
diff --git a/pkgs/test/make-binary-wrapper/chdir.env b/pkgs/test/make-binary-wrapper/chdir.env
index db129d68af7..ea1c61054e5 100644
--- a/pkgs/test/make-binary-wrapper/chdir.env
+++ b/pkgs/test/make-binary-wrapper/chdir.env
@@ -1,2 +1,2 @@
-CWD=/tmp/foo
+CWD=SUBST_CWD/tmp/foo
 SUBST_ARGV0
diff --git a/pkgs/test/make-binary-wrapper/default.nix b/pkgs/test/make-binary-wrapper/default.nix
index c5bb6970aac..7b4d0b26b5c 100644
--- a/pkgs/test/make-binary-wrapper/default.nix
+++ b/pkgs/test/make-binary-wrapper/default.nix
@@ -6,7 +6,7 @@ let
     ${gcc}/bin/cc -Wall -Werror -Wpedantic -o $out ${./envcheck.c}
   '';
   makeGoldenTest = testname: runCommand "test-wrapper_${testname}" env ''
-    mkdir -p /tmp/foo
+    mkdir -p ./tmp/foo
 
     params=$(<"${./.}/${testname}.cmdline")
     eval "makeCWrapper /send/me/flags $params" > wrapper.c