Skip to content

Commit b5e0a52

Browse files
committed
build: use "selinux" instead of "feat_selinux" feature name
1 parent 542e7af commit b5e0a52

18 files changed

Lines changed: 59 additions & 184 deletions

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ uudoc = [
3737
"dep:regex",
3838
"dep:zip",
3939
]
40+
selinux = ["dep:selinux"]
4041
## features
4142
## Optional feature for stdbuf
4243
# "feat_external_libstdbuf" == use an external libstdbuf.so for stdbuf instead of embedding it

src/uu/cp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ name = "cp_bench"
6161
harness = false
6262

6363
[features]
64-
feat_selinux = ["selinux", "uucore/selinux"]
64+
selinux = ["dep:selinux", "uucore/selinux"]
6565
feat_acl = ["exacl"]

src/uu/id/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ name = "id"
3333
path = "src/main.rs"
3434

3535
[features]
36-
feat_selinux = ["selinux"]
36+
selinux = ["dep:selinux"]
3737
smack = ["uucore/smack"]

src/uu/ls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ name = "ls_bench"
6565
harness = false
6666

6767
[features]
68-
feat_selinux = ["selinux", "uucore/selinux"]
68+
selinux = ["dep:selinux", "uucore/selinux"]
6969
smack = ["uucore/smack"]

tests/by-util/test_chcon.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
// file that was distributed with this source code.
55
// spell-checker:ignore (jargon) xattributes
66
#![allow(clippy::missing_errors_doc, clippy::similar_names)]
7-
#![cfg(all(
8-
feature = "feat_selinux",
9-
any(target_os = "linux", target_os = "android")
10-
))]
7+
#![cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
118

129
use std::ffi::CString;
1310
use std::path::Path;

