From 87b708649d071ca395cf6de04a565efad685d189 Mon Sep 17 00:00:00 2001 From: musikid Date: Sun, 10 Jul 2022 11:01:58 +0200 Subject: [PATCH] refactor: rename binary Closes #48 --- book/src/introduction.md | 21 +++++++++------------ book/src/test-declaration.md | 11 ++++++----- rust/Cargo.toml | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/book/src/introduction.md b/book/src/introduction.md index db0e474b..b698bb74 100644 --- a/book/src/introduction.md +++ b/book/src/introduction.md @@ -18,7 +18,7 @@ cargo run ```bash cd rust -cargo build && sudo ./target/debug/pjdfs_runner +cargo build && sudo ./target/debug/pjdfstest ``` ## Architecture @@ -97,20 +97,17 @@ Each must be registered with the `test_case!` macro. For now, the test function takes a `&mut TestContext` parameter. ```rust,ignore -// chmod/00.t:L58 -crate::test_case!{ctime, Syscall::Chmod} -fn ctime(ctx: &mut TestContext) { - for f_type in FileType::iter().filter(|ft| *ft != FileType::Symlink(None)) { - let path = ctx.create(f_type).unwrap(); - let ctime_before = stat(&path).unwrap().st_ctime; +crate::test_case! {ctime => [FileType::Regular, FileType::Fifo, FileType::Block, FileType::Char, FileType::Socket]} +fn ctime(ctx: &mut TestContext, f_type: FileType) { + let path = ctx.create(f_type).unwrap(); + let ctime_before = stat(&path).unwrap().st_ctime; - sleep(Duration::from_secs(1)); + sleep(Duration::from_secs(1)); - chmod(&path, Mode::from_bits_truncate(0o111)).unwrap(); + chmod(&path, Mode::from_bits_truncate(0o111)).unwrap(); - let ctime_after = stat(&path).unwrap().st_ctime; - assert!(ctime_after > ctime_before); - } + let ctime_after = stat(&path).unwrap().st_ctime; + assert!(ctime_after > ctime_before); } ``` diff --git a/book/src/test-declaration.md b/book/src/test-declaration.md index 21ecfc92..aa6f864d 100644 --- a/book/src/test-declaration.md +++ b/book/src/test-declaration.md @@ -34,9 +34,10 @@ to modify the execution of the tests or add requirements. Some features are not available for every file system. For tests requiring such features, the execution becomes opt-in. -When a test need such feature, a variant of `FileSystemFeature` corresponding to this feature should be specified, -by adding it after eventual `root` requirement and before the file types. -Multiple features can be specified, with a comma `,` separator. +When a test needs such feature, +a variant of `FileSystemFeature` corresponding to this feature should be specified +after potential `root` requirement and before file flags. +Multiple features can be specified, each separated by a comma `,` separator. For example: @@ -48,11 +49,11 @@ crate::test_case! {eperm_immutable_flag, FileSystemFeature::Chflags, FileSystemF #### File flags **NOTE: This feature is not supported by all POSIX systems, -therefore its use needs a `#[cfg(target_os = ...)]` attribute specifying supported system(s).** +therefore its use needs a `#[cfg(target_os = ...)]` attribute specifying the relevant system(s).** It is possible to specify individual file flags for the tests which require it. They can be specified by appending `FileFlags` variants after a `;` separator, -after (eventual) `root` and features. +after potential `root` requirement and features. ```rust,ignore #[cfg(target_os = "freebsd")] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index ba8cfaa9..4ae3e938 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -26,5 +26,5 @@ name = "pjdfs_tests" path = "src/lib.rs" [[bin]] -name = "pjdfs_runner" +name = "pjdfstest" path = "src/main.rs"