From 7b7384ebaf0d47a2713fe66f1cf9819343958f33 Mon Sep 17 00:00:00 2001 From: Adam Dunlap Date: Fri, 3 Nov 2023 12:51:45 -0700 Subject: [PATCH] test: Disable some tests inside stage2 These tests can't be run inside the svsm kernel and they can't be run inside stage2 either. Signed-off-by: Adam Dunlap --- src/fs/filesystem.rs | 12 ++++++------ src/fs/ramfs.rs | 2 +- src/mm/alloc.rs | 18 +++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/fs/filesystem.rs b/src/fs/filesystem.rs index 69398f181..321c1bb36 100644 --- a/src/fs/filesystem.rs +++ b/src/fs/filesystem.rs @@ -485,7 +485,7 @@ mod tests { use crate::mm::alloc::{TestRootMem, DEFAULT_TEST_MEMORY_SIZE}; #[test] - #[cfg_attr(test_in_svsm, ignore = "FIXME")] + #[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] fn create_dir() { let _test_mem = TestRootMem::setup(DEFAULT_TEST_MEMORY_SIZE); initialize_fs(); @@ -510,7 +510,7 @@ mod tests { } #[test] - #[cfg_attr(test_in_svsm, ignore = "FIXME")] + #[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] fn create_and_unlink_file() { let _test_mem = TestRootMem::setup(DEFAULT_TEST_MEMORY_SIZE); initialize_fs(); @@ -541,7 +541,7 @@ mod tests { } #[test] - #[cfg_attr(test_in_svsm, ignore = "FIXME")] + #[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] fn create_sub_dir() { let _test_mem = TestRootMem::setup(DEFAULT_TEST_MEMORY_SIZE); initialize_fs(); @@ -570,7 +570,7 @@ mod tests { } #[test] - #[cfg_attr(test_in_svsm, ignore = "FIXME")] + #[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] fn test_unlink() { let _test_mem = TestRootMem::setup(DEFAULT_TEST_MEMORY_SIZE); initialize_fs(); @@ -600,7 +600,7 @@ mod tests { } #[test] - #[cfg_attr(test_in_svsm, ignore = "FIXME")] + #[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] fn test_open_read_write_seek() { let _test_mem = TestRootMem::setup(DEFAULT_TEST_MEMORY_SIZE); initialize_fs(); @@ -652,7 +652,7 @@ mod tests { } #[test] - #[cfg_attr(test_in_svsm, ignore = "FIXME")] + #[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] fn test_multiple_file_handles() { let _test_mem = TestRootMem::setup(DEFAULT_TEST_MEMORY_SIZE); initialize_fs(); diff --git a/src/fs/ramfs.rs b/src/fs/ramfs.rs index fe3d29ec6..4555ca173 100644 --- a/src/fs/ramfs.rs +++ b/src/fs/ramfs.rs @@ -387,7 +387,7 @@ mod tests { use crate::mm::alloc::{TestRootMem, DEFAULT_TEST_MEMORY_SIZE}; #[test] - #[cfg_attr(test_in_svsm, ignore = "FIXME")] + #[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] fn test_ramfs_file_read_write() { let _test_mem = TestRootMem::setup(DEFAULT_TEST_MEMORY_SIZE); diff --git a/src/mm/alloc.rs b/src/mm/alloc.rs index 1d36ef8e9..5d5dae826 100644 --- a/src/mm/alloc.rs +++ b/src/mm/alloc.rs @@ -1313,14 +1313,14 @@ impl Drop for TestRootMem<'_> { } #[test] -#[cfg_attr(test_in_svsm, ignore = "FIXME")] +#[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] fn test_root_mem_setup() { let test_mem_lock = TestRootMem::setup(DEFAULT_TEST_MEMORY_SIZE); drop(test_mem_lock); } #[test] -#[cfg_attr(test_in_svsm, ignore = "FIXME")] +#[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] // Allocate one page and free it again, verify that memory_info() reflects it. fn test_page_alloc_one() { let _test_mem = TestRootMem::setup(DEFAULT_TEST_MEMORY_SIZE); @@ -1335,7 +1335,7 @@ fn test_page_alloc_one() { } #[test] -#[cfg_attr(test_in_svsm, ignore = "FIXME")] +#[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] // Allocate and free all available compound pages, verify that memory_info() // reflects it. fn test_page_alloc_all_compound() { @@ -1368,7 +1368,7 @@ fn test_page_alloc_all_compound() { } #[test] -#[cfg_attr(test_in_svsm, ignore = "FIXME")] +#[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] // Allocate and free all available 4k pages, verify that memory_info() // reflects it. fn test_page_alloc_all_single() { @@ -1401,7 +1401,7 @@ fn test_page_alloc_all_single() { } #[test] -#[cfg_attr(test_in_svsm, ignore = "FIXME")] +#[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] // Allocate and free all available compound pages, verify that any subsequent // allocation fails. fn test_page_alloc_oom() { @@ -1439,7 +1439,7 @@ fn test_page_alloc_oom() { } #[test] -#[cfg_attr(test_in_svsm, ignore = "FIXME")] +#[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] fn test_page_file() { let _mem_lock = TestRootMem::setup(DEFAULT_TEST_MEMORY_SIZE); let mut root_mem = ROOT_MEM.lock(); @@ -1474,7 +1474,7 @@ fn test_page_file() { const TEST_SLAB_SIZES: [usize; 7] = [32, 64, 128, 256, 512, 1024, 2048]; #[test] -#[cfg_attr(test_in_svsm, ignore = "FIXME")] +#[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] // Allocate and free a couple of objects for each slab size. fn test_slab_alloc_free_many() { extern crate alloc; @@ -1514,7 +1514,7 @@ fn test_slab_alloc_free_many() { } #[test] -#[cfg_attr(test_in_svsm, ignore = "FIXME")] +#[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] // Allocate enough objects so that the SlabPageSlab will need a SlabPage for // itself twice. fn test_slab_page_slab_for_self() { @@ -1551,7 +1551,7 @@ fn test_slab_page_slab_for_self() { } #[test] -#[cfg_attr(test_in_svsm, ignore = "FIXME")] +#[cfg_attr(any(test_in_svsm, test_in_stage2), ignore = "FIXME")] // Allocate enough objects to hit an OOM situation and verify null gets // returned at some point. fn test_slab_oom() {