Skip to content

Commit df477e2

Browse files
committed
test(windows): remove windows incompatible function for test when running on windows
1 parent 897e571 commit df477e2

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
@@ -340,6 +340,7 @@ fn read_ips_from_file(
340340
#[cfg(unix)]
341341
fn adjust_ulimit_size(opts: &Opts) -> u64 {
342342
use rlimit::Resource;
343+
343344
if let Some(limit) = opts.ulimit {
344345
if Resource::NOFILE.set(limit, limit).is_ok() {
345346
detail!(
@@ -403,10 +404,14 @@ fn infer_batch_size(opts: &Opts, ulimit: u64) -> u16 {
403404

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

409413
#[test]
414+
#[cfg(unix)]
410415
fn batch_size_lowered() {
411416
let mut opts = Opts::default();
412417
opts.batch_size = 50_000;
@@ -416,6 +421,7 @@ mod tests {
416421
}
417422

418423
#[test]
424+
#[cfg(unix)]
419425
fn batch_size_lowered_average_size() {
420426
let mut opts = Opts::default();
421427
opts.batch_size = 50_000;
@@ -424,6 +430,7 @@ mod tests {
424430
assert!(batch_size == 3_000);
425431
}
426432
#[test]
433+
#[cfg(unix)]
427434
fn batch_size_equals_ulimit_lowered() {
428435
// because ulimit and batch size are same size, batch size is lowered
429436
// to ULIMIT - 100
@@ -434,6 +441,7 @@ mod tests {
434441
assert!(batch_size == 4_900);
435442
}
436443
#[test]
444+
#[cfg(unix)]
437445
fn batch_size_adjusted_2000() {
438446
// ulimit == batch_size
439447
let mut opts = Opts::default();
@@ -452,6 +460,7 @@ mod tests {
452460
}
453461

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

0 commit comments

Comments
 (0)