2020-05-25 17:05:26 +00:00
|
|
|
use crate::common::util::*;
|
2020-04-30 22:24:06 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_uname_compatible() {
|
2021-04-17 23:28:06 +00:00
|
|
|
new_ucmd!().arg("-a").succeeds();
|
2020-04-30 22:24:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_uname_name() {
|
2021-04-17 23:28:06 +00:00
|
|
|
new_ucmd!().arg("-n").succeeds();
|
2020-04-30 22:24:06 +00:00
|
|
|
}
|
2020-05-05 13:52:17 +00:00
|
|
|
|
2020-12-11 21:46:36 +00:00
|
|
|
#[test]
|
|
|
|
fn test_uname_processor() {
|
2021-04-17 23:28:06 +00:00
|
|
|
let result = new_ucmd!().arg("-p").succeeds();
|
|
|
|
assert_eq!(result.stdout_str().trim_end(), "unknown");
|
2020-12-11 21:46:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_uname_hwplatform() {
|
2021-04-17 23:28:06 +00:00
|
|
|
let result = new_ucmd!().arg("-i").succeeds();
|
|
|
|
assert_eq!(result.stdout_str().trim_end(), "unknown");
|
2020-12-11 21:46:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_uname_machine() {
|
2021-04-17 23:28:06 +00:00
|
|
|
new_ucmd!().arg("-m").succeeds();
|
2020-12-11 21:46:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_uname_kernel_version() {
|
2021-04-17 23:28:06 +00:00
|
|
|
new_ucmd!().arg("-v").succeeds();
|
2020-12-11 21:46:36 +00:00
|
|
|
}
|
|
|
|
|
2020-05-05 13:52:17 +00:00
|
|
|
#[test]
|
|
|
|
fn test_uname_kernel() {
|
|
|
|
let (_, mut ucmd) = at_and_ucmd!();
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
2021-05-02 07:41:04 +00:00
|
|
|
{
|
|
|
|
let result = ucmd.arg("-o").succeeds();
|
|
|
|
assert!(result.stdout_str().to_lowercase().contains("linux"));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(target_os = "linux"))]
|
|
|
|
let result = ucmd.arg("-o").succeeds();
|
2020-05-05 13:52:17 +00:00
|
|
|
}
|