Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions usertest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2024"

[dependencies]
colored = "3"
inventory = "0.3"
libc = "0.2"
parking_lot = "0.12"
49 changes: 29 additions & 20 deletions usertest/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn test_opendir() {
}
}

register_test!(test_opendir, "Testing opendir syscall");
register_test!(test_opendir);

fn test_readdir() {
let path = CString::new("/").unwrap();
Expand All @@ -38,7 +38,7 @@ fn test_readdir() {
}
}

register_test!(test_readdir, "Testing readdir syscall");
register_test!(test_readdir);

fn test_chdir() {
let path = CString::new("/dev").unwrap();
Expand All @@ -61,7 +61,7 @@ fn test_chdir() {
}
}

register_test!(test_chdir, "Testing chdir syscall");
register_test!(test_chdir);

fn test_fchdir() {
let path = CString::new("/dev").unwrap();
Expand Down Expand Up @@ -89,7 +89,7 @@ fn test_fchdir() {
}
}

register_test!(test_fchdir, "Testing fchdir syscall");
register_test!(test_fchdir);

fn test_chroot() {
let file = "/bin/busybox";
Expand All @@ -107,7 +107,7 @@ fn test_chroot() {
}
}

register_test!(test_chroot, "Testing chroot syscall");
register_test!(test_chroot);

fn test_chmod() {
let dir_path = "/tmp/chmod_test";
Expand All @@ -131,7 +131,7 @@ fn test_chmod() {
fs::remove_dir(dir_path).expect("Failed to delete directory");
}

register_test!(test_chmod, "Testing chmod syscall");
register_test!(test_chmod);

fn test_fchmod() {
let dir_path = "/tmp/fchmod_test";
Expand Down Expand Up @@ -160,7 +160,7 @@ fn test_fchmod() {
fs::remove_dir(dir_path).expect("Failed to delete directory");
}

register_test!(test_fchmod, "Testing fchmod syscall");
register_test!(test_fchmod);

fn test_chown() {
let dir_path = "/tmp/chown_test";
Expand All @@ -184,7 +184,7 @@ fn test_chown() {
fs::remove_dir(dir_path).expect("Failed to delete directory");
}

register_test!(test_chown, "Testing chown syscall");
register_test!(test_chown);

fn test_fchown() {
let dir_path = "/tmp/fchown_test";
Expand Down Expand Up @@ -213,7 +213,7 @@ fn test_fchown() {
fs::remove_dir(dir_path).expect("Failed to delete directory");
}

register_test!(test_fchown, "Testing fchown syscall");
register_test!(test_fchown);

fn test_read() {
let file = "/dev/zero";
Expand All @@ -233,7 +233,7 @@ fn test_read() {
}
}

register_test!(test_read, "Testing read syscall");
register_test!(test_read);

fn test_write() {
let file = "/dev/null";
Expand All @@ -252,7 +252,7 @@ fn test_write() {
}
}

register_test!(test_write, "Testing write syscall");
register_test!(test_write);

fn test_link() {
let path = "/tmp/link_test";
Expand Down Expand Up @@ -289,7 +289,7 @@ fn test_link() {
fs::remove_file(link).expect("Failed to delete link");
}

register_test!(test_link, "Testing link syscall");
register_test!(test_link);

fn test_symlink() {
use std::fs::{self, File};
Expand Down Expand Up @@ -330,7 +330,7 @@ fn test_symlink() {
fs::remove_file(link).expect("Failed to delete link");
}

register_test!(test_symlink, "Testing symlink syscall");
register_test!(test_symlink);

fn test_rename() {
use std::fs::{self, File};
Expand Down Expand Up @@ -366,7 +366,7 @@ fn test_rename() {
fs::remove_file(new_path).expect("Failed to delete file");
}

register_test!(test_rename, "Testing rename syscall");
register_test!(test_rename);

fn test_truncate() {
use std::fs::{self, File};
Expand All @@ -392,7 +392,7 @@ fn test_truncate() {
fs::remove_file(path).expect("Failed to delete file");
}

register_test!(test_truncate, "Testing truncate syscall");
register_test!(test_truncate);

fn test_ftruncate() {
let file = "/tmp/ftruncate_test.txt";
Expand Down Expand Up @@ -423,7 +423,7 @@ fn test_ftruncate() {
fs::remove_file(file).expect("Failed to delete file");
}

register_test!(test_ftruncate, "Testing ftruncate syscall");
register_test!(test_ftruncate);

fn test_utimens() {
let file = "/tmp/utimens_test";
Expand Down Expand Up @@ -481,7 +481,7 @@ fn test_utimens() {
fs::remove_file(file).expect("Failed to delete file");
}

register_test!(test_utimens, "Testing utimens syscall");
register_test!(test_utimens);

fn test_statx() {
#[repr(C)]
Expand Down Expand Up @@ -568,7 +568,7 @@ fn test_statx() {
fs::remove_file(file).expect("Failed to delete file");
}

register_test!(test_statx, "Testing statx syscall");
register_test!(test_statx);

fn test_rust_file() {
use std::fs::{self, File};
Expand All @@ -587,10 +587,19 @@ fn test_rust_file() {
.expect("Failed to read from file");
assert_eq!(contents, "Hello, Rust!");
}
fs::hard_link(path, "/tmp/rust_fs_test_link.txt").expect("Failed to create hard link");
let metadata = fs::metadata(path).expect("Failed to get metadata");
assert_eq!(metadata.len(), 12);
fs::rename(
"/tmp/rust_fs_test_link.txt",
"/tmp/rust_fs_test_renamed.txt",
)
.expect("Failed to rename file");
fs::remove_file("/tmp/rust_fs_test_renamed.txt").expect("Failed to delete renamed file");
fs::remove_file(path).expect("Failed to delete file");
}

register_test!(test_rust_file, "Testing rust file operations");
register_test!(test_rust_file);

fn test_rust_dir() {
use std::fs;
Expand All @@ -602,4 +611,4 @@ fn test_rust_dir() {
fs::remove_dir(dir_path).expect("Failed to delete directory");
}

register_test!(test_rust_dir, "Testing rust directory operations");
register_test!(test_rust_dir);
4 changes: 2 additions & 2 deletions usertest/src/futex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn test_futex() {
}
}

register_test!(test_futex, "Testing futex");
register_test!(test_futex);

fn test_futex_bitset() {
// Wait on bit 1, Wake on bit 1
Expand Down Expand Up @@ -214,4 +214,4 @@ fn test_futex_bitset() {
}
}

register_test!(test_futex_bitset, "Testing futex bitset");
register_test!(test_futex_bitset);
Loading