2020-05-17 09:36:07 +00:00
|
|
|
extern crate regex;
|
|
|
|
use self::regex::Regex;
|
2020-05-25 17:05:26 +00:00
|
|
|
use crate::common::util::*;
|
2020-05-15 22:14:54 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_uptime() {
|
2021-04-17 23:28:06 +00:00
|
|
|
TestScenario::new(util_name!())
|
|
|
|
.ucmd_keepenv()
|
|
|
|
.succeeds()
|
|
|
|
.stdout_contains("load average:")
|
|
|
|
.stdout_contains(" up ");
|
2020-05-15 22:14:54 +00:00
|
|
|
|
|
|
|
// Don't check for users as it doesn't show in some CI
|
|
|
|
}
|
2020-05-17 09:36:07 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_uptime_since() {
|
|
|
|
let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}").unwrap();
|
2021-04-17 23:28:06 +00:00
|
|
|
|
|
|
|
new_ucmd!().arg("--since").succeeds().stdout_matches(&re);
|
2020-05-17 09:36:07 +00:00
|
|
|
}
|
2020-11-03 22:10:32 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_failed() {
|
2021-05-30 05:10:54 +00:00
|
|
|
new_ucmd!().arg("will-fail").fails();
|
2020-11-03 22:10:32 +00:00
|
|
|
}
|