Skip to content

Commit

Permalink
fix debug message and add check read access
Browse files Browse the repository at this point in the history
Signed-off-by: sat0ken <[email protected]>
  • Loading branch information
sat0ken committed Nov 12, 2024
1 parent da0ccbb commit c3c62fb
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tests/contest/runtimetest/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::fs::{self, read_dir};
use std::os::linux::fs::MetadataExt;
use std::os::unix::fs::{FileTypeExt, PermissionsExt};
use std::path::Path;

use anyhow::{bail, Result};
use nix::errno::Errno;
use nix::libc;
Expand All @@ -11,7 +10,7 @@ use nix::unistd::getcwd;
use oci_spec::runtime::IOPriorityClass::{self, IoprioClassBe, IoprioClassIdle, IoprioClassRt};
use oci_spec::runtime::{LinuxDevice, LinuxDeviceType, LinuxSchedulerPolicy, Spec};

use crate::utils::{self, test_dir_write_access, test_read_access, test_write_access};
use crate::utils::{self, test_dir_read_access, test_dir_write_access, test_read_access, test_write_access};

////////// ANCHOR: example_hello_world
pub fn hello_world(_spec: &Spec) {
Expand Down Expand Up @@ -554,13 +553,21 @@ pub fn test_validate_root_readonly(spec: &Spec) {
if errno == Errno::EROFS {
/* This is expected */
} else {
eprintln!("readonly root filesystem, error in testing write access for path /");
eprintln!("readonly root filesystem, error in testing write access for path /, {}", errno);
}
}
if let Err(e) = test_dir_read_access("/") {
let errno = Errno::from_raw(e.raw_os_error().unwrap());
if errno == Errno::EROFS {
/* This is expected */
} else {
eprintln!("readonly root filesystem, error in testing read access for path /, {}", errno);
}
}
} else if let Err(e) = test_dir_write_access("/") {
let errno = Errno::from_raw(e.raw_os_error().unwrap());
if errno == Errno::EROFS {
eprintln!("readt only root filesystem is false but write access for path / is err");
if e.raw_os_error().is_some() {
let errno = Errno::from_raw(e.raw_os_error().unwrap());
eprintln!("readt only root filesystem is false but write access for path / is err, {}", errno);
} else {
/* This is expected */
}
Expand Down

0 comments on commit c3c62fb

Please sign in to comment.