Skip to content

Commit e6a79e3

Browse files
committed
Delete unportable test part
1 parent b8c6cd0 commit e6a79e3

3 files changed

Lines changed: 30 additions & 80 deletions

File tree

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

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -44,33 +44,7 @@ pub fn test_time_0() {
4444
assert!(((((*t2.borrow()) == (*t3.borrow())) as i32) != 0));
4545
assert!(((((*t3.borrow()) >= (*t1.borrow())) as i32) != 0));
4646
}
47-
pub fn test_clock_gettime_1() {
48-
let ts: Value<libcc2rs::Timespec> = Rc::new(RefCell::new(Default::default()));
49-
assert!(
50-
(((match nix::time::clock_gettime(nix::time::ClockId::CLOCK_REALTIME) {
51-
Ok(__ts) => {
52-
(ts.as_pointer()).with_mut(|__t| {
53-
*__t.tv_sec.borrow_mut() = __ts.tv_sec() as i64;
54-
*__t.tv_nsec.borrow_mut() = __ts.tv_nsec() as i64;
55-
});
56-
0
57-
}
58-
Err(__e) => {
59-
libcc2rs::cpp2rust_errno().write(__e as i32);
60-
-1
61-
}
62-
} == 0) as i32)
63-
!= 0)
64-
);
65-
assert!(((((*(*ts.borrow()).tv_sec.borrow()) > 1500000000_i64) as i32) != 0));
66-
assert!(
67-
(((((((*(*ts.borrow()).tv_nsec.borrow()) >= 0_i64) as i32) != 0)
68-
&& ((((*(*ts.borrow()).tv_nsec.borrow()) < 1000000000_i64) as i32) != 0))
69-
as i32)
70-
!= 0)
71-
);
72-
}
73-
pub fn print_tm_2(t: i64) {
47+
pub fn print_tm_1(t: i64) {
7448
let t: Value<i64> = Rc::new(RefCell::new(t));
7549
let tm: Value<libcc2rs::Tm> = Rc::new(RefCell::new(Default::default()));
7650
assert!(
@@ -106,19 +80,19 @@ pub fn print_tm_2(t: i64) {
10680
(*(*tm.borrow()).tm_isdst.borrow())
10781
);
10882
}
109-
pub fn test_gmtime_r_3() {
110-
({ print_tm_2(0_i64) });
111-
({ print_tm_2(1_i64) });
112-
({ print_tm_2(86399_i64) });
113-
({ print_tm_2(86400_i64) });
114-
({ print_tm_2(951782400_i64) });
115-
({ print_tm_2(951868799_i64) });
116-
({ print_tm_2(1704067199_i64) });
117-
({ print_tm_2(1704067200_i64) });
118-
({ print_tm_2(1721126096_i64) });
119-
({ print_tm_2(4102444800_i64) });
83+
pub fn test_gmtime_r_2() {
84+
({ print_tm_1(0_i64) });
85+
({ print_tm_1(1_i64) });
86+
({ print_tm_1(86399_i64) });
87+
({ print_tm_1(86400_i64) });
88+
({ print_tm_1(951782400_i64) });
89+
({ print_tm_1(951868799_i64) });
90+
({ print_tm_1(1704067199_i64) });
91+
({ print_tm_1(1704067200_i64) });
92+
({ print_tm_1(1721126096_i64) });
93+
({ print_tm_1(4102444800_i64) });
12094
}
121-
pub fn test_strftime_4() {
95+
pub fn test_strftime_3() {
12296
let t: Value<i64> = Rc::new(RefCell::new(1721126096_i64));
12397
let tm: Value<libcc2rs::Tm> = Rc::new(RefCell::new(Default::default()));
12498
assert!(
@@ -288,8 +262,7 @@ pub fn main() {
288262
}
289263
fn main_0() -> i32 {
290264
({ test_time_0() });
291-
({ test_clock_gettime_1() });
292-
({ test_gmtime_r_3() });
293-
({ test_strftime_4() });
265+
({ test_gmtime_r_2() });
266+
({ test_strftime_3() });
294267
return 0;
295268
}

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

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,7 @@ pub unsafe fn test_time_0() {
1414
assert!(((((t2) == (t3)) as i32) != 0));
1515
assert!(((((t3) >= (t1)) as i32) != 0));
1616
}
17-
pub unsafe fn test_clock_gettime_1() {
18-
let mut ts: ::libc::timespec = unsafe { std::mem::zeroed() };
19-
assert!(
20-
((((libc::clock_gettime(libc::CLOCK_REALTIME, (&mut ts as *mut ::libc::timespec))) == (0))
21-
as i32)
22-
!= 0)
23-
);
24-
assert!(((((ts.tv_sec) > (1500000000_i64)) as i32) != 0));
25-
assert!(
26-
(((((((ts.tv_nsec) >= (0_i64)) as i32) != 0)
27-
&& ((((ts.tv_nsec) < (1000000000_i64)) as i32) != 0)) as i32)
28-
!= 0)
29-
);
30-
}
31-
pub unsafe fn print_tm_2(mut t: i64) {
17+
pub unsafe fn print_tm_1(mut t: i64) {
3218
let mut tm: ::libc::tm = unsafe { std::mem::zeroed() };
3319
assert!(
3420
(((!((libc::gmtime_r(
@@ -56,19 +42,19 @@ pub unsafe fn print_tm_2(mut t: i64) {
5642
tm.tm_isdst,
5743
);
5844
}
59-
pub unsafe fn test_gmtime_r_3() {
60-
(unsafe { print_tm_2(0_i64) });
61-
(unsafe { print_tm_2(1_i64) });
62-
(unsafe { print_tm_2(86399_i64) });
63-
(unsafe { print_tm_2(86400_i64) });
64-
(unsafe { print_tm_2(951782400_i64) });
65-
(unsafe { print_tm_2(951868799_i64) });
66-
(unsafe { print_tm_2(1704067199_i64) });
67-
(unsafe { print_tm_2(1704067200_i64) });
68-
(unsafe { print_tm_2(1721126096_i64) });
69-
(unsafe { print_tm_2(4102444800_i64) });
45+
pub unsafe fn test_gmtime_r_2() {
46+
(unsafe { print_tm_1(0_i64) });
47+
(unsafe { print_tm_1(1_i64) });
48+
(unsafe { print_tm_1(86399_i64) });
49+
(unsafe { print_tm_1(86400_i64) });
50+
(unsafe { print_tm_1(951782400_i64) });
51+
(unsafe { print_tm_1(951868799_i64) });
52+
(unsafe { print_tm_1(1704067199_i64) });
53+
(unsafe { print_tm_1(1704067200_i64) });
54+
(unsafe { print_tm_1(1721126096_i64) });
55+
(unsafe { print_tm_1(4102444800_i64) });
7056
}
71-
pub unsafe fn test_strftime_4() {
57+
pub unsafe fn test_strftime_3() {
7258
let mut t: i64 = 1721126096_i64;
7359
let mut tm: ::libc::tm = unsafe { std::mem::zeroed() };
7460
assert!(
@@ -150,8 +136,7 @@ pub fn main() {
150136
}
151137
unsafe fn main_0() -> i32 {
152138
(unsafe { test_time_0() });
153-
(unsafe { test_clock_gettime_1() });
154-
(unsafe { test_gmtime_r_3() });
155-
(unsafe { test_strftime_4() });
139+
(unsafe { test_gmtime_r_2() });
140+
(unsafe { test_strftime_3() });
156141
return 0;
157142
}

‎tests/unit/sys_time.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ static void test_time(void) {
1313
assert(t3 >= t1);
1414
}
1515

16-
static void test_clock_gettime(void) {
17-
struct timespec ts;
18-
assert(clock_gettime(CLOCK_REALTIME, &ts) == 0);
19-
assert(ts.tv_sec > 1500000000);
20-
assert(ts.tv_nsec >= 0 && ts.tv_nsec < 1000000000);
21-
}
22-
2316
static void print_tm(time_t t) {
2417
struct tm tm;
2518
assert(gmtime_r(&t, &tm) != NULL);
@@ -60,7 +53,6 @@ static void test_strftime(void) {
6053

6154
int main(void) {
6255
test_time();
63-
test_clock_gettime();
6456
test_gmtime_r();
6557
test_strftime();
6658
return 0;

0 commit comments

Comments
 (0)