Skip to content

Commit

Permalink
Resolve compile errors in tests on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: J Robert Ray <[email protected]>
  • Loading branch information
jrray committed Dec 3, 2024
1 parent e7e3dea commit 1f8b18b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/spfs/src/bootstrap_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ async fn test_shell_initialization_startup_scripts(
std::env::set_var("SHELL", &shell_path);

match crate::Shell::find_best(None).unwrap() {
#[cfg(unix)]
crate::Shell::Bash(_) if shell == "tcsh" => {
// Test will fail because we weren't able to
// find the shell we are trying to test
return;
}
#[cfg(unix)]
crate::Shell::Tcsh(_) if shell == "bash" => {
// Test will fail because we weren't able to
// find the shell we are trying to test
Expand Down
2 changes: 2 additions & 0 deletions crates/spfs/src/runtime/storage_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
// https://github.com/spkenv/spk

#[cfg(unix)]
use std::os::unix::fs::PermissionsExt;

use futures::TryStreamExt;
Expand Down Expand Up @@ -583,6 +584,7 @@ async fn test_runtime_ensure_extra_bind_mount_locations_exist(tmpdir: tempfile::
assert!(runtime.prepare_live_layers().await.is_ok())
}

#[cfg(unix)]
#[rstest]
fn test_makedirs_dont_change_existing(tmpdir: tempfile::TempDir) {
let chkdir = tmpdir.path().join("my_dir");
Expand Down
5 changes: 5 additions & 0 deletions crates/spfs/src/storage/repository_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@

use std::collections::HashSet;
use std::iter::FromIterator;
#[cfg(unix)]
use std::os::unix::fs::{MetadataExt, PermissionsExt};
#[cfg(unix)]
use std::sync::Arc;

use rstest::rstest;

use super::Ref;
use crate::encoding::prelude::*;
use crate::fixtures::*;
#[cfg(unix)]
use crate::storage::fs;
use crate::storage::prelude::*;
use crate::tracking::TagSpec;
Expand Down Expand Up @@ -58,6 +61,7 @@ async fn test_find_aliases(
assert_eq!(actual, expected);
}

#[cfg(unix)]
#[rstest]
#[tokio::test]
async fn test_commit_mode_fs(tmpdir: tempfile::TempDir) {
Expand Down Expand Up @@ -109,6 +113,7 @@ async fn test_commit_mode_fs(tmpdir: tempfile::TempDir) {
)
}

#[cfg(unix)]
#[rstest]
#[case::fs(tmprepo("fs"))]
#[case::tar(tmprepo("tar"))]
Expand Down
2 changes: 2 additions & 0 deletions crates/spfs/src/storage/tag_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
// https://github.com/spkenv/spk

#[cfg(unix)]
use std::os::unix::fs::MetadataExt;

use chrono::prelude::*;
Expand Down Expand Up @@ -107,6 +108,7 @@ async fn test_tag_no_duplication(
);
}

#[cfg(unix)]
#[rstest]
#[tokio::test]
async fn test_tag_permissions(tmpdir: tempfile::TempDir) {
Expand Down

0 comments on commit 1f8b18b

Please sign in to comment.