mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
testing: update tests to point a ~real binary
`/usr/bin/env` does not exist in a nix build sandbox. This only works as a test binary when running in `nix develop` as it shares its environment with the user `/bin/sh` isn't amazing as a target as it's relying on stdenv creating it in a build sandbox and users having while running `nix develop`. Alternatives require build flags or some sort of contract with packaging.
This commit is contained in:
@ -588,8 +588,8 @@ test "createNullDelimitedEnvMap" {
|
||||
test "Command: pre exec" {
|
||||
if (builtin.os.tag == .windows) return error.SkipZigTest;
|
||||
var cmd: Command = .{
|
||||
.path = "/usr/bin/env",
|
||||
.args = &.{ "/usr/bin/env", "-v" },
|
||||
.path = "/bin/sh",
|
||||
.args = &.{ "/bin/sh", "--help" },
|
||||
.pre_exec = (struct {
|
||||
fn do(_: *Command) void {
|
||||
// This runs in the child, so we can exit and it won't
|
||||
@ -630,8 +630,8 @@ test "Command: redirect stdout to file" {
|
||||
.args = &.{"C:\\Windows\\System32\\whoami.exe"},
|
||||
.stdout = stdout,
|
||||
} else .{
|
||||
.path = "/usr/bin/env",
|
||||
.args = &.{ "/usr/bin/env", "-v" },
|
||||
.path = "/bin/sh",
|
||||
.args = &.{ "/bin/sh", "-c", "echo hello" },
|
||||
.stdout = stdout,
|
||||
};
|
||||
|
||||
@ -664,8 +664,8 @@ test "Command: custom env vars" {
|
||||
.stdout = stdout,
|
||||
.env = &env,
|
||||
} else .{
|
||||
.path = "/usr/bin/env",
|
||||
.args = &.{ "/usr/bin/env", "sh", "-c", "echo $VALUE" },
|
||||
.path = "/bin/sh",
|
||||
.args = &.{ "/bin/sh", "-c", "echo $VALUE" },
|
||||
.stdout = stdout,
|
||||
.env = &env,
|
||||
};
|
||||
@ -700,10 +700,10 @@ test "Command: custom working directory" {
|
||||
.stdout = stdout,
|
||||
.cwd = "C:\\Windows\\System32",
|
||||
} else .{
|
||||
.path = "/usr/bin/env",
|
||||
.args = &.{ "/usr/bin/env", "sh", "-c", "pwd" },
|
||||
.path = "/bin/sh",
|
||||
.args = &.{ "/bin/sh", "-c", "pwd" },
|
||||
.stdout = stdout,
|
||||
.cwd = "/usr/bin",
|
||||
.cwd = "/bin",
|
||||
};
|
||||
|
||||
try cmd.start(testing.allocator);
|
||||
|
Reference in New Issue
Block a user