Skip to content

Improve test compatibility for 16K block size filesystems #504

@wszqkzqk

Description

@wszqkzqk

When building dust on systems using 16K filesystem block sizes, (tested on Arch Linux for Loong64) multiple tests fail during cargo test due to hardcoded 4K block size expectations. The test failures occur because Dust's output reflects actual disk usage (16K blocks), while tests expect 4K-based values.

Affected Tests

  • test_main_basic
  • test_main_long_paths
  • test_main_multi_arg
  • test_substring_of_names_and_long_names

Error Snippet:

failures:

---- test_substring_of_names_and_long_names stdout ----
output(stdout):
 0B   ┌── long_dir_name_what_a_very_long_dir_name_what_happens_when_this_goes_..
16K   │ ┌── hello
16K   ├─┴ dir
16K   ├── dir_name_clash
16K   │ ┌── hello
16K   ├─┴ dir_substring
48K ┌─┴ test_dir2

does not contain any of:
0B   ┌── long_dir_name_what_a_very_long_dir_name_what_happens_when_this_goes..
4.0K   │ ┌── hello
4.0K   ├─┴ dir
4.0K   ├── dir_name_clash
4.0K   │ ┌── hello
4.0K   ├─┴ dir_substring
 12K ┌─┴ test_dir2

0B   ┌── long_dir_name_what_a_very_long_dir_name_what_happens_when_this_goes..
4.0K   ├── dir_name_clash
4.0K   │ ┌── hello
8.0K   ├─┴ dir
4.0K   │ ┌── hello
8.0K   ├─┴ dir_substring
 24K ┌─┴ test_dir2

thread 'test_substring_of_names_and_long_names' panicked at tests/test_exact_output.rs:83:5:
assertion failed: will_fail
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- test_main_multi_arg stdout ----
output(stdout):
 0B     ┌── a_file    │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   0%
16K     ├── hello_file│██████████████████████████████████████████████████ │ 100%
16K   ┌─┴ many        │██████████████████████████████████████████████████ │ 100%
16K ┌─┴ test_dir      │██████████████████████████████████████████████████ │ 100%

does not contain any of:
0B     ┌── a_file    │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   0%
4.0K     ├── hello_file│█████████████████████████████████████████████████ │ 100%
4.0K   ┌─┴ many        │█████████████████████████████████████████████████ │ 100%
4.0K ┌─┴ test_dir      │█████████████████████████████████████████████████ │ 100%

0B     ┌── a_file    │                ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   0%
4.0K     ├── hello_file│                ░░░░░░░░░░░░░░░░█████████████████ │  33%
8.0K   ┌─┴ many        │                █████████████████████████████████ │  67%
 12K ┌─┴ test_dir      │█████████████████████████████████████████████████ │ 100%

thread 'test_main_multi_arg' panicked at tests/test_exact_output.rs:83:5:
assertion failed: will_fail

---- test_main_basic stdout ----
output(stdout):
 0B     ┌── a_file    │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   0%
16K     ├── hello_file│██████████████████████████████████████████████████ │ 100%
16K   ┌─┴ many        │██████████████████████████████████████████████████ │ 100%
16K ┌─┴ test_dir      │██████████████████████████████████████████████████ │ 100%

does not contain any of:
0B     ┌── a_file    │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   0%
4.0K     ├── hello_file│█████████████████████████████████████████████████ │ 100%
4.0K   ┌─┴ many        │█████████████████████████████████████████████████ │ 100%
4.0K ┌─┴ test_dir      │█████████████████████████████████████████████████ │ 100%

0B     ┌── a_file    │                ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   0%
4.0K     ├── hello_file│                ░░░░░░░░░░░░░░░░█████████████████ │  33%
8.0K   ┌─┴ many        │                █████████████████████████████████ │  67%
 12K ┌─┴ test_dir      │█████████████████████████████████████████████████ │ 100%

thread 'test_main_basic' panicked at tests/test_exact_output.rs:83:5:
assertion failed: will_fail

---- test_main_long_paths stdout ----
output(stdout):
 0B     ┌── /tmp/test_dir/many/a_file    │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   0%
16K     ├── /tmp/test_dir/many/hello_file│███████████████████████████████ │ 100%
16K   ┌─┴ /tmp/test_dir/many             │███████████████████████████████ │ 100%
16K ┌─┴ /tmp/test_dir                    │███████████████████████████████ │ 100%

does not contain any of:
0B     ┌── /tmp/test_dir/many/a_file    │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   0%
4.0K     ├── /tmp/test_dir/many/hello_file│██████████████████████████████ │ 100%
4.0K   ┌─┴ /tmp/test_dir/many             │██████████████████████████████ │ 100%
4.0K ┌─┴ /tmp/test_dir                    │██████████████████████████████ │ 100%

0B     ┌── /tmp/test_dir/many/a_file    │         ░░░░░░░░░░░░░░░░░░░░█ │   0%
4.0K     ├── /tmp/test_dir/many/hello_file│         ░░░░░░░░░░███████████ │  33%
8.0K   ┌─┴ /tmp/test_dir/many             │         █████████████████████ │  67%
 12K ┌─┴ /tmp/test_dir                    │██████████████████████████████ │ 100%

thread 'test_main_long_paths' panicked at tests/test_exact_output.rs:83:5:
assertion failed: will_fail


failures:
    test_main_basic
    test_main_long_paths
    test_main_multi_arg
    test_substring_of_names_and_long_names

It may be better to adapt to 16K block size in tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions