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" {
|
test "Command: pre exec" {
|
||||||
if (builtin.os.tag == .windows) return error.SkipZigTest;
|
if (builtin.os.tag == .windows) return error.SkipZigTest;
|
||||||
var cmd: Command = .{
|
var cmd: Command = .{
|
||||||
.path = "/usr/bin/env",
|
.path = "/bin/sh",
|
||||||
.args = &.{ "/usr/bin/env", "-v" },
|
.args = &.{ "/bin/sh", "--help" },
|
||||||
.pre_exec = (struct {
|
.pre_exec = (struct {
|
||||||
fn do(_: *Command) void {
|
fn do(_: *Command) void {
|
||||||
// This runs in the child, so we can exit and it won't
|
// 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"},
|
.args = &.{"C:\\Windows\\System32\\whoami.exe"},
|
||||||
.stdout = stdout,
|
.stdout = stdout,
|
||||||
} else .{
|
} else .{
|
||||||
.path = "/usr/bin/env",
|
.path = "/bin/sh",
|
||||||
.args = &.{ "/usr/bin/env", "-v" },
|
.args = &.{ "/bin/sh", "-c", "echo hello" },
|
||||||
.stdout = stdout,
|
.stdout = stdout,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -664,8 +664,8 @@ test "Command: custom env vars" {
|
|||||||
.stdout = stdout,
|
.stdout = stdout,
|
||||||
.env = &env,
|
.env = &env,
|
||||||
} else .{
|
} else .{
|
||||||
.path = "/usr/bin/env",
|
.path = "/bin/sh",
|
||||||
.args = &.{ "/usr/bin/env", "sh", "-c", "echo $VALUE" },
|
.args = &.{ "/bin/sh", "-c", "echo $VALUE" },
|
||||||
.stdout = stdout,
|
.stdout = stdout,
|
||||||
.env = &env,
|
.env = &env,
|
||||||
};
|
};
|
||||||
@ -700,10 +700,10 @@ test "Command: custom working directory" {
|
|||||||
.stdout = stdout,
|
.stdout = stdout,
|
||||||
.cwd = "C:\\Windows\\System32",
|
.cwd = "C:\\Windows\\System32",
|
||||||
} else .{
|
} else .{
|
||||||
.path = "/usr/bin/env",
|
.path = "/bin/sh",
|
||||||
.args = &.{ "/usr/bin/env", "sh", "-c", "pwd" },
|
.args = &.{ "/bin/sh", "-c", "pwd" },
|
||||||
.stdout = stdout,
|
.stdout = stdout,
|
||||||
.cwd = "/usr/bin",
|
.cwd = "/bin",
|
||||||
};
|
};
|
||||||
|
|
||||||
try cmd.start(testing.allocator);
|
try cmd.start(testing.allocator);
|
||||||
|
Reference in New Issue
Block a user