Skip to content

Commit 37854aa

Browse files
committed
Update tvOS support elsewhere in the stdlib
1 parent 49da0ac commit 37854aa

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

library/std/src/fs/tests.rs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,10 @@ fn test_file_times() {
16401640
use crate::os::ios::fs::FileTimesExt;
16411641
#[cfg(target_os = "macos")]
16421642
use crate::os::macos::fs::FileTimesExt;
1643+
#[cfg(target_os = "tvos")]
1644+
use crate::os::tvos::fs::FileTimesExt;
1645+
#[cfg(target_os = "tvos")]
1646+
use crate::os::tvos::fs::FileTimesExt;
16431647
#[cfg(target_os = "watchos")]
16441648
use crate::os::watchos::fs::FileTimesExt;
16451649
#[cfg(windows)]
@@ -1651,9 +1655,21 @@ fn test_file_times() {
16511655
let accessed = SystemTime::UNIX_EPOCH + Duration::from_secs(12345);
16521656
let modified = SystemTime::UNIX_EPOCH + Duration::from_secs(54321);
16531657
times = times.set_accessed(accessed).set_modified(modified);
1654-
#[cfg(any(windows, target_os = "macos", target_os = "ios", target_os = "watchos"))]
1658+
#[cfg(any(
1659+
windows,
1660+
target_os = "macos",
1661+
target_os = "ios",
1662+
target_os = "watchos",
1663+
target_os = "tvos",
1664+
))]
16551665
let created = SystemTime::UNIX_EPOCH + Duration::from_secs(32123);
1656-
#[cfg(any(windows, target_os = "macos", target_os = "ios", target_os = "watchos"))]
1666+
#[cfg(any(
1667+
windows,
1668+
target_os = "macos",
1669+
target_os = "ios",
1670+
target_os = "watchos",
1671+
target_os = "tvos",
1672+
))]
16571673
{
16581674
times = times.set_created(created);
16591675
}
@@ -1678,7 +1694,13 @@ fn test_file_times() {
16781694
let metadata = file.metadata().unwrap();
16791695
assert_eq!(metadata.accessed().unwrap(), accessed);
16801696
assert_eq!(metadata.modified().unwrap(), modified);
1681-
#[cfg(any(windows, target_os = "macos", target_os = "ios", target_os = "watchos"))]
1697+
#[cfg(any(
1698+
windows,
1699+
target_os = "macos",
1700+
target_os = "ios",
1701+
target_os = "watchos",
1702+
target_os = "tvos",
1703+
))]
16821704
{
16831705
assert_eq!(metadata.created().unwrap(), created);
16841706
}

library/std/src/os/unix/ucred/tests.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ fn test_socket_pair() {
2727
}
2828

2929
#[test]
30-
#[cfg(any(target_os = "linux", target_os = "ios", target_os = "macos", target_os = "watchos"))]
30+
#[cfg(any(
31+
target_os = "linux",
32+
target_os = "ios",
33+
target_os = "macos",
34+
target_os = "watchos",
35+
target_os = "tvos",
36+
))]
3137
fn test_socket_pair_pids(arg: Type) -> RetType {
3238
// Create two connected sockets and get their peer credentials.
3339
let (sock_a, sock_b) = UnixStream::pair().unwrap();

library/std/src/sys/unix/fs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ pub struct FilePermissions {
362362
pub struct FileTimes {
363363
accessed: Option<SystemTime>,
364364
modified: Option<SystemTime>,
365-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
365+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos"))]
366366
created: Option<SystemTime>,
367367
}
368368

@@ -615,7 +615,7 @@ impl FileTimes {
615615
self.modified = Some(t);
616616
}
617617

618-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
618+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos"))]
619619
pub fn set_created(&mut self, t: SystemTime) {
620620
self.created = Some(t);
621621
}
@@ -1272,7 +1272,7 @@ impl File {
12721272
io::ErrorKind::Unsupported,
12731273
"setting file times not supported",
12741274
))
1275-
} else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] {
1275+
} else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))] {
12761276
let mut buf = [mem::MaybeUninit::<libc::timespec>::uninit(); 3];
12771277
let mut num_times = 0;
12781278
let mut attrlist: libc::attrlist = unsafe { mem::zeroed() };

library/std/src/thread/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ fn test_named_thread() {
4242
all(target_os = "linux", target_env = "gnu"),
4343
target_os = "macos",
4444
target_os = "ios",
45+
target_os = "tvos",
4546
target_os = "watchos"
4647
))]
4748
#[test]

0 commit comments

Comments
 (0)