Skip to content
This repository was archived by the owner on Mar 7, 2021. It is now read-only.

Commit 7986d77

Browse files
committed
added a test verifying that the sysctl disappears when the module is unloaded
1 parent 4cf7248 commit 7986d77

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/sysctl/tests.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
extern crate kernel_module_tests;
22

33
use std::fs;
4+
use std::path::Path;
45

56
use kernel_module_tests::with_kernel_module;
67

@@ -24,3 +25,11 @@ fn test_write_bool() {
2425
);
2526
});
2627
}
28+
29+
#[test]
30+
fn test_file_doesnt_exit_after_module_unloaded() {
31+
with_kernel_module(|| {
32+
assert!(Path::new("/proc/sys/rust/sysctl-tests/a").exists());
33+
});
34+
assert!(!Path::new("/proc/sys/rust/sysctl-tests/a").exists());
35+
}

0 commit comments

Comments
 (0)