mirror of
https://github.com/vercel-labs/fx.git
synced 2026-10-28 10:15:17 +08:00
Read the shell parity setting from the test environment
Tests never set up the environment `io.getenv` reads, so the shell parity tests never saw `FX_SHELL_PARITY_ALL_SHELLS` and skipped a missing shell even when it was set. They now read it from `std.testing.environ`.
This commit is contained in:
1 file changed
+3
-2
@@ -2080,13 +2080,14 @@ fn checkShellParity(command: []const u8, mode: ParityMode) !void {
|
||||
/// Finds the shell, or returns null to skip it. The Linux unit test job and
|
||||
/// the nightly Fuzz workflow install every shell and set
|
||||
/// `FX_SHELL_PARITY_ALL_SHELLS`, so a missing shell there fails instead of
|
||||
/// quietly narrowing the check.
|
||||
/// quietly narrowing the check. Tests read the process environment from
|
||||
/// `std.testing.environ`, since fx's own environment is never set up in them.
|
||||
fn parityShellPath(shell: ParityShell) !?[]const u8 {
|
||||
for (shell.paths) |path| {
|
||||
std.Io.Dir.accessAbsolute(std.testing.io, path, .{}) catch continue;
|
||||
return path;
|
||||
}
|
||||
if (@import("../shared/io.zig").getenv("FX_SHELL_PARITY_ALL_SHELLS") != null) {
|
||||
if (try std.testing.environ.contains(std.testing.allocator, "FX_SHELL_PARITY_ALL_SHELLS")) {
|
||||
// The failure output names the path where the shell was expected.
|
||||
std.testing.expectEqualStrings(shell.paths[0], "") catch {};
|
||||
return error.TestShellParityShellMissing;
|
||||
|
||||
Reference in new issue
Block a user