test(tvix): Fix tvix tests on macOS

Prior to this, some tests would not build
or would fail in an obscure way.

Change-Id: I68587cc7592492ebfd71ca02fc7ccc9ff7c0196f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11544
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Alice Carroll 2024-04-29 20:20:52 +03:00 committed by caralice
parent c192cd04b8
commit 8d49ff3d64
3 changed files with 26 additions and 7 deletions

View file

@ -739,6 +739,7 @@ mod tests {
false
)]
fn builtins_filter_source_unsupported_files(#[case] code: &str, #[case] exp_success: bool) {
use nix::errno::Errno;
use nix::sys::stat;
use nix::unistd;
use std::os::unix::net::UnixListener;
@ -765,6 +766,15 @@ mod tests {
stat::Mode::S_IRWXU,
0,
)
.inspect_err(|e| {
if *e == Errno::EPERM {
eprintln!(
"\
Missing permissions to create a character device node with mknod(2).
Please run this test as root or set CAP_MKNOD."
);
}
})
.expect("Failed to create a character device node");
let code_replaced = code.replace("@fixtures", &temp.path().to_string_lossy());