Skip to content

Commit 5931300

Browse files
committed
Android: Fixed tests for libc time API
1 parent 894c264 commit 5931300

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

ci/ci.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ case $HOST_TARGET in
154154
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname pthread time fs
155155
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX thread sync available-parallelism time tls
156156
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX thread sync available-parallelism time tls
157-
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX pthread --skip threadname --skip pthread_cond_timedwait
157+
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX pthread time --skip threadname --skip pthread_cond_timedwait
158158
TEST_TARGET=wasm32-wasip2 run_tests_minimal empty_main wasm heap_alloc libc-mem
159159
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal empty_main wasm
160160
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std

src/shims/time.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3636
let mut relative_clocks;
3737

3838
match this.tcx.sess.target.os.as_ref() {
39-
"linux" | "freebsd" => {
39+
"linux" | "freebsd" | "android" => {
4040
// Linux and FreeBSD have two main kinds of clocks. REALTIME clocks return the actual time since the
4141
// Unix epoch, including effects which may cause time to move backwards such as NTP.
4242
// Linux further distinguishes regular and "coarse" clocks, but the "coarse" version

tests/pass-dep/libc/libc-time.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn test_clocks() {
1515
assert_eq!(is_error, 0);
1616
let is_error = unsafe { libc::clock_gettime(libc::CLOCK_MONOTONIC, tp.as_mut_ptr()) };
1717
assert_eq!(is_error, 0);
18-
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
18+
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "android"))]
1919
{
2020
let is_error = unsafe { libc::clock_gettime(libc::CLOCK_REALTIME_COARSE, tp.as_mut_ptr()) };
2121
assert_eq!(is_error, 0);
@@ -63,9 +63,9 @@ fn test_localtime_r() {
6363
tm_wday: 0,
6464
tm_yday: 0,
6565
tm_isdst: 0,
66-
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
66+
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "android"))]
6767
tm_gmtoff: 0,
68-
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
68+
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "android"))]
6969
tm_zone: std::ptr::null_mut::<libc::c_char>(),
7070
};
7171
let res = unsafe { libc::localtime_r(custom_time_ptr, &mut tm) };
@@ -79,9 +79,9 @@ fn test_localtime_r() {
7979
assert_eq!(tm.tm_wday, 0);
8080
assert_eq!(tm.tm_yday, 97);
8181
assert_eq!(tm.tm_isdst, -1);
82-
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
82+
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "android"))]
8383
assert_eq!(tm.tm_gmtoff, 0);
84-
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
84+
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "android"))]
8585
unsafe {
8686
assert_eq!(std::ffi::CStr::from_ptr(tm.tm_zone).to_str().unwrap(), "+00")
8787
};

0 commit comments

Comments
 (0)