orf / gping

Ping, but with a graph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] test failure on i386 because of minor time difference

werdahias opened this issue · comments

pinger got accepted into debian yesterday. Because of that I noticed that the some of the tests fails on the i386 arch because of minor time differences:


running 10 tests
test linux::tests::test_linux_detection ... ok
test test::tests::alpine ... ok
test test::tests::android ... ok
test test::tests::debian ... ok
test test::tests::dragonfly ... FAILED
test test::tests::freebsd ... FAILED
test test::tests::netbsd ... FAILED
test test::tests::openbsd ... FAILED
test test::tests::ubuntu ... FAILED
test test::tests::macos ... FAILED

failures:

---- test::tests::dragonfly stdout ----
thread 'test::tests::dragonfly' panicked at 'assertion failed: `(left == right)`
  left: `"110.394ms"`,
 right: `"110.395ms"`: Failed at idx 3', src/test.rs:31:17
stack backtrace:
   0: rust_begin_unwind
             at /usr/src/rustc-1.63.0/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:142:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:181:5
   4: pinger::test::tests::test_parser
             at ./src/test.rs:31:17
   5: pinger::test::tests::dragonfly
             at ./src/test.rs:55:9
   6: pinger::test::tests::dragonfly::{{closure}}
             at ./src/test.rs:54:5
   7: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
   8: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- test::tests::freebsd stdout ----
thread 'test::tests::freebsd' panicked at 'assertion failed: `(left == right)`
  left: `"110.394ms"`,
 right: `"110.395ms"`: Failed at idx 3', src/test.rs:31:17
stack backtrace:
   0: rust_begin_unwind
             at /usr/src/rustc-1.63.0/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:142:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:181:5
   4: pinger::test::tests::test_parser
             at ./src/test.rs:31:17
   5: pinger::test::tests::freebsd
             at ./src/test.rs:50:9
   6: pinger::test::tests::freebsd::{{closure}}
             at ./src/test.rs:49:5
   7: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
   8: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- test::tests::netbsd stdout ----
thread 'test::tests::netbsd' panicked at 'assertion failed: `(left == right)`
  left: `"110.394ms"`,
 right: `"110.395ms"`: Failed at idx 3', src/test.rs:31:17
stack backtrace:
   0: rust_begin_unwind
             at /usr/src/rustc-1.63.0/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:142:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:181:5
   4: pinger::test::tests::test_parser
             at ./src/test.rs:31:17
   5: pinger::test::tests::netbsd
             at ./src/test.rs:65:9
   6: pinger::test::tests::netbsd::{{closure}}
             at ./src/test.rs:64:5
   7: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
   8: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- test::tests::openbsd stdout ----
thread 'test::tests::openbsd' panicked at 'assertion failed: `(left == right)`
  left: `"110.394ms"`,
 right: `"110.395ms"`: Failed at idx 3', src/test.rs:31:17
stack backtrace:
   0: rust_begin_unwind
             at /usr/src/rustc-1.63.0/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:142:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:181:5
   4: pinger::test::tests::test_parser
             at ./src/test.rs:31:17
   5: pinger::test::tests::openbsd
             at ./src/test.rs:60:9
   6: pinger::test::tests::openbsd::{{closure}}
             at ./src/test.rs:59:5
   7: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
   8: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- test::tests::ubuntu stdout ----
thread 'test::tests::ubuntu' panicked at 'assertion failed: `(left == right)`
  left: `"19.399ms"`,
 right: `"19.4ms"`: Failed at idx 2', src/test.rs:31:17
stack backtrace:
   0: rust_begin_unwind
             at /usr/src/rustc-1.63.0/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:142:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:181:5
   4: pinger::test::tests::test_parser
             at ./src/test.rs:31:17
   5: pinger::test::tests::ubuntu
             at ./src/test.rs:70:9
   6: pinger::test::tests::ubuntu::{{closure}}
             at ./src/test.rs:69:5
   7: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
   8: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- test::tests::macos stdout ----
thread 'test::tests::macos' panicked at 'assertion failed: `(left == right)`
  left: `"33.897ms"`,
 right: `"33.898ms"`: Failed at idx 2', src/test.rs:31:17
stack backtrace:
   0: rust_begin_unwind
             at /usr/src/rustc-1.63.0/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:142:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:181:5
   4: pinger::test::tests::test_parser
             at ./src/test.rs:31:17
   5: pinger::test::tests::macos
             at ./src/test.rs:45:9
   6: pinger::test::tests::macos::{{closure}}
             at ./src/test.rs:44:5
   7: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
   8: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.63.0/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    test::tests::dragonfly
    test::tests::freebsd
    test::tests::macos
    test::tests::netbsd
    test::tests::openbsd
    test::tests::ubuntu

test result: FAILED. 4 passed; 6 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s

This looks like a bug to me as all other arches don't have this problem. I'd suggest to maybe even add a [#cfg] macro to run the bsd/macos test only on their respective platform.

Thank you for reporting this!

I assume the issue is here:

let duration = Duration::from_micros((time * 1000f32) as u64);

I must confess that I don't know why this would return different values on a i386 machine, which leaves me a bit in the dark about how to fix this. I could always adjust the tests, but I'd really rather not.

I'll try and dig into it and see if I can find the root cause.

It could be just a timing issue as the tests fail because of a one microsecond difference. I don't know why this is the case though ( and why only on i386)

I believe I've fixed this in e44eb9d.

Are you able to test master on an i386, or should I push some kind of release?

thanks. I'm testing it right now on i386.

works fine, thanks. closing