Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
fix: procfs and hardlink test
Browse files Browse the repository at this point in the history
  • Loading branch information
llenotre committed Jun 12, 2024
1 parent 585c440 commit 3f98a90
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ debugfs -wf - disk <<EOF
mkdir /dev
mkdir /sbin
write target/$TARGET/release/init /sbin/init
write target/$TARGET/release/maestro-test /sbin/maestro-test
write target/$TARGET/release/maestro-test /maestro-test
EOF
2 changes: 1 addition & 1 deletion src/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::process::Command;

pub fn main() {
let status = Command::new("/sbin/maestro-test").status().unwrap();
let status = Command::new("/maestro-test").status().unwrap();
let cmd = if status.success() { -1 } else { -2 };
// Shutdown
unsafe {
Expand Down
6 changes: 3 additions & 3 deletions src/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ pub fn hardlinks() -> TestResult {
fs::remove_dir("/test_dir")?;

// Link to file
fs::hard_link("/test", "/good_link")?;
let inode0 = util::stat("/test")?.st_ino;
fs::hard_link("/maestro-test", "/good_link")?;
let inode0 = util::stat("/maestro-test")?.st_ino;
let inode1 = util::stat("/good_link")?.st_ino;
test_assert_eq!(inode0, inode1);
// Remove and check
fs::remove_file("/good_link")?;
util::stat("/test")?;
util::stat("/maestro-test")?;
let res = util::stat("/good_link");
test_assert!(matches!(res, Err(e) if e.kind() == io::ErrorKind::NotFound));

Expand Down
4 changes: 2 additions & 2 deletions src/procfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn mount() -> TestResult {
fs::create_dir_all("/proc")?;
let src = CString::new("procfs")?;
let target = CString::new("/proc")?;
let fstype = CString::new("tmpfs")?;
let fstype = CString::new("procfs")?;
util::mount(
src.as_c_str(),
target.as_c_str(),
Expand All @@ -33,7 +33,7 @@ pub fn cwd() -> TestResult {

pub fn exe() -> TestResult {
let exe = fs::read_link("/proc/self/exe")?;
test_assert_eq!(exe.as_os_str().as_bytes(), b"/test");
test_assert_eq!(exe.as_os_str().as_bytes(), b"/maestro-test");
Ok(())
}

Expand Down

0 comments on commit 3f98a90

Please sign in to comment.