Skip to content

Commit 8122d04

Browse files
committed
Expose utsname on all platforms
1 parent e2f9531 commit 8122d04

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/sys/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub mod reboot;
3939

4040
pub mod termios;
4141

42-
#[cfg(any(target_os = "linux", target_os = "android"))]
4342
pub mod utsname;
4443

4544
pub mod wait;

src/sys/utsname.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,21 @@ fn to_str<'a>(s: *const *const c_char) -> &'a str {
5252
mod test {
5353
use super::uname;
5454

55+
#[cfg(target_os = "linux")]
5556
#[test]
56-
pub fn test_uname() {
57+
pub fn test_uname_linux() {
5758
assert_eq!(uname().sysname(), "Linux");
5859
}
60+
61+
#[cfg(target_os = "darwin")]
62+
#[test]
63+
pub fn test_uname_darwin() {
64+
assert_eq!(uname().sysname(), "Darwin");
65+
}
66+
67+
#[cfg(target_os = "freebsd")]
68+
#[test]
69+
pub fn test_uname_freebsd() {
70+
assert_eq!(uname().sysname(), "FreeBSD");
71+
}
5972
}

0 commit comments

Comments
 (0)