-
Notifications
You must be signed in to change notification settings - Fork 120
Come up with a strategy for writing automated tests #34
Comments
Rust RFC 2318 is about experimental custom test frameworks. It was approved about a month ago and the tracking issue rust-lang/rust#50297 unsurprisingly doesn't show that anyone's started implementing it. I wonder if it's worth us trying to implement it. We could just do something ourselves with using the kernel's own kallsyms API to find test functions and run them. (The other thing I want here is tests against multiple different kernels and styles of kernel packaging, which is completely unrelated) |
Ok, here's my vision for how I'd like to be able to write tests. First -- the type of tests I'm primarily interested in are testing, from userspace, the observable properties of the kernel module. So for a sysctl, this would be reading/writing To that end, here's what I think a reasonable, and pracitcal, developer experience would be. A
This defines two "test suites", Execution would be In terms of implementation, for each test suite:
Obviously we can play with the details on which exact One important thing to flag is we need to figure out how to get the compiled An initial implementation could probably just be a shell script that loops over each test suite and compiles them and runs #[test]
fn test_sysctl_bool_read() {
with_kernel_module(|| {
let data = fs::read_to_string("/proc/sys/rust/test/bool1");
assert_eq!(data, b"0");
});
} WDYT? |
I just thought of an optimization that'll get us to an MVP on testing faster: don't use QEMU this will run on the host. This will obviously work fine on travis, and ATM I think we're both doing development in VMs, so it'll be usable (if not outstanding) for us as well. Once we have working tests we can iterate for better isolation from there. I'll take a swing at this once the sysctl patch is landed so I have something to test... or maybe I'll get impatient and start hacking on |
No description provided.
The text was updated successfully, but these errors were encountered: