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)
|
#define assert_success(e) do { if ((e) < 0) { perror(#e); abort(); } } while (0)
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
assert_success(chdir("/tmp/foo"));
|
assert_success(chdir("./tmp/foo"));
|
||||||
argv[0] = "/send/me/flags";
|
argv[0] = "/send/me/flags";
|
||||||
return execv("/send/me/flags", argv);
|
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
|
SUBST_ARGV0
|
||||||
|
@ -6,7 +6,7 @@ let
|
|||||||
${gcc}/bin/cc -Wall -Werror -Wpedantic -o $out ${./envcheck.c}
|
${gcc}/bin/cc -Wall -Werror -Wpedantic -o $out ${./envcheck.c}
|
||||||
'';
|
'';
|
||||||
makeGoldenTest = testname: runCommand "test-wrapper_${testname}" env ''
|
makeGoldenTest = testname: runCommand "test-wrapper_${testname}" env ''
|
||||||
mkdir -p /tmp/foo
|
mkdir -p ./tmp/foo
|
||||||
|
|
||||||
params=$(<"${./.}/${testname}.cmdline")
|
params=$(<"${./.}/${testname}.cmdline")
|
||||||
eval "makeCWrapper /send/me/flags $params" > wrapper.c
|
eval "makeCWrapper /send/me/flags $params" > wrapper.c
|
||||||
|
Loading…
Reference in New Issue
Block a user