diff --git a/.github/workflows/static-checks.yaml b/.github/workflows/static-checks.yaml index 8278066d9509..f433407dbc93 100644 --- a/.github/workflows/static-checks.yaml +++ b/.github/workflows/static-checks.yaml @@ -86,7 +86,6 @@ jobs: sudo chown -R $USER:$USER $GITHUB_WORKSPACE $HOME sudo rm -f /tmp/kata_hybrid* # Sometime we got leftover from test_setup_hvsock_failed() if: ${{ matrix.instance != 'ubuntu-20.04' }} - - name: Checkout the code uses: actions/checkout@v4 with: @@ -130,6 +129,7 @@ jobs: XDG_RUNTIME_DIR=$(mktemp -d /tmp/kata-tests-$USER.XXX | tee >(xargs chmod 0700)) echo "XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}" >> $GITHUB_ENV - name: Running `${{ matrix.command }}` for ${{ matrix.component }} + if: ${{ !( matrix.instance == 'ppc64le' && matrix.command == 'make sudo -E PATH=\"$PATH\" make test' && matrix.component == 'agent' ) != 'false' }} run: | cd ${{ matrix.component-path }} ${{ matrix.command }} diff --git a/src/agent/rustjail/src/cgroups/fs/mod.rs b/src/agent/rustjail/src/cgroups/fs/mod.rs index e00650494cb4..dce621e18624 100644 --- a/src/agent/rustjail/src/cgroups/fs/mod.rs +++ b/src/agent/rustjail/src/cgroups/fs/mod.rs @@ -1400,6 +1400,20 @@ mod tests { fn test_new_fs_manager() { skip_if_not_root!(); + let output = Command::new("stat") + .arg("-f") + .arg("-c") + .arg("%T") + .arg("/sys/fs/cgroup/") + .output() + .unwrap(); + let output_str = String::from_utf8(output.stdout).unwrap(); + let cgroup_version = output_str.strip_suffix("\n").unwrap(); + if cgroup_version.eq("cgroup2fs") { + println!("INFO: Skipping the test as cgroups v2 is used by default"); + return; + } + struct TestCase { cpath: Vec, devices: Vec>, diff --git a/src/agent/src/random.rs b/src/agent/src/random.rs index f97f0f0334b4..6e1e87c3d447 100644 --- a/src/agent/src/random.rs +++ b/src/agent/src/random.rs @@ -12,7 +12,13 @@ use std::os::unix::io::{AsRawFd, FromRawFd}; use tracing::instrument; pub const RNGDEV: &str = "/dev/random"; +#[cfg(target_arch = "powerpc64")] +pub const RNDADDTOENTCNT: libc::c_uint = 0x80045201; +#[cfg(target_arch = "powerpc64")] +pub const RNDRESEEDCRNG: libc::c_int = 0x20005207; +#[cfg(not(target_arch = "powerpc64"))] pub const RNDADDTOENTCNT: libc::c_int = 0x40045201; +#[cfg(not(target_arch = "powerpc64"))] pub const RNDRESEEDCRNG: libc::c_int = 0x5207; // Handle the differing ioctl(2) request types for different targets diff --git a/src/agent/src/rpc.rs b/src/agent/src/rpc.rs index 57690cdfb4bb..2ce66ecbc61d 100644 --- a/src/agent/src/rpc.rs +++ b/src/agent/src/rpc.rs @@ -1963,6 +1963,7 @@ fn load_kernel_module(module: &protocols::agent::KernelModule) -> Result<()> { } #[cfg(test)] +#[allow(dead_code)] mod tests { use std::time::{SystemTime, UNIX_EPOCH}; @@ -2154,6 +2155,7 @@ mod tests { } #[tokio::test] + #[cfg(not(target_arch = "powerpc64"))] async fn test_do_write_stream() { skip_if_not_root!(); @@ -2694,8 +2696,16 @@ OtherField:other fs::write(mount_dir.path().join("file.dat"), "foobar").unwrap(); stats = get_volume_capacity_stats(mount_dir.path().to_str().unwrap()).unwrap(); - assert_eq!(stats.used, 4 * 1024); - assert_eq!(stats.available, available - 4 * 1024); + let size = get_block_size(mount_dir.path().to_str().unwrap()).unwrap(); + + assert_eq!(stats.used, size); + assert_eq!(stats.available, available - size); + } + + fn get_block_size(path: &str) -> Result { + let stat = statfs::statfs(path)?; + let block_size = stat.block_size() as u64; + Ok(block_size) } #[tokio::test] diff --git a/src/agent/src/sandbox.rs b/src/agent/src/sandbox.rs index 8137939c8e9f..30f168f2c87c 100644 --- a/src/agent/src/sandbox.rs +++ b/src/agent/src/sandbox.rs @@ -655,6 +655,8 @@ fn onlined_cpus() -> Result { } #[cfg(test)] +#[allow(dead_code)] +#[allow(unused_imports)] mod tests { use super::*; use crate::mount::baremount; @@ -924,6 +926,7 @@ mod tests { #[tokio::test] #[serial] + #[cfg(not(target_arch = "powerpc64"))] async fn add_and_get_container() { skip_if_not_root!(); @@ -989,6 +992,7 @@ mod tests { } #[tokio::test] + #[cfg(not(target_arch = "powerpc64"))] async fn test_find_container_process() { skip_if_not_root!(); @@ -1036,6 +1040,7 @@ mod tests { } #[tokio::test] + #[cfg(not(target_arch = "powerpc64"))] async fn test_find_process() { skip_if_not_root!();