Skip to content

Commit 71e9755

Browse files
committed
Drop non-portable test
1 parent efdb5ab commit 71e9755

3 files changed

Lines changed: 24 additions & 114 deletions

File tree

‎tests/unit/out/refcount/sys_time.rs‎

Lines changed: 12 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -80,57 +80,7 @@ pub fn print_tm_1(t: i64) {
8080
(*(*tm.borrow()).tm_isdst.borrow())
8181
);
8282
}
83-
pub fn test_clock_gettime_2() {
84-
let ts: Value<libcc2rs::Timespec> = Rc::new(RefCell::new(Default::default()));
85-
assert!(
86-
(((match nix::time::clock_gettime(nix::time::ClockId::CLOCK_REALTIME) {
87-
Ok(__ts) => {
88-
(ts.as_pointer()).with_mut(|__t| {
89-
*__t.tv_sec.borrow_mut() = __ts.tv_sec() as i64;
90-
*__t.tv_nsec.borrow_mut() = __ts.tv_nsec() as i64;
91-
});
92-
0
93-
}
94-
Err(__e) => {
95-
libcc2rs::cpp2rust_errno().write(__e as i32);
96-
-1
97-
}
98-
} == 0) as i32)
99-
!= 0)
100-
);
101-
assert!(((((*(*ts.borrow()).tv_sec.borrow()) > 1500000000_i64) as i32) != 0));
102-
assert!(
103-
(((((((*(*ts.borrow()).tv_nsec.borrow()) >= 0_i64) as i32) != 0)
104-
&& ((((*(*ts.borrow()).tv_nsec.borrow()) < 1000000000_i64) as i32) != 0))
105-
as i32)
106-
!= 0)
107-
);
108-
let mono: Value<libcc2rs::Timespec> = Rc::new(RefCell::new(Default::default()));
109-
assert!(
110-
(((match nix::time::clock_gettime(nix::time::ClockId::CLOCK_MONOTONIC) {
111-
Ok(__ts) => {
112-
(mono.as_pointer()).with_mut(|__t| {
113-
*__t.tv_sec.borrow_mut() = __ts.tv_sec() as i64;
114-
*__t.tv_nsec.borrow_mut() = __ts.tv_nsec() as i64;
115-
});
116-
0
117-
}
118-
Err(__e) => {
119-
libcc2rs::cpp2rust_errno().write(__e as i32);
120-
-1
121-
}
122-
} == 0) as i32)
123-
!= 0)
124-
);
125-
assert!(((((*(*mono.borrow()).tv_sec.borrow()) >= 0_i64) as i32) != 0));
126-
assert!(
127-
(((((((*(*mono.borrow()).tv_nsec.borrow()) >= 0_i64) as i32) != 0)
128-
&& ((((*(*mono.borrow()).tv_nsec.borrow()) < 1000000000_i64) as i32) != 0))
129-
as i32)
130-
!= 0)
131-
);
132-
}
133-
pub fn test_gmtime_r_3() {
83+
pub fn test_gmtime_r_2() {
13484
({ print_tm_1(0_i64) });
13585
({ print_tm_1(1_i64) });
13686
({ print_tm_1(86399_i64) });
@@ -142,7 +92,7 @@ pub fn test_gmtime_r_3() {
14292
({ print_tm_1(1721126096_i64) });
14393
({ print_tm_1(4102444800_i64) });
14494
}
145-
pub fn print_local_tm_4(t: i64) {
95+
pub fn print_local_tm_3(t: i64) {
14696
let t: Value<i64> = Rc::new(RefCell::new(t));
14797
let tm: Value<libcc2rs::Tm> = Rc::new(RefCell::new(Default::default()));
14898
assert!(
@@ -185,14 +135,14 @@ pub fn print_local_tm_4(t: i64) {
185135
(*(*tm.borrow()).tm_isdst.borrow())
186136
);
187137
}
188-
pub fn test_localtime_r_5() {
189-
({ print_local_tm_4(0_i64) });
190-
({ print_local_tm_4(951782400_i64) });
191-
({ print_local_tm_4(1704067199_i64) });
192-
({ print_local_tm_4(1721126096_i64) });
193-
({ print_local_tm_4(1735689600_i64) });
138+
pub fn test_localtime_r_4() {
139+
({ print_local_tm_3(0_i64) });
140+
({ print_local_tm_3(951782400_i64) });
141+
({ print_local_tm_3(1704067199_i64) });
142+
({ print_local_tm_3(1721126096_i64) });
143+
({ print_local_tm_3(1735689600_i64) });
194144
}
195-
pub fn test_strftime_6() {
145+
pub fn test_strftime_5() {
196146
let t: Value<i64> = Rc::new(RefCell::new(1721126096_i64));
197147
let tm: Value<libcc2rs::Tm> = Rc::new(RefCell::new(Default::default()));
198148
assert!(
@@ -352,9 +302,8 @@ pub fn main() {
352302
}
353303
fn main_0() -> i32 {
354304
({ test_time_0() });
355-
({ test_clock_gettime_2() });
356-
({ test_gmtime_r_3() });
357-
({ test_localtime_r_5() });
358-
({ test_strftime_6() });
305+
({ test_gmtime_r_2() });
306+
({ test_localtime_r_4() });
307+
({ test_strftime_5() });
359308
return 0;
360309
}

‎tests/unit/out/unsafe/sys_time.rs‎

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,7 @@ pub unsafe fn print_tm_1(mut t: i64) {
4242
tm.tm_isdst,
4343
);
4444
}
45-
pub unsafe fn test_clock_gettime_2() {
46-
let mut ts: ::libc::timespec = unsafe { std::mem::zeroed() };
47-
assert!(
48-
((((libc::clock_gettime(libc::CLOCK_REALTIME, (&mut ts as *mut ::libc::timespec))) == (0))
49-
as i32)
50-
!= 0)
51-
);
52-
assert!(((((ts.tv_sec) > (1500000000_i64)) as i32) != 0));
53-
assert!(
54-
(((((((ts.tv_nsec) >= (0_i64)) as i32) != 0)
55-
&& ((((ts.tv_nsec) < (1000000000_i64)) as i32) != 0)) as i32)
56-
!= 0)
57-
);
58-
let mut mono: ::libc::timespec = unsafe { std::mem::zeroed() };
59-
assert!(
60-
((((libc::clock_gettime(libc::CLOCK_MONOTONIC, (&mut mono as *mut ::libc::timespec)))
61-
== (0)) as i32)
62-
!= 0)
63-
);
64-
assert!(((((mono.tv_sec) >= (0_i64)) as i32) != 0));
65-
assert!(
66-
(((((((mono.tv_nsec) >= (0_i64)) as i32) != 0)
67-
&& ((((mono.tv_nsec) < (1000000000_i64)) as i32) != 0)) as i32)
68-
!= 0)
69-
);
70-
}
71-
pub unsafe fn test_gmtime_r_3() {
45+
pub unsafe fn test_gmtime_r_2() {
7246
(unsafe { print_tm_1(0_i64) });
7347
(unsafe { print_tm_1(1_i64) });
7448
(unsafe { print_tm_1(86399_i64) });
@@ -80,7 +54,7 @@ pub unsafe fn test_gmtime_r_3() {
8054
(unsafe { print_tm_1(1721126096_i64) });
8155
(unsafe { print_tm_1(4102444800_i64) });
8256
}
83-
pub unsafe fn print_local_tm_4(mut t: i64) {
57+
pub unsafe fn print_local_tm_3(mut t: i64) {
8458
let mut tm: ::libc::tm = unsafe { std::mem::zeroed() };
8559
assert!(
8660
(((!((libc::localtime_r(
@@ -108,14 +82,14 @@ pub unsafe fn print_local_tm_4(mut t: i64) {
10882
tm.tm_isdst,
10983
);
11084
}
111-
pub unsafe fn test_localtime_r_5() {
112-
(unsafe { print_local_tm_4(0_i64) });
113-
(unsafe { print_local_tm_4(951782400_i64) });
114-
(unsafe { print_local_tm_4(1704067199_i64) });
115-
(unsafe { print_local_tm_4(1721126096_i64) });
116-
(unsafe { print_local_tm_4(1735689600_i64) });
85+
pub unsafe fn test_localtime_r_4() {
86+
(unsafe { print_local_tm_3(0_i64) });
87+
(unsafe { print_local_tm_3(951782400_i64) });
88+
(unsafe { print_local_tm_3(1704067199_i64) });
89+
(unsafe { print_local_tm_3(1721126096_i64) });
90+
(unsafe { print_local_tm_3(1735689600_i64) });
11791
}
118-
pub unsafe fn test_strftime_6() {
92+
pub unsafe fn test_strftime_5() {
11993
let mut t: i64 = 1721126096_i64;
12094
let mut tm: ::libc::tm = unsafe { std::mem::zeroed() };
12195
assert!(
@@ -197,9 +171,8 @@ pub fn main() {
197171
}
198172
unsafe fn main_0() -> i32 {
199173
(unsafe { test_time_0() });
200-
(unsafe { test_clock_gettime_2() });
201-
(unsafe { test_gmtime_r_3() });
202-
(unsafe { test_localtime_r_5() });
203-
(unsafe { test_strftime_6() });
174+
(unsafe { test_gmtime_r_2() });
175+
(unsafe { test_localtime_r_4() });
176+
(unsafe { test_strftime_5() });
204177
return 0;
205178
}

‎tests/unit/sys_time.c‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@ static void print_tm(time_t t) {
2121
tm.tm_wday, tm.tm_yday, tm.tm_zone, tm.tm_gmtoff, tm.tm_isdst);
2222
}
2323

24-
static void test_clock_gettime(void) {
25-
struct timespec ts;
26-
assert(clock_gettime(CLOCK_REALTIME, &ts) == 0);
27-
assert(ts.tv_sec > 1500000000);
28-
assert(ts.tv_nsec >= 0 && ts.tv_nsec < 1000000000);
29-
struct timespec mono;
30-
assert(clock_gettime(CLOCK_MONOTONIC, &mono) == 0);
31-
assert(mono.tv_sec >= 0);
32-
assert(mono.tv_nsec >= 0 && mono.tv_nsec < 1000000000);
33-
}
34-
3524
static void test_gmtime_r(void) {
3625
print_tm(0);
3726
print_tm(1);
@@ -80,7 +69,6 @@ static void test_strftime(void) {
8069

8170
int main(void) {
8271
test_time();
83-
test_clock_gettime();
8472
test_gmtime_r();
8573
test_localtime_r();
8674
test_strftime();

0 commit comments

Comments
 (0)