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

Fix warnings in tests and make them errors #56

Merged
merged 2 commits into from
Jun 23, 2018
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
4 changes: 3 additions & 1 deletion tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def main():
environ=dict(
os.environ,
RUST_TARGET_PATH=os.path.join(BASE_DIR, os.path.pardir),
RUSTFLAGS="-Dwarnings",
CARGO_TARGET_DIR=os.path.relpath(
os.path.join(BASE_DIR, "target"),
os.path.join(BASE_DIR, path)
Expand All @@ -57,9 +58,10 @@ def main():
run(
"rustc",
"--test",
"-Dwarnings",
"--out-dir", os.path.join(BASE_DIR, path),
os.path.join(BASE_DIR, path, "tests.rs"),
"--extern", "kernel_module_tests=libtestlib.rlib"
"--extern", "kernel_module_tests=libtestlib.rlib",
)
# TODO: qemu
run(
Expand Down
18 changes: 14 additions & 4 deletions tests/sysctl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,25 @@ use linux_kernel_module::sysctl::Sysctl;
use linux_kernel_module::Mode;

struct SysctlTestModule {
sysctl_a: Sysctl<AtomicBool>,
sysctl_b: Sysctl<AtomicBool>,
_sysctl_a: Sysctl<AtomicBool>,
_sysctl_b: Sysctl<AtomicBool>,
}

impl linux_kernel_module::KernelModule for SysctlTestModule {
fn init() -> linux_kernel_module::KernelResult<Self> {
Ok(SysctlTestModule {
sysctl_a: Sysctl::register("rust/sysctl-tests\x00", "a\x00", AtomicBool::new(false), Mode::from_int(0o666))?,
sysctl_b: Sysctl::register("rust/sysctl-tests\x00", "b\x00", AtomicBool::new(false), Mode::from_int(0o666))?,
_sysctl_a: Sysctl::register(
"rust/sysctl-tests\x00",
"a\x00",
AtomicBool::new(false),
Mode::from_int(0o666),
)?,
_sysctl_b: Sysctl::register(
"rust/sysctl-tests\x00",
"b\x00",
AtomicBool::new(false),
Mode::from_int(0o666),
)?,
})
}
}
Expand Down