tests/by-util/test_cp.rs

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
#[cfg(unix)]
99
use rstest::rstest;
1010
use uucore::display::Quotable;
11-
#[cfg(all(
12-
feature = "feat_selinux",
13-
any(target_os = "linux", target_os = "android")
14-
))]
11+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
1512
use uucore::selinux::get_getfattr_output;
1613
use uutests::util::TestScenario;
1714
use uutests::{at_and_ucmd, new_ucmd, path_concat, util_name};
@@ -1831,7 +1828,7 @@ fn test_cp_preserve_xattr() {
18311828

18321829
#[test]
18331830
#[cfg(all(
1834-
not(feature = "feat_selinux"),
1831+
not(feature = "selinux"),
18351832
any(target_os = "linux", target_os = "android")
18361833
))]
18371834
fn test_cp_preserve_all_context_fails_on_non_selinux() {
@@ -6777,10 +6774,7 @@ fn test_cp_from_stream_permission() {
67776774
}
67786775

67796776
#[test]
6780-
#[cfg(all(
6781-
feature = "feat_selinux",
6782-
any(target_os = "linux", target_os = "android")
6783-
))]
6777+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
67846778
fn test_cp_selinux() {
67856779
let ts = TestScenario::new(util_name!());
67866780
let at = &ts.fixtures;
@@ -6805,10 +6799,7 @@ fn test_cp_selinux() {
68056799
}
68066800

68076801
#[test]
6808-
#[cfg(all(
6809-
feature = "feat_selinux",
6810-
any(target_os = "linux", target_os = "android")
6811-
))]
6802+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
68126803
fn test_cp_selinux_invalid() {
68136804
let scene = TestScenario::new(util_name!());
68146805
let at = &scene.fixtures;
@@ -6832,10 +6823,7 @@ fn test_cp_selinux_invalid() {
68326823
}
68336824

68346825
#[test]
6835-
#[cfg(all(
6836-
feature = "feat_selinux",
6837-
any(target_os = "linux", target_os = "android")
6838-
))]
6826+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
68396827
fn test_cp_preserve_selinux() {
68406828
let ts = TestScenario::new(util_name!());
68416829
let at = &ts.fixtures;
@@ -6873,10 +6861,7 @@ fn test_cp_preserve_selinux() {
68736861
}
68746862

68756863
#[test]
6876-
#[cfg(all(
6877-
feature = "feat_selinux",
6878-
any(target_os = "linux", target_os = "android")
6879-
))]
6864+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
68806865
fn test_cp_preserve_selinux_admin_context() {
68816866
let ts = TestScenario::new(util_name!());
68826867
let at = &ts.fixtures;
@@ -6935,10 +6920,7 @@ fn test_cp_preserve_selinux_admin_context() {
69356920
}
69366921

69376922
#[test]
6938-
#[cfg(all(
6939-
feature = "feat_selinux",
6940-
any(target_os = "linux", target_os = "android")
6941-
))]
6923+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
69426924
fn test_cp_selinux_context_priority() {
69436925
// This test verifies that -Z takes priority over --context
69446926

@@ -7018,10 +7000,7 @@ fn test_cp_selinux_context_priority() {
70187000
}
70197001

70207002
#[test]
7021-
#[cfg(all(
7022-
feature = "feat_selinux",
7023-
any(target_os = "linux", target_os = "android")
7024-
))]
7003+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
70257004
fn test_cp_selinux_empty_context() {
70267005
// This test verifies that --context without a value works like -Z
70277006

@@ -7067,10 +7046,7 @@ fn test_cp_selinux_empty_context() {
70677046
}
70687047

70697048
#[test]
7070-
#[cfg(all(
7071-
feature = "feat_selinux",
7072-
any(target_os = "linux", target_os = "android")
7073-
))]
7049+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
70747050
fn test_cp_selinux_recursive() {
70757051
// Test SELinux context preservation in recursive directory copies
70767052

@@ -7124,10 +7100,7 @@ fn test_cp_selinux_recursive() {
71247100
}
71257101

71267102
#[test]
7127-
#[cfg(all(
7128-
feature = "feat_selinux",
7129-
any(target_os = "linux", target_os = "android")
7130-
))]
7103+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
71317104
fn test_cp_preserve_context_root() {
71327105
use uutests::util::run_ucmd_as_root;
71337106
let scene = TestScenario::new(util_name!());
@@ -7830,10 +7803,7 @@ fn test_cp_gnu_preserve_mode() {
78307803
}
78317804

78327805
#[test]
7833-
#[cfg(all(
7834-
feature = "feat_selinux",
7835-
any(target_os = "linux", target_os = "android")
7836-
))]
7806+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
78377807
fn test_cp_a_z_overrides_context() {
78387808
// Verifies -aZ succeeds (-Z overrides implicit --preserve=context from -a)
78397809
use std::path::Path;
@@ -7851,10 +7821,7 @@ fn test_cp_a_z_overrides_context() {
78517821
}
78527822

78537823
#[test]
7854-
#[cfg(all(
7855-
feature = "feat_selinux",
7856-
any(target_os = "linux", target_os = "android")
7857-
))]
7824+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
78587825
fn test_cp_a_preserves_context() {
78597826
use std::path::Path;
78607827
use uucore::selinux::{get_selinux_security_context, set_selinux_security_context};
@@ -7877,10 +7844,7 @@ fn test_cp_a_preserves_context() {
78777844
}
78787845

78797846
#[test]
7880-
#[cfg(all(
7881-
feature = "feat_selinux",
7882-
any(target_os = "linux", target_os = "android")
7883-
))]
7847+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
78847848
fn test_cp_preserve_context_with_z_fails() {
78857849
let (at, mut ucmd) = at_and_ucmd!();
78867850
at.touch("src");

tests/by-util/test_dd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use uutests::at_and_ucmd;
88
use uutests::new_ucmd;
99
use uutests::util::TestScenario;
10-
#[cfg(all(unix, not(feature = "feat_selinux")))]
10+
#[cfg(all(unix, not(feature = "selinux")))]
1111
use uutests::util::run_ucmd_as_root_with_stdin_stdout;
1212
#[cfg(all(not(windows), feature = "printf"))]
1313
use uutests::util::{UCommand, get_tests_binary};
@@ -1608,7 +1608,7 @@ fn test_nocache_file() {
16081608

16091609
#[test]
16101610
#[cfg(unix)]
1611-
#[cfg(not(feature = "feat_selinux"))]
1611+
#[cfg(not(feature = "selinux"))]
16121612
// Disabled on SELinux for now
16131613
fn test_skip_past_dev() {
16141614
// NOTE: This test intends to trigger code which can only be reached with root permissions.
@@ -1633,7 +1633,7 @@ fn test_skip_past_dev() {
16331633

16341634
#[test]
16351635
#[cfg(unix)]
1636-
#[cfg(not(feature = "feat_selinux"))]
1636+
#[cfg(not(feature = "selinux"))]
16371637
fn test_seek_past_dev() {
16381638
// NOTE: This test intends to trigger code which can only be reached with root permissions.
16391639
let ts = TestScenario::new(util_name!());

tests/by-util/test_df.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn test_type_option() {
329329

330330
#[test]
331331
#[cfg(not(any(target_os = "freebsd", target_os = "openbsd", target_os = "windows")))] // FIXME: fix test for FreeBSD, OpenBSD & Win
332-
#[cfg(not(feature = "feat_selinux"))]
332+
#[cfg(not(feature = "selinux"))]
333333
fn test_type_option_with_file() {
334334
let fs_type = new_ucmd!()
335335
.args(&["--output=fstype", "."])

tests/by-util/test_id.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn test_id_no_specified_user() {
3434
let exp_result = unwrap_or_return!(expected_result(&ts, &[]));
3535
let mut exp_stdout = exp_result.stdout_str().to_string();
3636

37-
#[cfg(not(feature = "feat_selinux"))]
37+
#[cfg(not(feature = "selinux"))]
3838
{
3939
// NOTE: strip 'context' part from exp_stdout if selinux not enabled:
4040
// example:
@@ -383,10 +383,7 @@ fn test_id_zero() {
383383
}
384384

385385
#[test]
386-
#[cfg(all(
387-
feature = "feat_selinux",
388-
any(target_os = "linux", target_os = "android")
389-
))]
386+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
390387
fn test_id_context() {
391388
if !uucore::selinux::is_selinux_enabled() {
392389
println!("test skipped: Kernel has no support for SElinux context");
@@ -456,10 +453,7 @@ fn test_id_no_specified_user_posixly() {
456453
result.success();
457454
}
458455

459-
#[cfg(all(
460-
any(target_os = "linux", target_os = "android"),
461-
feature = "feat_selinux"
462-
))]
456+
#[cfg(all(any(target_os = "linux", target_os = "android"), feature = "selinux"))]
463457
{
464458
if uucore::selinux::is_selinux_enabled() {
465459
let result = ts.ucmd().succeeds();

tests/by-util/test_install.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ use std::process;
1919
#[cfg(any(target_os = "linux", target_os = "android"))]
2020
use std::thread::sleep;
2121
use uucore::process::{getegid, geteuid};
22-
#[cfg(all(
23-
feature = "feat_selinux",
24-
any(target_os = "linux", target_os = "android")
25-
))]
22+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
2623
use uucore::selinux::get_getfattr_output;
2724
use uutests::at_and_ucmd;
2825
use uutests::new_ucmd;
@@ -2361,10 +2358,7 @@ fn test_install_no_target_basic() {
23612358
}
23622359

23632360
#[test]
2364-
#[cfg(all(
2365-
feature = "feat_selinux",
2366-
any(target_os = "linux", target_os = "android")
2367-
))]
2361+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
23682362
fn test_selinux() {
23692363
let scene = TestScenario::new(util_name!());
23702364
let at = &scene.fixtures;
@@ -2413,10 +2407,7 @@ fn test_selinux() {
24132407
}
24142408

24152409
#[test]
2416-
#[cfg(all(
2417-
feature = "feat_selinux",
2418-
any(target_os = "linux", target_os = "android")
2419-
))]
2410+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
24202411
fn test_selinux_invalid_args() {
24212412
let scene = TestScenario::new(util_name!());
24222413
let at = &scene.fixtures;
@@ -2449,10 +2440,7 @@ fn test_selinux_invalid_args() {
24492440
}
24502441

24512442
#[test]
2452-
#[cfg(all(
2453-
feature = "feat_selinux",
2454-
any(target_os = "linux", target_os = "android")
2455-
))]
2443+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
24562444
fn test_selinux_default_context() {
24572445
let scene = TestScenario::new(util_name!());
24582446
let at = &scene.fixtures;

0 commit comments

Comments
 (0)