mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 07:01:54 +00:00
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.
This commit is contained in:
parent
f7b5083cb6
commit
228d451e03
@ -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);
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
--chdir /tmp/foo
|
||||
--chdir ./tmp/foo
|
||||
|
@ -1,2 +1,2 @@
|
||||
CWD=/tmp/foo
|
||||
CWD=SUBST_CWD/tmp/foo
|
||||
SUBST_ARGV0
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user