diff options
author | Tobias Bergkvist <tobias@bergkv.ist> | 2021-10-04 22:35:09 +0200 |
---|---|---|
committer | Tobias Bergkvist <tobias@bergkv.ist> | 2021-10-04 22:35:09 +0200 |
commit | b7d36b8d597df1a9d799fa9d6d8d55137a525570 (patch) | |
tree | 716510254e300367537f66567387c9694747c9b3 /pkgs/test/make-binary-wrapper/env.c | |
parent | adef70ce7c964e0d1d9d961783036541323b06a7 (diff) |
Add golden tests for make-binary-wrapper.
To run tests after cloning on linux, use the following:
nix-build pkgs/top-level/release.nix -A tests.make-binary-wrapper.x86_64-linux
Diffstat (limited to 'pkgs/test/make-binary-wrapper/env.c')
-rw-r--r-- | pkgs/test/make-binary-wrapper/env.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/test/make-binary-wrapper/env.c b/pkgs/test/make-binary-wrapper/env.c new file mode 100644 index 000000000000..89f1f496b349 --- /dev/null +++ b/pkgs/test/make-binary-wrapper/env.c @@ -0,0 +1,17 @@ +// makeCWrapper /hello/world \ + --set PART1 HELLO \ + --set-default PART2 WORLD \ + --unset SOME_OTHER_VARIABLE \ + --set PART3 $'"!!\n"' + +#include <unistd.h> +#include <stdlib.h> + +int main(int argc, char **argv) { + putenv("PART1=HELLO"); + setenv("PART2", "WORLD", 0); + unsetenv("SOME_OTHER_VARIABLE"); + putenv("PART3=\"!!\n\""); + argv[0] = "/hello/world"; + return execv("/hello/world", argv); +}
\ No newline at end of file |