Skip to content

Commit f10f452

Browse files
authored
Merge pull request #273 from sylvestre/mv-uutests
Move to use uutests
2 parents b95a5da + 3f22a93 commit f10f452

23 files changed

Lines changed: 171 additions & 4175 deletions

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: rust-linting
5+
name: Rust linting
6+
description: Run cargo fmt on files included in the commit.
7+
entry: cargo +stable fmt --
8+
pass_filenames: true
9+
types: [file, rust]
10+
language: system
11+
- id: rust-clippy
12+
name: Rust clippy
13+
description: Run cargo clippy on files included in the commit.
14+
entry: cargo +stable clippy --workspace --all-targets --all-features --
15+
pass_filenames: false
16+
types: [file, rust]
17+
language: system

Cargo.lock

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ libmount-sys = "0.1.1"
5656
linux-raw-sys = { version = "0.10.0", features = ["ioctl"] }
5757
md-5 = "0.10.6"
5858
nix = { version = "0.30", default-features = false }
59+
parse_datetime = "0.11.0"
5960
phf = "0.12.0"
6061
phf_codegen = "0.12.1"
6162
rand = { version = "0.9.0", features = ["small_rng"] }
@@ -71,21 +72,21 @@ textwrap = { version = "0.16.0", features = ["terminal_size"] }
7172
thiserror = "2.0"
7273
uucore = "0.1.0"
7374
uuid = { version = "1.16.0", features = ["rng-rand"] }
75+
uutests = "0.1.0"
7476
windows = { version = "0.61.1" }
7577
xattr = "1.3.1"
76-
parse_datetime = "0.11.0"
7778

7879
[dependencies]
7980
clap = { workspace = true }
8081
clap_complete = { workspace = true }
8182
clap_mangen = { workspace = true }
8283
dns-lookup = { workspace = true }
84+
parse_datetime = {workspace = true}
8385
phf = { workspace = true }
8486
serde = { workspace = true }
8587
serde_json = { workspace = true }
8688
textwrap = { workspace = true }
8789
uucore = { workspace = true }
88-
parse_datetime = {workspace = true}
8990

9091
#
9192
blockdev = { optional = true, version = "0.0.1", package = "uu_blockdev", path = "src/uu/blockdev" }
@@ -107,13 +108,15 @@ setsid = { optional = true, version = "0.0.1", package = "uu_setsid", path ="src
107108
uuidgen = { optional = true, version = "0.0.1", package = "uu_uuidgen", path ="src/uu/uuidgen" }
108109

109110
[dev-dependencies]
111+
ctor = "0.4.1"
110112
# dmesg test require fixed-boot-time feature turned on.
111113
dmesg = { version = "0.0.1", package = "uu_dmesg", path = "src/uu/dmesg", features = ["fixed-boot-time"] }
112114
libc = { workspace = true }
113115
pretty_assertions = "1"
114116
rand = { workspace = true }
115117
regex = { workspace = true }
116118
tempfile = { workspace = true }
119+
uutests = { workspace = true }
117120
uucore = { workspace = true, features = ["entries", "process", "signals"] }
118121
uuid = { workspace = true }
119122

tests/by-util/test_blockdev.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6-
use crate::common::util::TestScenario;
6+
use uutests::new_ucmd;
7+
use uutests::util::TestScenario;
8+
use uutests::util_name;
79

810
#[test]
911
fn test_invalid_arg() {
@@ -23,9 +25,12 @@ fn test_report_mutually_exclusive_with_others() {
2325

2426
#[cfg(target_os = "linux")]
2527
mod linux {
26-
use crate::common::util::TestScenario;
2728
use regex::Regex;
2829

30+
use uutests::new_ucmd;
31+
use uutests::util::TestScenario;
32+
use uutests::util_name;
33+
2934
#[test]
3035
fn test_fails_on_first_error() {
3136
new_ucmd!()
@@ -56,7 +61,9 @@ mod linux {
5661

5762
#[cfg(not(target_os = "linux"))]
5863
mod non_linux {
59-
use crate::common::util::TestScenario;
64+
use uutests::new_ucmd;
65+
use uutests::util::TestScenario;
66+
use uutests::util_name;
6067

6168
#[test]
6269
fn test_fails_on_unsupported_platforms() {

tests/by-util/test_ctrlaltdel.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
// file that was distributed with this source code.
55

66
#[cfg(target_os = "linux")]
7-
use crate::common::util::TestScenario;
7+
use uutests::new_ucmd;
8+
#[cfg(target_os = "linux")]
9+
use uutests::util::TestScenario;
10+
#[cfg(target_os = "linux")]
11+
use uutests::util_name;
812

913
#[test]
1014
#[cfg(target_os = "linux")]

tests/by-util/test_dmesg.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
//
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
5-
use crate::common::util::TestScenario;
5+
6+
use uutests::new_ucmd;
7+
use uutests::util::TestScenario;
8+
use uutests::util_name;
69

710
#[test]
811
fn test_invalid_arg() {

tests/by-util/test_fsfreeze.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6-
use crate::common::util::TestScenario;
6+
use uutests::new_ucmd;
7+
use uutests::util::TestScenario;
8+
use uutests::util_name;
79

810
#[test]
911
fn test_invalid_arg() {
@@ -23,7 +25,10 @@ fn test_operations_mutually_exclusive() {
2325

2426
#[cfg(target_os = "linux")]
2527
mod linux {
26-
use crate::common::util::TestScenario;
28+
29+
use uutests::new_ucmd;
30+
use uutests::util::TestScenario;
31+
use uutests::util_name;
2732

2833
#[test]
2934
fn test_fails_on_non_existing_path() {
@@ -48,7 +53,9 @@ mod linux {
4853

4954
#[cfg(not(target_os = "linux"))]
5055
mod non_linux {
51-
use crate::common::util::TestScenario;
56+
use uutests::new_ucmd;
57+
use uutests::util::TestScenario;
58+
use uutests::util_name;
5259

5360
#[test]
5461
fn test_fails_on_unsupported_platforms() {

tests/by-util/test_last.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
// file that was distributed with this source code.
55
// spell-checker:ignore (words) symdir somefakedir
66

7+
use uutests::at_and_ucmd;
78
#[cfg(unix)]
8-
use crate::common::util::TestScenario;
9+
use uutests::new_ucmd;
10+
#[cfg(unix)]
11+
use uutests::util::TestScenario;
12+
#[cfg(unix)]
13+
use uutests::util_name;
914

1015
#[cfg(unix)]
1116
use regex::Regex;

tests/by-util/test_lscpu.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6-
use crate::common::util::TestScenario;
6+
use uutests::new_ucmd;
7+
use uutests::util::TestScenario;
8+
use uutests::util_name;
79

810
#[test]
911
fn test_invalid_arg() {

tests/by-util/test_lslocks.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
// file that was distributed with this source code.
55

66
#[cfg(target_os = "linux")]
7-
use crate::common::util::TestScenario;
7+
use uutests::new_ucmd;
8+
#[cfg(target_os = "linux")]
9+
use uutests::util::TestScenario;
10+
#[cfg(target_os = "linux")]
11+
use uutests::util_name;
812

913
#[test]
1014
#[cfg(target_os = "linux")]

0 commit comments

Comments
 (0)