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
25 changes: 13 additions & 12 deletions .github/workflows/selftest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@ on:
jobs:
run_tests:
name: Tests
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout device-mapper-tests
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: cargo cryptsetup xfs xfsprogs
version: 1.0
packages: cryptsetup xfs xfsprogs
version: "1.0"

- name: Check cryptsetup enabled
run: cryptsetup benchmark -c aes-xts-plain64 -s 512

- name: Checkout device-mapper-tests
uses: actions/checkout@v4
with:
repository: akiradeveloper/device-mapper-tests
ref: bump
path: tests

- name: Test
working-directory: tests/device-mapper-tests
run: sudo make test
working-directory: device-mapper-tests
env:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: sudo
run: make test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- device-mapper-tests: The test framework. **Please make sure all tests for the framework completes in success.**
- writeboost-tests: Tests for [dm-writeboost](https://github.com/akiradeveloper/dm-writeboost). You need to `modprobe dm-writeboost`.
- wb-command-tests: Tests for [dm-writeboost-tools](https://github.com/akiradeveloper/dm-writeboost-tools). You need to `modprobe dm-writeboost` and `cargo install` the dm-writeboost-tools.
- wb-command-tests: Tests for `writeboost-cli` from [dm-writeboost-tools](https://github.com/akiradeveloper/dm-writeboost-tools). You need to `modprobe dm-writeboost` and run `cargo install --path writeboost-cli` from the dm-writeboost-tools checkout. Ensure `writeboost-cli` is on `PATH` when running the tests.

## Requirements for the framework

Expand Down
2 changes: 1 addition & 1 deletion device-mapper-tests/src/scenario/many_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl ManyFiles {
let n = self.n;
for i in 0..n {
run_cmd!(touch $root/$i).unwrap();
run_cmd!(echo $i > $root/$i).unwrap();
std::fs::write(format!("{}/{}", root, i), format!("{}\n", i)).unwrap();
}
kernel::drop_caches();
for i in 0..n {
Expand Down
56 changes: 28 additions & 28 deletions wb-command-tests/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use device_mapper_tests::*;

use cmd_lib::{run_cmd, run_fun};
use cmd_lib::run_cmd;

#[test]
fn test_wbcreate() {
fn test_create() {
let mut env = env();
let fast = env.alloc_device(Sector::MB(100));
let p1 = fast.path();
let slow = env.alloc_device(Sector::MB(50));
let p2 = slow.path();
run_cmd!(wbcreate wbdev $p1 $p2 --reformat --read_cache_threshold=4 --writeback_threshold=70 --nr_max_batched_writeback=32 --update_sb_record_interval=3600 --sync_data_interval=3600 --write_around_mode).unwrap();
run_cmd!(wbremove wbdev).unwrap();
run_cmd!(writeboost-cli create wbdev $p1 $p2 --reformat --read_cache_threshold=4 --writeback_threshold=70 --nr_max_batched_writeback=32 --update_sb_record_interval=3600 --sync_data_interval=3600 --write_around_mode).unwrap();
run_cmd!(writeboost-cli remove wbdev).unwrap();
}

#[test]
Expand All @@ -20,82 +20,82 @@ fn test_recreate() {
let p1 = fast.path();
let slow = env.alloc_device(Sector::MB(50));
let p2 = slow.path();
run_cmd!(wbcreate wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(wbremove wbdev).unwrap();
run_cmd!(writeboost-cli create wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(writeboost-cli remove wbdev).unwrap();

run_cmd!(wbcreate wbdev $p1 $p2).unwrap();
run_cmd!(writeboost-cli create wbdev $p1 $p2).unwrap();
run_cmd!(dd if=/dev/zero of=/dev/mapper/wbdev oflag=direct bs=1M count=50).unwrap();
run_cmd!(wbremove wbdev).unwrap();
run_cmd!(writeboost-cli remove wbdev).unwrap();
}

#[test]
fn test_wbremove() {
fn test_remove() {
let mut env = env();
let fast = env.alloc_device(Sector::MB(100));
let p1 = fast.path();
let slow = env.alloc_device(Sector::MB(50));
let p2 = slow.path();
run_cmd!(wbcreate wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(wbremove wbdev --noflush --nowriteback).unwrap();
run_cmd!(writeboost-cli create wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(writeboost-cli remove wbdev --noflush --nowriteback).unwrap();
}

#[test]
fn test_wbcheck() {
fn test_check() {
let mut env = env();
let fast = env.alloc_device(Sector::MB(100));
let p1 = fast.path();
let slow = env.alloc_device(Sector::MB(50));
let p2 = slow.path();
run_cmd!(wbcreate wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(writeboost-cli create wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(dd if=/dev/zero of=/dev/mapper/wbdev oflag=direct bs=1M count=50).unwrap();

run_cmd!(wbcheck $p2 1);
run_cmd!(writeboost-cli check $p2 --segid=1).unwrap();

run_cmd!(wbremove wbdev --nowriteback);
run_cmd!(writeboost-cli remove wbdev --nowriteback).unwrap();
}

#[test]
fn test_wbdump() {
fn test_dump() {
let mut env = env();
let fast = env.alloc_device(Sector::MB(100));
let p1 = fast.path();
let slow = env.alloc_device(Sector::MB(50));
let p2 = slow.path();
run_cmd!(wbcreate wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(writeboost-cli create wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(dd if=/dev/zero of=/dev/mapper/wbdev oflag=direct bs=1M count=50).unwrap();

run_cmd!(wbdump $p2 1).unwrap();
run_cmd!(writeboost-cli dump $p2 1).unwrap();

run_cmd!(wbremove wbdev).unwrap();
run_cmd!(writeboost-cli remove wbdev).unwrap();
}

#[test]
fn test_wbmeta() {
fn test_meta() {
let mut env = env();
let fast = env.alloc_device(Sector::MB(100));
let p1 = fast.path();
let slow = env.alloc_device(Sector::MB(50));
let p2 = slow.path();
run_cmd!(wbcreate wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(writeboost-cli create wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(dd if=/dev/zero of=/dev/mapper/wbdev oflag=direct bs=1M count=50).unwrap();

run_cmd!(wbmeta $p2 0).unwrap();
run_cmd!(wbmeta $p2 1).unwrap();
run_cmd!(writeboost-cli meta $p2 0).unwrap();
run_cmd!(writeboost-cli meta $p2 1).unwrap();

run_cmd!(wbremove wbdev).unwrap();
run_cmd!(writeboost-cli remove wbdev).unwrap();
}

#[test]
fn test_wbstatus() {
fn test_status() {
let mut env = env();
let fast = env.alloc_device(Sector::MB(100));
let p1 = fast.path();
let slow = env.alloc_device(Sector::MB(50));
let p2 = slow.path();
run_cmd!(wbcreate wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(writeboost-cli create wbdev $p1 $p2 --reformat).unwrap();
run_cmd!(dd if=/dev/zero of=/dev/mapper/wbdev oflag=direct bs=1M count=50).unwrap();

run_cmd!(dmsetup status wbdev | wbstatus).unwrap();
run_cmd!(dmsetup status wbdev | writeboost-cli status).unwrap();

run_cmd!(wbremove wbdev --nowriteback).unwrap();
run_cmd!(writeboost-cli remove wbdev --nowriteback).unwrap();
}
Loading