@@ -339,6 +339,7 @@ fn read_ips_from_file(
339
339
#[ cfg( unix) ]
340
340
fn adjust_ulimit_size ( opts : & Opts ) -> u64 {
341
341
use rlimit:: Resource ;
342
+
342
343
if let Some ( limit) = opts. ulimit {
343
344
if Resource :: NOFILE . set ( limit, limit) . is_ok ( ) {
344
345
detail ! (
@@ -402,10 +403,14 @@ fn infer_batch_size(opts: &Opts, ulimit: u64) -> u16 {
402
403
403
404
#[ cfg( test) ]
404
405
mod tests {
405
- use crate :: { adjust_ulimit_size, infer_batch_size, parse_addresses, print_opening, Opts } ;
406
+ #[ cfg( unix) ]
407
+ use crate :: { adjust_ulimit_size, infer_batch_size} ;
408
+
409
+ use crate :: { parse_addresses, print_opening, Opts } ;
406
410
use std:: net:: Ipv4Addr ;
407
411
408
412
#[ test]
413
+ #[ cfg( unix) ]
409
414
fn batch_size_lowered ( ) {
410
415
let mut opts = Opts :: default ( ) ;
411
416
opts. batch_size = 50_000 ;
@@ -415,6 +420,7 @@ mod tests {
415
420
}
416
421
417
422
#[ test]
423
+ #[ cfg( unix) ]
418
424
fn batch_size_lowered_average_size ( ) {
419
425
let mut opts = Opts :: default ( ) ;
420
426
opts. batch_size = 50_000 ;
@@ -423,6 +429,7 @@ mod tests {
423
429
assert ! ( batch_size == 3_000 ) ;
424
430
}
425
431
#[ test]
432
+ #[ cfg( unix) ]
426
433
fn batch_size_equals_ulimit_lowered ( ) {
427
434
// because ulimit and batch size are same size, batch size is lowered
428
435
// to ULIMIT - 100
@@ -433,6 +440,7 @@ mod tests {
433
440
assert ! ( batch_size == 4_900 ) ;
434
441
}
435
442
#[ test]
443
+ #[ cfg( unix) ]
436
444
fn batch_size_adjusted_2000 ( ) {
437
445
// ulimit == batch_size
438
446
let mut opts = Opts :: default ( ) ;
@@ -451,6 +459,7 @@ mod tests {
451
459
}
452
460
453
461
#[ test]
462
+ #[ cfg( unix) ]
454
463
fn test_high_ulimit_no_greppable_mode ( ) {
455
464
let mut opts = Opts :: default ( ) ;
456
465
opts. batch_size = 10 ;
0 commit comments