nologin: Add tool

This commit is contained in:
Tuomas Tynkkynen
2025-09-14 18:58:46 +03:00
parent a04b7a3658
commit fd69cc2230
8 changed files with 166 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
// This file is part of the uutils util-linux package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use uutests::{new_ucmd, util::TestScenario, util_name};
#[test]
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}
#[test]
fn test_nologin_args() {
let args_to_try: &[&[&str]] = &[
&[],
&["-c", "command"],
&["--init-file", "file"],
&["-i"],
&["--interactive"],
&["-l"],
&["--login"],
&["--noprofile"],
&["--norc"],
&["--posix"],
&["--rcfile", "file"],
&["--restricted"],
&["-r"],
];
for args in args_to_try {
new_ucmd!()
.args(args)
.fails()
.code_is(1)
.stdout_contains("This account is currently not available.");
}
}
+4
View File
@@ -35,6 +35,10 @@ mod test_mesg;
#[path = "by-util/test_mountpoint.rs"]
mod test_mountpoint;
#[cfg(feature = "nologin")]
#[path = "by-util/test_nologin.rs"]
mod test_nologin;
#[cfg(feature = "blockdev")]
#[path = "by-util/test_blockdev.rs"]
mod test_blockdev;