coreutils/tests/by-util/test_uptime.rs
Laurent Cheylus 4589f637ee tests: disable tests for tools unsupported on OpenBSD
pinky, uptime and who are not supported on OpenBSD (no support of utmpx feature) => disable tests
for these tools on OpenBSD with conditional compilation

Signed-off-by: Laurent Cheylus <foxy@free.fr>
2024-01-19 17:37:45 +01:00

36 lines
894 B
Rust

// This file is part of the uutils coreutils package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use crate::common::util::TestScenario;
use regex::Regex;
#[test]
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_uptime() {
TestScenario::new(util_name!())
.ucmd()
.succeeds()
.stdout_contains("load average:")
.stdout_contains(" up ");
// Don't check for users as it doesn't show in some CI
}
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_uptime_since() {
let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}").unwrap();
new_ucmd!().arg("--since").succeeds().stdout_matches(&re);
}
#[test]
fn test_failed() {
new_ucmd!().arg("will-fail").fails();
}