Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

factor test failures #1841

Closed
nbraud opened this issue Mar 18, 2021 · 1 comment · Fixed by #1842
Closed

factor test failures #1841

nbraud opened this issue Mar 18, 2021 · 1 comment · Fixed by #1842

Comments

@nbraud
Copy link
Contributor

nbraud commented Mar 18, 2021

The test I added in #1831 is sometimes exhibiting an invariant violation:

---- factor::tests::exponentiate_factors stdout ----
thread 'factor::tests::exponentiate_factors' panicked at 'assertion failed: `(left == right)`
  left: `Some((18451, 2))`,
 right: `None`', src/uu/factor/src/factor.rs:33:9
stack backtrace:
   0: rust_begin_unwind
   1: std::panicking::begin_panic_fmt
   2: uu_factor::factor::Decomposition::add
             at ./src/factor.rs:33:9
   3: uu_factor::factor::factor
             at ./src/factor.rs:209:25
   4: uu_factor::factor::tests::exponentiate_factors::prop
             at ./src/factor.rs:282:28
   5: <fn(A,B) .> T as quickcheck::tester::Testable>::result::{{closure}}
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:384:35
   6: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /build/rustc-1.49.0-src/library/std/src/panic.rs:322:9
   7: std::panicking::try::do_call
             at /build/rustc-1.49.0-src/library/std/src/panicking.rs:381:40
   8: __rust_try
   9: std::panicking::try
             at /build/rustc-1.49.0-src/library/std/src/panicking.rs:345:19
  10: std::panic::catch_unwind
             at /build/rustc-1.49.0-src/library/std/src/panic.rs:396:14
  11: quickcheck::tester::safe
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:415:5
  12: <fn(A,B) .> T as quickcheck::tester::Testable>::result
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:384:21
  13: quickcheck::tester::QuickCheck<G>::quicktest
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:134:19
  14: quickcheck::tester::QuickCheck<G>::quickcheck
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:176:36
  15: quickcheck::tester::quickcheck
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:196:5
  16: uu_factor::factor::tests::exponentiate_factors
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/lib.rs:65:21
  17: uu_factor::factor::tests::exponentiate_factors::{{closure}}
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/lib.rs:61:17
  18: core::ops::function::FnOnce::call_once
             at /build/rustc-1.49.0-src/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'factor::tests::exponentiate_factors' panicked at '[quickcheck] TEST FAILED (runtime error). Arguments: (Factors(RefCell { value: Decomposition([(18451, 1), (3, 1)]) }), 3)
Error: "assertion failed: `(left == right)`\n  left: `Some((18451, 2))`,\n right: `None`"', /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:178:28

I believe the bug was introduced when prototype PR #1571 was merged, or by one of the subsequent bug fixes.
Thanks a bunch @sylvestre for sending me the test failure you encountered.

@sylvestre
Copy link
Sponsor Contributor

I also see it

---- factor::tests::exponentiate_factors stdout ----
thread 'factor::tests::exponentiate_factors' panicked at 'assertion failed: `(left == right)`
  left: `Some((8237, 2))`,
 right: `None`', src/uu/factor/src/factor.rs:33:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'factor::tests::exponentiate_factors' panicked at '[quickcheck] TEST FAILED (runtime error). Arguments: (Factors(RefCell { value: Decomposition([(8237, 1), (17, 1), (5, 1)]) }), 3)
Error: "assertion failed: `(left == right)`\n  left: `Some((8237, 2))`,\n right: `None`"', /cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:178:28


failures:
    factor::tests::exponentiate_factors

https://github.com/uutils/coreutils/runs/2154792917

sylvestre pushed a commit that referenced this issue Mar 20, 2021
It was a draft PR, not ready for merging, and its premature inclusion
caused repeated issues, see 368f473 & friends.

Close #1841.

This reverts commits 3743a3e,
                     ce218e0, and
                     b7b0c76.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants