Skip to content

Commit efa11ac

Browse files
committed
auto merge of #8819 : vadimcn/rust/unit-tests, r=brson
Some of the tests are failing. I've only managed to fix 'memory_map_file', the rest are up for grabs... Fixes #5261.
2 parents 89d0400 + 6538258 commit efa11ac

File tree

13 files changed

+86
-26
lines changed

13 files changed

+86
-26
lines changed

mk/tests.mk

+2-1
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,8 @@ $(foreach host,$(CFG_HOST_TRIPLES), \
869869
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
870870
$(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))
871871

872-
check-fast: tidy check-fast-H-$(CFG_BUILD_TRIPLE)
872+
check-fast: tidy check-fast-H-$(CFG_BUILD_TRIPLE) check-stage2-std check-stage2-extra
873+
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
873874

874875
define DEF_CHECK_FAST_FOR_H
875876

src/libstd/num/f32.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,10 @@ mod tests {
11421142
assert_eq!(infinity.abs_sub(&1f32), infinity);
11431143
assert_eq!(0f32.abs_sub(&neg_infinity), infinity);
11441144
assert_eq!(0f32.abs_sub(&infinity), 0f32);
1145+
}
1146+
1147+
#[test] #[ignore(cfg(windows))] // FIXME #8663
1148+
fn test_abs_sub_nowin() {
11451149
assert!(NaN.abs_sub(&-1f32).is_NaN());
11461150
assert!(1f32.abs_sub(&NaN).is_NaN());
11471151
}
@@ -1267,7 +1271,10 @@ mod tests {
12671271

12681272
assert_eq!(0f32.frexp(), (0f32, 0));
12691273
assert_eq!((-0f32).frexp(), (-0f32, 0));
1274+
}
12701275

1276+
#[test] #[ignore(cfg(windows))] // FIXME #8755
1277+
fn test_frexp_nowin() {
12711278
let inf: f32 = Float::infinity();
12721279
let neg_inf: f32 = Float::neg_infinity();
12731280
let nan: f32 = Float::NaN();

src/libstd/num/f64.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,10 @@ mod tests {
11921192
assert_eq!(infinity.abs_sub(&1f64), infinity);
11931193
assert_eq!(0f64.abs_sub(&neg_infinity), infinity);
11941194
assert_eq!(0f64.abs_sub(&infinity), 0f64);
1195+
}
1196+
1197+
#[test] #[ignore(cfg(windows))] // FIXME #8663
1198+
fn test_abs_sub_nowin() {
11951199
assert!(NaN.abs_sub(&-1f64).is_NaN());
11961200
assert!(1f64.abs_sub(&NaN).is_NaN());
11971201
}
@@ -1316,7 +1320,10 @@ mod tests {
13161320

13171321
assert_eq!(0f64.frexp(), (0f64, 0));
13181322
assert_eq!((-0f64).frexp(), (-0f64, 0));
1323+
}
13191324

1325+
#[test] #[ignore(cfg(windows))] // FIXME #8755
1326+
fn test_frexp_nowin() {
13201327
let inf: f64 = Float::infinity();
13211328
let neg_inf: f64 = Float::neg_infinity();
13221329
let nan: f64 = Float::NaN();

src/libstd/num/float.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,10 @@ mod tests {
11631163
assert_eq!(infinity.abs_sub(&1f), infinity);
11641164
assert_eq!(0f.abs_sub(&neg_infinity), infinity);
11651165
assert_eq!(0f.abs_sub(&infinity), 0f);
1166+
}
1167+
1168+
#[test] #[ignore(cfg(windows))] // FIXME #8663
1169+
fn test_abs_sub_nowin() {
11661170
assert!(NaN.abs_sub(&-1f).is_NaN());
11671171
assert!(1f.abs_sub(&NaN).is_NaN());
11681172
}
@@ -1288,7 +1292,10 @@ mod tests {
12881292

12891293
assert_eq!(0f.frexp(), (0f, 0));
12901294
assert_eq!((-0f).frexp(), (-0f, 0));
1295+
}
12911296

1297+
#[test] #[ignore(cfg(windows))] // FIXME #8755
1298+
fn test_frexp_nowin() {
12921299
let inf: float = Float::infinity();
12931300
let neg_inf: float = Float::neg_infinity();
12941301
let nan: float = Float::NaN();

src/libstd/os.rs

+42-25
Original file line numberDiff line numberDiff line change
@@ -1418,12 +1418,12 @@ pub fn page_size() -> uint {
14181418
pub fn page_size() -> uint {
14191419
#[fixed_stack_segment]; #[inline(never)];
14201420

1421-
unsafe {
1422-
let mut info = libc::SYSTEM_INFO::new();
1423-
libc::GetSystemInfo(&mut info);
1421+
unsafe {
1422+
let mut info = libc::SYSTEM_INFO::new();
1423+
libc::GetSystemInfo(&mut info);
14241424

1425-
return info.dwPageSize as uint;
1426-
}
1425+
return info.dwPageSize as uint;
1426+
}
14271427
}
14281428

14291429
pub struct MemoryMap {
@@ -1458,7 +1458,6 @@ pub enum MapError {
14581458
// Windows-specific errors
14591459
ErrUnsupProt,
14601460
ErrUnsupOffset,
1461-
ErrNeedRW,
14621461
ErrAlreadyExists,
14631462
ErrVirtualAlloc(uint),
14641463
ErrCreateFileMappingW(uint),
@@ -1477,7 +1476,6 @@ impl to_str::ToStr for MapError {
14771476
ErrUnknown(code) => fmt!("Unknown error=%?", code),
14781477
ErrUnsupProt => ~"Protection mode unsupported",
14791478
ErrUnsupOffset => ~"Offset in virtual memory mode is unsupported",
1480-
ErrNeedRW => ~"File mapping should be at least readable/writable",
14811479
ErrAlreadyExists => ~"File mapping for specified file already exists",
14821480
ErrVirtualAlloc(code) => fmt!("VirtualAlloc failure=%?", code),
14831481
ErrCreateFileMappingW(code) => fmt!("CreateFileMappingW failure=%?", code),
@@ -1542,6 +1540,10 @@ impl MemoryMap {
15421540
})
15431541
}
15441542
}
1543+
1544+
pub fn granularity() -> uint {
1545+
page_size()
1546+
}
15451547
}
15461548

15471549
#[cfg(unix)]
@@ -1617,21 +1619,21 @@ impl MemoryMap {
16171619
})
16181620
}
16191621
} else {
1620-
let dwDesiredAccess = match (readable, writable) {
1621-
(true, true) => libc::FILE_MAP_ALL_ACCESS,
1622-
(true, false) => libc::FILE_MAP_READ,
1623-
(false, true) => libc::FILE_MAP_WRITE,
1624-
_ => {
1625-
return Err(ErrNeedRW);
1626-
}
1622+
let dwDesiredAccess = match (executable, readable, writable) {
1623+
(false, true, false) => libc::FILE_MAP_READ,
1624+
(false, true, true) => libc::FILE_MAP_WRITE,
1625+
(true, true, false) => libc::FILE_MAP_READ | libc::FILE_MAP_EXECUTE,
1626+
(true, true, true) => libc::FILE_MAP_WRITE | libc::FILE_MAP_EXECUTE,
1627+
_ => return Err(ErrUnsupProt) // Actually, because of the check above,
1628+
// we should never get here.
16271629
};
16281630
unsafe {
16291631
let hFile = libc::get_osfhandle(fd) as HANDLE;
16301632
let mapping = libc::CreateFileMappingW(hFile,
16311633
ptr::mut_null(),
16321634
flProtect,
1633-
(len >> 32) as DWORD,
1634-
(len & 0xffff_ffff) as DWORD,
1635+
0,
1636+
0,
16351637
ptr::null());
16361638
if mapping == ptr::mut_null() {
16371639
return Err(ErrCreateFileMappingW(errno()));
@@ -1641,7 +1643,7 @@ impl MemoryMap {
16411643
}
16421644
let r = libc::MapViewOfFile(mapping,
16431645
dwDesiredAccess,
1644-
(offset >> 32) as DWORD,
1646+
((len as u64) >> 32) as DWORD,
16451647
(offset & 0xffff_ffff) as DWORD,
16461648
0);
16471649
match r as uint {
@@ -1655,6 +1657,19 @@ impl MemoryMap {
16551657
}
16561658
}
16571659
}
1660+
1661+
/// Granularity of MapAddr() and MapOffset() parameter values.
1662+
/// This may be greater than the value returned by page_size().
1663+
pub fn granularity() -> uint {
1664+
#[fixed_stack_segment]; #[inline(never)];
1665+
1666+
unsafe {
1667+
let mut info = libc::SYSTEM_INFO::new();
1668+
libc::GetSystemInfo(&mut info);
1669+
1670+
return info.dwAllocationGranularity as uint;
1671+
}
1672+
}
16581673
}
16591674
16601675
#[cfg(windows)]
@@ -1663,20 +1678,22 @@ impl Drop for MemoryMap {
16631678
#[fixed_stack_segment]; #[inline(never)];
16641679
16651680
use libc::types::os::arch::extra::{LPCVOID, HANDLE};
1681+
use libc::consts::os::extra::FALSE;
16661682
16671683
unsafe {
16681684
match self.kind {
1669-
MapVirtual => match libc::VirtualFree(self.data as *mut c_void,
1670-
self.len,
1671-
libc::MEM_RELEASE) {
1672-
0 => error!(fmt!("VirtualFree failed: %?", errno())),
1673-
_ => ()
1685+
MapVirtual => {
1686+
if libc::VirtualFree(self.data as *mut c_void,
1687+
self.len,
1688+
libc::MEM_RELEASE) == FALSE {
1689+
error!(fmt!("VirtualFree failed: %?", errno()));
1690+
}
16741691
},
16751692
MapFile(mapping) => {
1676-
if libc::UnmapViewOfFile(self.data as LPCVOID) != 0 {
1693+
if libc::UnmapViewOfFile(self.data as LPCVOID) == FALSE {
16771694
error!(fmt!("UnmapViewOfFile failed: %?", errno()));
16781695
}
1679-
if libc::CloseHandle(mapping as HANDLE) != 0 {
1696+
if libc::CloseHandle(mapping as HANDLE) == FALSE {
16801697
error!(fmt!("CloseHandle failed: %?", errno()));
16811698
}
16821699
}
@@ -2108,7 +2125,7 @@ mod tests {
21082125
}
21092126
21102127
let path = tmpdir().push("mmap_file.tmp");
2111-
let size = page_size() * 2;
2128+
let size = MemoryMap::granularity() * 2;
21122129
remove_file(&path);
21132130
21142131
let fd = unsafe {

src/libstd/rt/io/file.rs

+5
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ fn file_test_smoke_test_impl() {
165165
}
166166

167167
#[test]
168+
#[ignore(cfg(windows))] // FIXME #8810
168169
fn file_test_io_smoke_test() {
169170
file_test_smoke_test_impl();
170171
}
@@ -232,6 +233,7 @@ fn file_test_io_non_positional_read_impl() {
232233
}
233234

234235
#[test]
236+
#[ignore(cfg(windows))] // FIXME #8810
235237
fn file_test_io_non_positional_read() {
236238
file_test_io_non_positional_read_impl();
237239
}
@@ -264,6 +266,7 @@ fn file_test_io_seeking_impl() {
264266
}
265267
}
266268
#[test]
269+
#[ignore(cfg(windows))] // FIXME #8810
267270
fn file_test_io_seek_and_tell_smoke_test() {
268271
file_test_io_seeking_impl();
269272
}
@@ -295,6 +298,7 @@ fn file_test_io_seek_and_write_impl() {
295298
}
296299
}
297300
#[test]
301+
#[ignore(cfg(windows))] // FIXME #8810
298302
fn file_test_io_seek_and_write() {
299303
file_test_io_seek_and_write_impl();
300304
}
@@ -334,6 +338,7 @@ fn file_test_io_seek_shakedown_impl() {
334338
}
335339
}
336340
#[test]
341+
#[ignore(cfg(windows))] // FIXME #8810
337342
fn file_test_io_seek_shakedown() {
338343
file_test_io_seek_shakedown_impl();
339344
}

src/libstd/rt/io/net/tcp.rs

+5
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ mod test {
162162
}
163163

164164
#[test]
165+
#[ignore(cfg(windows))] // FIXME #8811
165166
fn connect_error() {
166167
do run_in_newsched_task {
167168
let mut called = false;
@@ -258,6 +259,7 @@ mod test {
258259
}
259260

260261
#[test]
262+
#[ignore(cfg(windows))] // FIXME #8811
261263
fn read_eof_twice_ip4() {
262264
do run_in_newsched_task {
263265
let addr = next_test_ip4();
@@ -280,6 +282,7 @@ mod test {
280282
}
281283

282284
#[test]
285+
#[ignore(cfg(windows))] // FIXME #8811
283286
fn read_eof_twice_ip6() {
284287
do run_in_newsched_task {
285288
let addr = next_test_ip6();
@@ -302,6 +305,7 @@ mod test {
302305
}
303306

304307
#[test]
308+
#[ignore(cfg(windows))] // FIXME #8811
305309
fn write_close_ip4() {
306310
do run_in_newsched_task {
307311
let addr = next_test_ip4();
@@ -331,6 +335,7 @@ mod test {
331335
}
332336

333337
#[test]
338+
#[ignore(cfg(windows))] // FIXME #8811
334339
fn write_close_ip6() {
335340
do run_in_newsched_task {
336341
let addr = next_test_ip6();

src/libstd/rt/io/support.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ mod test {
3333
use super::PathLike;
3434

3535
#[test]
36+
#[ignore(cfg(windows))] // FIXME #8812
3637
fn path_like_smoke_test() {
3738
let expected = "/home";
3839
let path = Path(expected);

src/libstd/rt/uv/file.rs

+2
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,13 @@ mod test {
405405
}
406406
407407
#[test]
408+
#[ignore(cfg(windows))] // FIXME #8814
408409
fn file_test_full_simple() {
409410
file_test_full_simple_impl();
410411
}
411412
412413
#[test]
414+
#[ignore(cfg(windows))] // FIXME #8814
413415
fn file_test_full_simple_sync() {
414416
file_test_full_simple_impl_sync();
415417
}

src/libstd/rt/uv/net.rs

+4
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ mod test {
600600
}
601601
602602
#[test]
603+
#[ignore(cfg(windows))] // FIXME #8815
603604
fn listen_ip4() {
604605
do run_in_bare_thread() {
605606
static MAX: int = 10;
@@ -674,6 +675,7 @@ mod test {
674675
}
675676
676677
#[test]
678+
#[ignore(cfg(windows))] // FIXME #8815
677679
fn listen_ip6() {
678680
do run_in_bare_thread() {
679681
static MAX: int = 10;
@@ -750,6 +752,7 @@ mod test {
750752
}
751753
752754
#[test]
755+
#[ignore(cfg(windows))] // FIXME #8815
753756
fn udp_recv_ip4() {
754757
do run_in_bare_thread() {
755758
static MAX: int = 10;
@@ -810,6 +813,7 @@ mod test {
810813
}
811814
812815
#[test]
816+
#[ignore(cfg(windows))] // FIXME #8815
813817
fn udp_recv_ip6() {
814818
do run_in_bare_thread() {
815819
static MAX: int = 10;

src/libstd/rt/uv/uvio.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1860,6 +1860,7 @@ fn test_read_read_read() {
18601860
}
18611861

18621862
#[test]
1863+
#[ignore(cfg(windows))] // FIXME #8816
18631864
fn test_udp_twice() {
18641865
do run_in_newsched_task {
18651866
let server_addr = next_test_ip4();
@@ -1994,6 +1995,7 @@ fn file_test_uvio_full_simple_impl() {
19941995
}
19951996

19961997
#[test]
1998+
#[ignore(cfg(windows))] // FIXME #8816
19971999
fn file_test_uvio_full_simple() {
19982000
do run_in_newsched_task {
19992001
file_test_uvio_full_simple_impl();

src/libstd/rt/uv/uvll.rs

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ fn handle_sanity_check() {
286286
}
287287

288288
#[test]
289+
#[ignore(cfg(windows))] // FIXME #8817
289290
#[fixed_stack_segment]
290291
#[inline(never)]
291292
fn request_sanity_check() {

src/libstd/unstable/dynamic_lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ mod test {
9090
use libc;
9191

9292
#[test]
93+
#[ignore(cfg(windows))] // FIXME #8818
9394
fn test_loading_cosine() {
9495
// The math library does not need to be loaded since it is already
9596
// statically linked in

0 commit comments

Comments
 (0)