Skip to content

Commit 4cf7248

Browse files
authored
Fix warnings in tests and make them errors (fishinabarrel#56)
1 parent 5f2be73 commit 4cf7248

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

tests/run_tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def main():
3232
environ=dict(
3333
os.environ,
3434
RUST_TARGET_PATH=os.path.join(BASE_DIR, os.path.pardir),
35+
RUSTFLAGS="-Dwarnings",
3536
CARGO_TARGET_DIR=os.path.relpath(
3637
os.path.join(BASE_DIR, "target"),
3738
os.path.join(BASE_DIR, path)
@@ -57,9 +58,10 @@ def main():
5758
run(
5859
"rustc",
5960
"--test",
61+
"-Dwarnings",
6062
"--out-dir", os.path.join(BASE_DIR, path),
6163
os.path.join(BASE_DIR, path, "tests.rs"),
62-
"--extern", "kernel_module_tests=libtestlib.rlib"
64+
"--extern", "kernel_module_tests=libtestlib.rlib",
6365
)
6466
# TODO: qemu
6567
run(

tests/sysctl/src/lib.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,25 @@ use linux_kernel_module::sysctl::Sysctl;
99
use linux_kernel_module::Mode;
1010

1111
struct SysctlTestModule {
12-
sysctl_a: Sysctl<AtomicBool>,
13-
sysctl_b: Sysctl<AtomicBool>,
12+
_sysctl_a: Sysctl<AtomicBool>,
13+
_sysctl_b: Sysctl<AtomicBool>,
1414
}
1515

1616
impl linux_kernel_module::KernelModule for SysctlTestModule {
1717
fn init() -> linux_kernel_module::KernelResult<Self> {
1818
Ok(SysctlTestModule {
19-
sysctl_a: Sysctl::register("rust/sysctl-tests\x00", "a\x00", AtomicBool::new(false), Mode::from_int(0o666))?,
20-
sysctl_b: Sysctl::register("rust/sysctl-tests\x00", "b\x00", AtomicBool::new(false), Mode::from_int(0o666))?,
19+
_sysctl_a: Sysctl::register(
20+
"rust/sysctl-tests\x00",
21+
"a\x00",
22+
AtomicBool::new(false),
23+
Mode::from_int(0o666),
24+
)?,
25+
_sysctl_b: Sysctl::register(
26+
"rust/sysctl-tests\x00",
27+
"b\x00",
28+
AtomicBool::new(false),
29+
Mode::from_int(0o666),
30+
)?,
2131
})
2232
}
2333
}

0 commit comments

Comments
 (0)