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