Skip to content

Commit 8f5b755

Browse files
committed
test(windows): remove windows incompatible function for test when running on windows
1 parent f1556a9 commit 8f5b755

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ fn read_ips_from_file(
339339
#[cfg(unix)]
340340
fn adjust_ulimit_size(opts: &Opts) -> u64 {
341341
use rlimit::Resource;
342+
342343
if let Some(limit) = opts.ulimit {
343344
if Resource::NOFILE.set(limit, limit).is_ok() {
344345
detail!(
@@ -402,10 +403,14 @@ fn infer_batch_size(opts: &Opts, ulimit: u64) -> u16 {
402403

403404
#[cfg(test)]
404405
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};
406410
use std::net::Ipv4Addr;
407411

408412
#[test]
413+
#[cfg(unix)]
409414
fn batch_size_lowered() {
410415
let mut opts = Opts::default();
411416
opts.batch_size = 50_000;
@@ -415,6 +420,7 @@ mod tests {
415420
}
416421

417422
#[test]
423+
#[cfg(unix)]
418424
fn batch_size_lowered_average_size() {
419425
let mut opts = Opts::default();
420426
opts.batch_size = 50_000;
@@ -423,6 +429,7 @@ mod tests {
423429
assert!(batch_size == 3_000);
424430
}
425431
#[test]
432+
#[cfg(unix)]
426433
fn batch_size_equals_ulimit_lowered() {
427434
// because ulimit and batch size are same size, batch size is lowered
428435
// to ULIMIT - 100
@@ -433,6 +440,7 @@ mod tests {
433440
assert!(batch_size == 4_900);
434441
}
435442
#[test]
443+
#[cfg(unix)]
436444
fn batch_size_adjusted_2000() {
437445
// ulimit == batch_size
438446
let mut opts = Opts::default();
@@ -451,6 +459,7 @@ mod tests {
451459
}
452460

453461
#[test]
462+
#[cfg(unix)]
454463
fn test_high_ulimit_no_greppable_mode() {
455464
let mut opts = Opts::default();
456465
opts.batch_size = 10;

0 commit comments

Comments
 (0)