Skip to content

Commit

Permalink
refactor: rename binary
Browse files Browse the repository at this point in the history
Closes pjd#48
  • Loading branch information
saidsay-so committed Jul 10, 2022
1 parent d422992 commit 87b7086
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
21 changes: 9 additions & 12 deletions book/src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cargo run

```bash
cd rust
cargo build && sudo ./target/debug/pjdfs_runner
cargo build && sudo ./target/debug/pjdfstest
```

## Architecture
Expand Down Expand Up @@ -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);
}
```

Expand Down
11 changes: 6 additions & 5 deletions book/src/test-declaration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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")]
Expand Down
2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ name = "pjdfs_tests"
path = "src/lib.rs"

[[bin]]
name = "pjdfs_runner"
name = "pjdfstest"
path = "src/main.rs"

0 comments on commit 87b7086

Please sign in to comment.