dust icon indicating copy to clipboard operation
dust copied to clipboard

test_apparent_size fails

Open photosheep opened this issue 1 year ago • 4 comments

Test fails on test_apparent_size using v0.9.0 release.

Running RUST_BACKTRACE=full cargo test --test test_exact_output results in the following.

running 6 tests
test test_main_long_paths ... ok
test test_main_basic ... ok
test test_unicode_directories ... ok
test test_substring_of_names_and_long_names ... ok
test test_main_multi_arg ... ok
test test_apparent_size ... FAILED

failures:

---- test_apparent_size stdout ----
thread 'test_apparent_size' panicked at tests/test_exact_output.rs:55:5:
assertion failed: valid_outputs.iter().any(|i| output.contains(i))
stack backtrace:
   0:     0x5566e5af7f3b - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h904171ce49b94501
   1:     0x5566e5b39060 - core::fmt::write::h944ec81cf6f613a4
   2:     0x5566e5b03f15 - std::io::Write::write_fmt::hdc915deaca3114f2
   3:     0x5566e5af7d24 - std::sys_common::backtrace::print::h5f79cd31e750bf5c
   4:     0x5566e5b1e88a - std::panicking::default_hook::{{closure}}::he9052d4561f0319a
   5:     0x5566e5b1e559 - std::panicking::default_hook::hec269740d7f00308
   6:     0x5566e5a6bee7 - test::test_main::{{closure}}::hb46f8d8cd50e8760
   7:     0x5566e5b1ee0c - std::panicking::rust_panic_with_hook::hde3a727d6a2965bc
   8:     0x5566e5af82e9 - std::panicking::begin_panic_handler::{{closure}}::h85c6c4bd7b037a17
   9:     0x5566e5af8156 - std::sys_common::backtrace::__rust_end_short_backtrace::hc243edd751069a84
  10:     0x5566e5b1e9d2 - rust_begin_unwind
  11:     0x5566e5a63625 - core::panicking::panic_fmt::hffa57b6ed0aeee2f
  12:     0x5566e5a636c3 - core::panicking::panic::h6b67a7405b9eb19b
  13:     0x5566e5a6a0e3 - test_exact_output::exact_output_test::hc344b9cdbaa08344
                               at /home/abuild/rpmbuild/BUILD/dust-0.9.0/tests/test_exact_output.rs:55:5
  14:     0x5566e5a658eb - test_exact_output::test_apparent_size::hcebd15e85b83b776
                               at /home/abuild/rpmbuild/BUILD/dust-0.9.0/tests/test_exact_output.rs:196:5
  15:     0x5566e5a6a2b7 - test_exact_output::test_apparent_size::{{closure}}::hae964b4721cce0a8
                               at /home/abuild/rpmbuild/BUILD/dust-0.9.0/tests/test_exact_output.rs:194:28
  16:     0x5566e5a65b26 - core::ops::function::FnOnce::call_once::h6686e927a3ee8938
                               at /home/abuild/rpmbuild/BUILD/rustc-1.75.0-src/library/core/src/ops/function.rs:250:5
  17:     0x5566e5a7132f - test::__rust_begin_short_backtrace::h907542a8f78e939c
  18:     0x5566e5a8080e - test::types::RunnableTest::run::hbe317bcfe441d193
  19:     0x5566e5a714cf - test::run_test_in_process::h4ab7d235bbb6f1c5
  20:     0x5566e5a72a3b - std::sys_common::backtrace::__rust_begin_short_backtrace::ha8250ba88a5d918f
  21:     0x5566e5a7d56a - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc1cae3b302bcb1d1
  22:     0x5566e5aee8b5 - std::sys::unix::thread::Thread::new::thread_start::ha174b5e5befd0804
  23:     0x7f69d228ff44 - start_thread
  24:     0x7f69d23184cc - __clone3
  25:                0x0 - <unknown>

photosheep avatar Jan 10 '24 02:01 photosheep

interesting,

You can see this build passing on CI: https://github.com/bootandy/dust/actions/workflows/CICD.yml - It runs on linux, mac and windows.

what OS are you using ?

bootandy avatar Jan 10 '24 18:01 bootandy

openSUSE Tumbleweed. Tests run correctly on outside of the packaging chroot, but fails inside. Using the print-to-stderr commit you've recently drafted shows the following stdout.

---- test_apparent_size stdout ----
output:  0B     ┌── a_file
 6B     ├── hello_file
44B   ┌─┴ many
62B ┌─┴ test_dir

photosheep avatar Jan 10 '24 23:01 photosheep

test_apparent_size is hard to test because different OSs do different things.

I have a feeling this might be because you have one less space than me.

my 'many' line is: 4.0K ┌─┴ many │ the characters 4.0K are 4 chars. 44B is 3 chars and so I require 1 more character.

Let me have a think about the best way to handle this.

bootandy avatar Jan 11 '24 00:01 bootandy

and thanks for being proactive with this:

Using the print-to-stderr commit you've recently drafted shows the following stdout.

bootandy avatar Jan 11 '24 00:01 bootandy

I think this will fix it : https://github.com/bootandy/dust/pull/364/commits/a72b168be98c46a488cc933fef09f1ddb2bbcef9

bootandy avatar Jan 29 '24 22:01 bootandy

https://github.com/bootandy/dust/pull/364 merged this PR - this will probably fix it

I'd be grateful if you could pull master and re-run the test

thank you.

bootandy avatar Jan 29 '24 22:01 bootandy

Tested with master in the build env and it works like a charm. Thank you so much!

photosheep avatar Jan 31 '24 00:01 photosheep