From 685f25ebff8e676d16e4de5f86d4ad2845fef23d Mon Sep 17 00:00:00 2001 From: Brian Olsen Date: Sun, 3 Nov 2024 20:18:08 +0100 Subject: fix(tvix/build): Fix tests and clippy warnings on MacOS When running tests for buildservice on MacOS it would fail because of the oci test. I also got some clippy warnings on MacOS because of disabled code. Change-Id: I235739fa4270a4ef46e54d3e2b8cbb55eb20bdda Reviewed-on: https://cl.tvl.fyi/c/depot/+/12726 Reviewed-by: flokli Autosubmit: Brian Olsen Tested-by: BuildkiteCI --- tvix/build/src/buildservice/from_addr.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tvix/build') diff --git a/tvix/build/src/buildservice/from_addr.rs b/tvix/build/src/buildservice/from_addr.rs index ba185bb25514..c88eef2bbdb8 100644 --- a/tvix/build/src/buildservice/from_addr.rs +++ b/tvix/build/src/buildservice/from_addr.rs @@ -14,6 +14,7 @@ use super::oci::OCIBuildService; /// /// As some of these [BuildService] need to talk to a [BlobService] and /// [DirectoryService], these also need to be passed in. +#[cfg_attr(target_os = "macos", allow(unused_variables))] pub async fn from_addr( uri: &str, blob_service: BS, @@ -68,13 +69,17 @@ where mod tests { use super::from_addr; use rstest::rstest; - use std::sync::{Arc, LazyLock}; + use std::sync::Arc; + #[cfg(target_os = "linux")] + use std::sync::LazyLock; + #[cfg(target_os = "linux")] use tempfile::TempDir; use tvix_castore::{ blobservice::{BlobService, MemoryBlobService}, directoryservice::{DirectoryService, MemoryDirectoryService}, }; + #[cfg(target_os = "linux")] static TMPDIR_OCI_1: LazyLock = LazyLock::new(|| TempDir::new().unwrap()); #[rstest] @@ -95,9 +100,9 @@ mod tests { /// Correct scheme to connect to localhost over http, but with additional path, which is invalid. #[case::grpc_invalid_host_and_path("grpc+http://localhost/some-path", false)] /// This configures OCI, but doesn't specify the bundle path - #[case::oci_missing_bundle_dir("oci://", false)] + #[cfg_attr(target_os = "linux", case::oci_missing_bundle_dir("oci://", false))] /// This configures OCI, specifying the bundle path - #[case::oci_bundle_path(&format!("oci://{}", TMPDIR_OCI_1.path().to_str().unwrap()), true)] + #[cfg_attr(target_os = "linux", case::oci_bundle_path(&format!("oci://{}", TMPDIR_OCI_1.path().to_str().unwrap()), true))] #[tokio::test] async fn test_from_addr(#[case] uri_str: &str, #[case] exp_succeed: bool) { let blob_service: Arc = Arc::from(MemoryBlobService::default()); -- cgit 1.4.1