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

Commit 840aa70

Browse files
alexreaperhulk
authored andcommitted
Rename tests (#97)
1 parent 519e6aa commit 840aa70

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

tests/chrdev/Cargo.toml renamed to tests/chrdev-region-allocation/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "chrdev-tests"
2+
name = "chrdev-region-allocation-tests"
33
version = "0.1.0"
44
authors = ["Alex Gaynor <[email protected]>", "Geoffrey Thomas <[email protected]>"]
55
edition = "2018"

tests/chrdev/src/lib.rs renamed to tests/chrdev-region-allocation/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33

44
use linux_kernel_module;
55

6-
struct ChrdevTestModule {
6+
struct ChrdevRegionAllocationTestModule {
77
_dev: linux_kernel_module::chrdev::DeviceNumberRegion,
88
}
99

10-
impl linux_kernel_module::KernelModule for ChrdevTestModule {
10+
impl linux_kernel_module::KernelModule for ChrdevRegionAllocationTestModule {
1111
fn init() -> linux_kernel_module::KernelResult<Self> {
12-
Ok(ChrdevTestModule {
12+
Ok(ChrdevRegionAllocationTestModule {
1313
_dev: linux_kernel_module::chrdev::DeviceNumberRegion::allocate(
1414
0..1,
15-
"chrdev-tests\x00",
15+
"chrdev-region-allocation-tests\x00",
1616
)?,
1717
})
1818
}
1919
}
2020

2121
linux_kernel_module::kernel_module!(
22-
ChrdevTestModule,
22+
ChrdevRegionAllocationTestModule,
2323
author: "Alex Gaynor and Geoffrey Thomas",
24-
description: "A module for testing character devices",
24+
description: "A module for testing character device region allocation",
2525
license: "GPL"
2626
);

tests/chrdev/tests.rs renamed to tests/chrdev-region-allocation/tests.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ fn test_proc_devices() {
77
let devices = fs::read_to_string("/proc/devices").unwrap();
88
let dev_no_line = devices
99
.lines()
10-
.find(|l| l.ends_with("chrdev-tests"))
10+
.find(|l| l.ends_with("chrdev-region-allocation-tests"))
1111
.unwrap();
1212
let elements = dev_no_line.rsplitn(2, " ").collect::<Vec<_>>();
1313
assert_eq!(elements.len(), 2);
14-
assert_eq!(elements[0], "chrdev-tests");
14+
assert_eq!(elements[0], "chrdev-region-allocation-tests");
1515
assert!(elements[1].trim().parse::<u32>().is_ok());
1616
});
1717

1818
let devices = fs::read_to_string("/proc/devices").unwrap();
1919
assert!(
2020
devices
2121
.lines()
22-
.find(|l| l.ends_with("chrdev-tests"))
22+
.find(|l| l.ends_with("chrdev-region-allocation-tests"))
2323
.is_none()
2424
);
2525
}

tests/run_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def main():
4343
module = os.path.join(
4444
BASE_DIR,
4545
"target/x86_64-linux-kernel-module/debug/lib{}_tests.a".format(
46-
path
46+
path.replace("-", "_")
4747
)
4848
)
4949
run(

0 commit comments

Comments
 (0)