mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
tests: enable tests for uptime on OpenBSD
Signed-off-by: Laurent Cheylus <foxy@free.fr>
This commit is contained in:
parent
920d29f703
commit
c0a3662b63
2 changed files with 15 additions and 10 deletions
|
@ -7,16 +7,16 @@
|
||||||
|
|
||||||
use crate::common::util::TestScenario;
|
use crate::common::util::TestScenario;
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(any(target_os = "macos", target_os = "openbsd")))]
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(any(target_os = "macos", target_os = "openbsd")))]
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(any(target_os = "macos", target_os = "openbsd")))]
|
||||||
use serde_big_array::BigArray;
|
use serde_big_array::BigArray;
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(any(target_os = "macos", target_os = "openbsd")))]
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(any(target_os = "macos", target_os = "openbsd")))]
|
||||||
use std::{io::Write, path::PathBuf};
|
use std::{io::Write, path::PathBuf};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -25,7 +25,6 @@ fn test_invalid_arg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(target_os = "openbsd"))]
|
|
||||||
fn test_uptime() {
|
fn test_uptime() {
|
||||||
TestScenario::new(util_name!())
|
TestScenario::new(util_name!())
|
||||||
.ucmd()
|
.ucmd()
|
||||||
|
@ -82,7 +81,7 @@ fn test_uptime_with_fifo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(any(target_os = "openbsd", target_os = "freebsd")))]
|
#[cfg(not(target_os = "freebsd"))]
|
||||||
fn test_uptime_with_non_existent_file() {
|
fn test_uptime_with_non_existent_file() {
|
||||||
// Disabled for freebsd, since it doesn't use the utmpxname() sys call to change the default utmpx
|
// Disabled for freebsd, since it doesn't use the utmpxname() sys call to change the default utmpx
|
||||||
// file that is accessed using getutxent()
|
// file that is accessed using getutxent()
|
||||||
|
@ -230,7 +229,6 @@ fn test_uptime_with_file_containing_valid_boot_time_utmpx_record() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(target_os = "openbsd"))]
|
|
||||||
fn test_uptime_with_extra_argument() {
|
fn test_uptime_with_extra_argument() {
|
||||||
let ts = TestScenario::new(util_name!());
|
let ts = TestScenario::new(util_name!());
|
||||||
|
|
||||||
|
@ -242,7 +240,6 @@ fn test_uptime_with_extra_argument() {
|
||||||
}
|
}
|
||||||
/// Checks whether uptime displays the correct stderr msg when its called with a directory
|
/// Checks whether uptime displays the correct stderr msg when its called with a directory
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(target_os = "openbsd"))]
|
|
||||||
fn test_uptime_with_dir() {
|
fn test_uptime_with_dir() {
|
||||||
let ts = TestScenario::new(util_name!());
|
let ts = TestScenario::new(util_name!());
|
||||||
let at = &ts.fixtures;
|
let at = &ts.fixtures;
|
||||||
|
@ -256,7 +253,15 @@ fn test_uptime_with_dir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(target_os = "openbsd"))]
|
#[cfg(target_os = "openbsd")]
|
||||||
|
fn test_uptime_check_users_openbsd() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["openbsd_utmp"])
|
||||||
|
.run()
|
||||||
|
.stdout_contains("4 users");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
fn test_uptime_since() {
|
fn test_uptime_since() {
|
||||||
let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}").unwrap();
|
let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}").unwrap();
|
||||||
|
|
||||||
|
|
BIN
tests/fixtures/uptime/openbsd_utmp
vendored
Normal file
BIN
tests/fixtures/uptime/openbsd_utmp
vendored
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue