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:
Tobias Bergkvist 2021-12-10 21:21:14 +01:00
parent f7b5083cb6
commit 228d451e03
4 changed files with 4 additions and 4 deletions

View File

@ -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);
}

View File

@ -1 +1 @@
--chdir /tmp/foo
--chdir ./tmp/foo

View File

@ -1,2 +1,2 @@
CWD=/tmp/foo
CWD=SUBST_CWD/tmp/foo
SUBST_ARGV0

View File

@ -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