From d1d5527e00d3cf50009abb682b523b316a4503c7 Mon Sep 17 00:00:00 2001 From: Bohdan Mart Date: Sat, 17 Dec 2022 00:50:22 +0200 Subject: [PATCH 1/4] Added unit tests and Github work flows to run tests and lints --- .github/workflows/check-and-lint.yaml | 81 ++++++++++ .github/workflows/test.yaml | 76 +++++++++ .gitignore | 10 +- Cargo.lock | 211 +++++++++++++++++++++++- Cargo.toml | 12 +- src/lib.rs | 3 + src/tests.rs | 225 ++++++++++++++++++++++++++ test-data/README.md | 23 +++ test-data/pre-created/b23_rand | 1 + test-data/pre-created/b23_zero | Bin 0 -> 23 bytes test-data/pre-created/b4000_rand | Bin 0 -> 4000 bytes test-data/pre-created/b4000_zero | Bin 0 -> 4000 bytes test-data/pre-created/b4096_rand | Bin 0 -> 4096 bytes test-data/pre-created/b4096_zero | Bin 0 -> 4096 bytes test-data/pre-created/b512_rand | 1 + test-data/pre-created/b512_zero | Bin 0 -> 512 bytes test-data/pre-created/b8000_rand | Bin 0 -> 8000 bytes test-data/pre-created/b8192_rand | Bin 0 -> 8192 bytes test-data/pre-created/b8192_zero | Bin 0 -> 8192 bytes test-data/pre-created/rand_1000 | Bin 0 -> 1000 bytes test-data/pre-created/text1.txt | 1 + test-data/pre-created/text2.txt | 1 + 22 files changed, 641 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/check-and-lint.yaml create mode 100644 .github/workflows/test.yaml create mode 100644 src/tests.rs create mode 100644 test-data/README.md create mode 100644 test-data/pre-created/b23_rand create mode 100644 test-data/pre-created/b23_zero create mode 100644 test-data/pre-created/b4000_rand create mode 100644 test-data/pre-created/b4000_zero create mode 100644 test-data/pre-created/b4096_rand create mode 100644 test-data/pre-created/b4096_zero create mode 100644 test-data/pre-created/b512_rand create mode 100644 test-data/pre-created/b512_zero create mode 100644 test-data/pre-created/b8000_rand create mode 100644 test-data/pre-created/b8192_rand create mode 100644 test-data/pre-created/b8192_zero create mode 100644 test-data/pre-created/rand_1000 create mode 100644 test-data/pre-created/text1.txt create mode 100644 test-data/pre-created/text2.txt diff --git a/.github/workflows/check-and-lint.yaml b/.github/workflows/check-and-lint.yaml new file mode 100644 index 0000000..4c73eb4 --- /dev/null +++ b/.github/workflows/check-and-lint.yaml @@ -0,0 +1,81 @@ +on: + pull_request: + push: + branches: + - '**' + +name: Check and Lint + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Cache dependencies + uses: actions/cache@v3 + env: + cache-name: cache-dependencies + with: + path: | + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/.cargo/bin + ~/.cargo/registry/index + ~/.cargo/registry/cache +# target + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} + - uses: actions-rs/cargo@v1 + with: + command: check + + fmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - run: rustup component add rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + override: true + - name: Cache dependencies + uses: actions/cache@v3 + env: + cache-name: cache-dependencies + with: + path: | + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/.cargo/bin + ~/.cargo/registry/index + ~/.cargo/registry/cache +# target + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} + - uses: actions-rs/clippy-check@v1 + continue-on-error: true # currently Clippy would fail. TODO fix warnings. + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features + name: Clippy Output diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..b41d66c --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,76 @@ +on: + pull_request: + push: + branches: + - '**' + +#name: Test with Code Coverage +name: Unit Tests + +jobs: + test: + name: Test + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, windows-latest, macos-11] + arch: [x86_64] + include: + # for windows also test 32-bit binaries, + # to be sure that win-api integration is correct. + - os: windows-latest + arch: i686 + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable-${{ matrix.arch }} + override: true + - name: Cache dependencies + uses: actions/cache@v3 + env: + cache-name: cache-dependencies-test + with: + path: | + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/.cargo/bin + ~/.cargo/registry/index + ~/.cargo/registry/cache +# target + key: ${{ runner.os }}-${{ matrix.arch }}-build-v2-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} + - name: Install cargo-suity + run: cargo install cargo-suity + - name: Run tests + run: cargo suity + - name: Upload raw Unit Test results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Unit Test Results (${{ matrix.os }}) + path: ./test-results/* + publish-test-results: + name: "Publish Unit Tests Results" + needs: test + runs-on: ubuntu-latest + if: always() + + steps: + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + + - name: Publish Unit Test Results + uses: EnricoMi/publish-unit-test-result-action@v1 + with: + files: "artifacts/**/*.xml" + +# orginal example used code coverage and tests reports, but disable it for now +# https://github.com/BamPeers/rust-ci-github-actions-workflow/blob/main/.github/workflows/test.yaml +# https://dev.to/bampeers/rust-ci-with-github-actions-1ne9 +# if we would use code coverage, not sure how it should work on cross platform tests, +# perhaps need to gather coverage files across whole matrix into single post-processing step. +# and test results as XML requires nightly. diff --git a/.gitignore b/.gitignore index 1a61dfb..ce575dc 100644 --- a/.gitignore +++ b/.gitignore @@ -74,4 +74,12 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk -# End of https://www.gitignore.io/api/linux,macos,windows \ No newline at end of file +# End of https://www.gitignore.io/api/linux,macos,windows + +# Jetrbrains IDE (Intellij RUST/Clion/Idea) +.idea/ + +/test-data/long-path + +/test-results/ +/.vscode/ diff --git a/Cargo.lock b/Cargo.lock index cacc42d..df15fb2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,6 +55,26 @@ dependencies = [ "vec_map", ] +[[package]] +name = "const_format" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0936ffe6d0c8d6a51b3b0a73b2acbe925d786f346cf45bfddc8341d79fb7dc8a" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef196d5d972878a48da7decb7686eded338b4858fbabeed513d63a7c98b2b82d" +dependencies = [ + "proc-macro2 1.0.33", + "quote 1.0.10", + "unicode-xid 0.2.2", +] + [[package]] name = "crossbeam-channel" version = "0.5.1" @@ -101,11 +121,14 @@ dependencies = [ [[package]] name = "dirstat-rs" -version = "0.3.7" +version = "0.3.8" dependencies = [ "atty", + "const_format", + "path-absolutize", "pretty-bytes", "rayon", + "rstest", "serde", "serde_json", "structopt", @@ -120,6 +143,101 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "futures" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" + +[[package]] +name = "futures-executor" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" + +[[package]] +name = "futures-macro" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +dependencies = [ + "proc-macro2 1.0.33", + "quote 1.0.10", + "syn 1.0.82", +] + +[[package]] +name = "futures-sink" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" + +[[package]] +name = "futures-task" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" + +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" + +[[package]] +name = "futures-util" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "getopts" version = "0.2.21" @@ -165,6 +283,12 @@ version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + [[package]] name = "memoffset" version = "0.6.5" @@ -184,6 +308,42 @@ dependencies = [ "libc", ] +[[package]] +name = "once_cell" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" + +[[package]] +name = "path-absolutize" +version = "3.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3de4b40bd9736640f14c438304c09538159802388febb02c8abaae0846c1f13" +dependencies = [ + "path-dedot", +] + +[[package]] +name = "path-dedot" +version = "3.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d611d5291372b3738a34ebf0d1f849e58b1dcc1101032f76a346eaa1f8ddbb5b" +dependencies = [ + "once_cell", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pretty-bytes" version = "0.2.2" @@ -255,6 +415,40 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "rstest" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c9dc66cc29792b663ffb5269be669f1613664e69ad56441fdb895c2347b930" +dependencies = [ + "futures", + "futures-timer", + "rstest_macros", + "rustc_version", +] + +[[package]] +name = "rstest_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5015e68a0685a95ade3eee617ff7101ab6a3fc689203101ca16ebc16f2b89c66" +dependencies = [ + "cfg-if", + "proc-macro2 1.0.33", + "quote 1.0.10", + "rustc_version", + "syn 1.0.82", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + [[package]] name = "ryu" version = "1.0.9" @@ -267,6 +461,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "semver" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" + [[package]] name = "serde" version = "1.0.131" @@ -298,6 +498,15 @@ dependencies = [ "serde", ] +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] + [[package]] name = "strsim" version = "0.8.0" diff --git a/Cargo.toml b/Cargo.toml index 2745fa6..0e6b8d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dirstat-rs" -version = "0.3.7" +version = "0.3.8" authors = ["scullionw "] edition = "2018" license = "MIT" @@ -19,12 +19,19 @@ atty = "0.2.14" serde = { version = "1.0.131", features = ["derive"] } serde_json = "1.0.73" +[dev-dependencies] +const_format = "0.2.23" +# TODO update to 0.16 when it is released. +# It fixes https://github.com/la10736/rstest/issues/158, which is not showtopper, but minor annoyance. +rstest = "0.15.0" + [target.'cfg(windows)'.dependencies] winapi-util = "0.1.2" +path-absolutize = "3.0.12" [target.'cfg(windows)'.dependencies.winapi] version = "0.3.7" -features = ["winerror"] +features = ["winerror", "impl-default", "ioapiset", "winioctl"] [profile.release] lto = 'fat' @@ -35,3 +42,4 @@ incremental = false bench = false path = "src/bin/main.rs" name = "ds" + diff --git a/src/lib.rs b/src/lib.rs index 283d5cf..bd2b2fb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,9 @@ use std::path::Path; mod ffi; +#[cfg(test)] +mod tests; + #[derive(Serialize)] pub struct DiskItem { pub name: String, diff --git a/src/tests.rs b/src/tests.rs new file mode 100644 index 0000000..7a56506 --- /dev/null +++ b/src/tests.rs @@ -0,0 +1,225 @@ +//! Be aware that tests are run in parallel. For this reason we must be sure to use +//! separate dirs for different cases. +#![allow(dead_code)] + +use crate::{DiskItem, FileInfo}; +// warn: don't remove `as &str` after macro invocation. +// It breaks type checker in Intellij Rust IDE +use const_format::concatcp; +use rstest::*; +use std::fs::File; +use std::io::Write; +use std::panic; +use std::path::Path; + +/// Base directory for files used in tests. +/// +/// Be aware that rust runs tests in parallel, so tests should use different dirs. +const TEST_DATA_DIR: &str = "./test-data/"; + +/// Path for test case for very long path. +const LONG_PATH_DIR: &str = "long-path/"; + +//noinspection SpellCheckingInspection +const PATH_1: &str = "lll1/llllllll/llllllllllllllll/llllllllllllll/lllllllllllll/oooooo\ +oooooooo/oooooooooooooooo/nnnnnnnnn/nnnnnnnnnn/nnnnnnnn/nnnnnn/gggggggggg/p/a/tttt\ +tttttttttt/ttttttttttt/ttttttttttttttt/ttttttttt/tttthhh/2222222222/22222222222/222222222222/\ +3333333333333/33333333/33333333333/33333333333/333333333/33333333/44444444/44444444444444444/\ +5555555/55555555555/55555555/5555555555/5555555/5555555/555555/555555555/66666666666666666666/\ +77777777/7777777777/7777777777777/77777777777/7777777777/77777777/7777777/77777777/8888888888/\ +99999999/999999/99999999/99999999999/99999999/999999999/9999999999/"; + +const PATH_1_FULL: &str = concatcp!(TEST_DATA_DIR, LONG_PATH_DIR, PATH_1) as &str; +//noinspection SpellCheckingInspection +const PATH_2: &str = "lll2/llllllll/llllllllllllllll/llllllllllllll/lllllllllllll/oooooo\ +oooooooo/oooooooooooooooo/nnnnnnnnn/nnnnnnnnnn/nnnnnnnn/nnnnnn/gggggggggg/p/a/tttt\ +tttttttttt/ttttttttttt/ttttttttttttttt/ttttttttt/tttthhh/2222222222/22222222222/222222222222/\ +3333333333333/33333333/33333333333/33333333333/333333333/33333333/44444444/44444444444444444/\ +5555555/55555555555/55555555/5555555555/5555555/5555555/555555/555555555/66666666666666666666/\ +77777777/7777777777/7777777777777/77777777777/7777777777/77777777/7777777/77777777/8888888888/\ +99999999/999999/99999999/99999999999/99999999/999999999/9999999999/"; + +const PATH_2_FULL: &str = concatcp!(TEST_DATA_DIR, LONG_PATH_DIR, PATH_2) as &str; + +const TEST_PRE_CREATED_DIR: &str = concatcp!(TEST_DATA_DIR, "pre-created/"); + +#[test] +#[cfg(not(windows))] +fn test_max_path() { + // do not rename it into `_` it would cause immediate destruction after creation + let _guard = CleanUpGuard { + path: concatcp!(TEST_DATA_DIR, LONG_PATH_DIR) as &str, + }; + + // Given + create_dir(PATH_1_FULL); + create_dir(PATH_2_FULL); + create_file(&concatcp!(PATH_1_FULL, "file.bin"), 4096); + create_file(&concatcp!(PATH_2_FULL, "file.bin"), 8192); + + // When + let test_path = Path::new(concatcp!(TEST_DATA_DIR, LONG_PATH_DIR) as &str); + let result = FileInfo::from_path(test_path, true); + + // Then + if let Result::Ok(FileInfo::Directory { volume_id }) = result { + let result = DiskItem::from_analyze(test_path, true, volume_id); + let result = result.expect("Must collect data"); + assert_eq!(result.disk_size, 4096 + 8192); + let children = result.children.unwrap(); + assert_eq!(children.len(), 2); + assert_eq!(children[0].disk_size, 8192); + assert_eq!(children[1].disk_size, 4096); + } else { + panic!("Can not get file info"); + } +} + +#[rstest] +#[case("", 53782)] +#[case("b23_rand", 23)] +#[case("b23_zero", 23)] +#[case("b4000_rand", 4000)] +#[case("b4000_zero", 4000)] +#[case("b4096_rand", 4096)] +#[case("b4096_zero", 4096)] +#[case("b512_rand", 512)] +#[case("b512_zero", 512)] +#[case("b8000_rand", 8000)] +#[case("b8192_rand", 8192)] +#[case("b8192_zero", 8192)] +#[case("rand_1000", 1000)] +#[case("text1.txt", 2088)] +#[case("text2.txt", 9048)] +fn test_files_logical_size(#[case] file: &str, #[case] size: u64) { + let file = String::from(TEST_PRE_CREATED_DIR) + file; + assert_size(&file, false, size); +} + +#[rstest] +// Can't test top dir, as compressed files would mess the picture so no test for "" +#[cfg_attr(windows, case("b23_rand", 23))] +#[cfg_attr(windows, case("b23_zero", 23))] +#[cfg_attr(windows, case("b512_rand", 512))] +#[cfg_attr(windows, case("b512_zero", 512))] +// TODO this is really FS dependant. On WSL and ntfs it all would be 0. With Ext4 it would be 4096 +// either add FS specific logic, or don't assert this. I guss second option, as otherwise tests +// aren't reproducible. +// #[cfg_attr(not(windows),case("b23_rand", 0))] +// #[cfg_attr(not(windows),case("b23_zero", 0))] +// #[cfg_attr(not(windows),case("b512_rand", 0))] +// #[cfg_attr(not(windows),case("b512_zero", 0))] +#[cfg_attr(not(windows), case("b4000_rand", 4096))] +#[cfg_attr(not(windows), case("b4000_zero", 4096))] +#[case("b4096_rand", 4096)] +#[case("b4096_zero", 4096)] +#[cfg_attr(not(windows), case("b8000_rand", 8192))] +#[case("b8192_rand", 8192)] +#[case("b8192_zero", 8192)] +#[cfg_attr(not(windows), case("rand_1000", 4096))] +#[cfg_attr(not(windows), case("text1.txt", 4096))] +#[cfg_attr(not(windows), case("text2.txt", 12288))] +fn test_files_physical_size(#[case] file: &str, #[case] size: u64) { + let file = String::from(TEST_PRE_CREATED_DIR) + file; + assert_size(&file, true, size); +} + +#[allow(non_snake_case)] +#[test] +fn test_file_size_8KiB() { + const DIR: &str = concatcp!(TEST_DATA_DIR, "test_file_size/") as &str; + // do not rename it into `_` it would cause immediate destrucion after creation + let _guard = CleanUpGuard { path: DIR }; + + // Given + // Such sizes is selected to be close to filesystem sector size, and to be maximally universal + // event for FS-es with sector as bif as 8KiB + create_file(&concatcp!(DIR, "foo/file.bin") as &str, 8192); + create_file(&concatcp!(DIR, "bar/file.bin") as &str, 8192 - 5); + + // When calculating with apparent size + let test_path = Path::new(DIR); + let result = FileInfo::from_path(test_path, true); + + // Then + if let Result::Ok(FileInfo::Directory { volume_id }) = result { + let result = DiskItem::from_analyze(test_path, true, volume_id); + let result = result.expect("Must collect data"); + if cfg!(not(windows)) { + // TODO this check fails fon windows currently. + assert_eq!(result.disk_size, 8192 + 8192); + } + let children = result.children.unwrap(); + assert_eq!(children.len(), 2); + // Both dirs should be rounded to sector size + assert_eq!(children[0].disk_size, 8192); + if cfg!(not(windows)) { + // TODO this check fails fon windows currently. + assert_eq!(children[1].disk_size, 8192); + } + } else { + panic!("Can not get file info"); + } + + // When calculating withOUT apparent size + let result = FileInfo::from_path(test_path, false); + + // Then + if let Result::Ok(FileInfo::Directory { volume_id }) = result { + let result = DiskItem::from_analyze(test_path, false, volume_id); + let result = result.expect("Must collect data"); + assert_eq!(result.disk_size, 8192 + 8192 - 5); + let children = result.children.unwrap(); + assert_eq!(children.len(), 2); + // Both dirs should be rounded to sector size + assert_eq!(children[0].disk_size, 8192); + assert_eq!(children[1].disk_size, 8192 - 5); + } else { + panic!("Can not get file info"); + } +} + +// Helper functions and cleanup code goes next + +fn create_dir(dir_path: &str) { + std::fs::create_dir_all(dir_path).unwrap(); +} + +fn create_file(file_path: &str, size: usize) { + let content = vec![0u8; size]; + let file_path = Path::new(file_path); + // ensure parent + std::fs::create_dir_all(file_path.parent().unwrap()).unwrap(); + + let mut file = File::create(file_path).unwrap(); + file.write(&content).unwrap(); +} + +fn assert_size(file_name: &str, apparent: bool, expected_size: u64) { + if let FileInfo::Directory { volume_id } = + FileInfo::from_path(&Path::new(TEST_DATA_DIR), apparent).unwrap() + { + let result = DiskItem::from_analyze(Path::new(file_name), apparent, volume_id) + .expect("Shoud be able to get file size"); + + assert_eq!( + expected_size, result.disk_size, + "Item {:?} size doesn't match expected {}, got {}", + file_name, expected_size, result.disk_size + ); + } else { + panic!("No test-data dir present"); + } +} + +/// Used to clean up test folder after test runs. +struct CleanUpGuard { + path: &'static str, +} + +impl Drop for CleanUpGuard { + fn drop(&mut self) { + // Teardown + std::fs::remove_dir_all(Path::new(self.path)).unwrap(); + } +} diff --git a/test-data/README.md b/test-data/README.md new file mode 100644 index 0000000..00fc685 --- /dev/null +++ b/test-data/README.md @@ -0,0 +1,23 @@ +# This directory is scratch area for all tests + +Tests would create and measure size of files inside this dir. +Tests won't touch files outside it. + +## Subdirs +### `long-path` + +This dir isn't checked into the GIT. It's files would be automatically +created by tests. It would test if dirstat can handle really long file path. + +It's not checked into the git so it won't be in repo causing confusion, +and GIT client on Windows can have troubles checking it out. It requires +special option in git config configured globally, and it can cause compatibility issues. + +### `pre-created` + +This dir contains pre created files of known size. +Files are inside git, to allow them having unchanging compressibility, so +tests that check compressed files would have predictable results. + +Please be advised not to add new-lines to text files, as newline can be checked out differently on Unix and Windows, +causing files to have different size, which would mess with tests. diff --git a/test-data/pre-created/b23_rand b/test-data/pre-created/b23_rand new file mode 100644 index 0000000..5461462 --- /dev/null +++ b/test-data/pre-created/b23_rand @@ -0,0 +1 @@ +L\E&8XqbiM' \ No newline at end of file diff --git a/test-data/pre-created/b23_zero b/test-data/pre-created/b23_zero new file mode 100644 index 0000000000000000000000000000000000000000..3684b5c3682622274cac533e96fa1b0ae36b149f GIT binary patch literal 23 KcmZQzzzP5W7XSeO literal 0 HcmV?d00001 diff --git a/test-data/pre-created/b4000_rand b/test-data/pre-created/b4000_rand new file mode 100644 index 0000000000000000000000000000000000000000..9dddeb2f7e6f1957a75eb9a8cd5e912bcd32bfdc GIT binary patch literal 4000 zcmV;R4`1-}!IY3X!Y=pXT84Q*jGzB!A=SD9N26DL2qr^L`j4lrnI|IKYWwv}RhK`l zKtD3joi11?hG|y_c)5Wq^pYS;OBa5yV-u5}1U6Dn(8CL*j9a4F){2z@Z0W$mkh?yr%Hm|c zN6G(#_5zadMbIo_27ix%VW3OVuGQmEt6PfNmF3%NL9LV105fm6H7Ph-=Meg~LtEJlXl|^s!jaPQ8p|wQ(b_?oAV# z%ozhmjxj~E*7iNfndsWT4W(7g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literal 0 HcmV?d00001 diff --git a/test-data/pre-created/b4096_rand b/test-data/pre-created/b4096_rand new file mode 100644 index 0000000000000000000000000000000000000000..4c3dfdfc9811337406419385e0fef139272e7735 GIT binary patch literal 4096 zcmV+b5dZH|;I5`&FBDw%iVHRsJB`STLs4^p4@#Hl7bQqr^V$~NBiP6FXttDJ52t&s zP0H}RAnK^U8Xj-MZ_wWdozF^UNikz}b!2lrWGz0IVf^vZ`9u!uXWO%znbEf^#pfAY4 z?x7=IhkXE7KDd$L4w4CQ7${D6pHNu|2IEz4+PIJD+7-Ce7J^s^@pdSPr_WpQy`iHp zl_ezxdVb(q3w~#v62l8#(@pL0VQoW%d0Dv?{d(qRf)w4B%L5=XEl7hUdV^pRc>b}1=Yw4hLMaCN?Nj_XX3HvX$4`cJ^seMc_e}iy(@C+(Yq*O|-^GT4X2O6!H-46Yuv}`Q z63Nf)$xj7GV6>2c5Piijv8u`xNAg8?``Z~_65a`r73~!ZTD?LZKDh{IZD*2MK$e-~ zAv) z_jdE%yF+Z~FlkoV1rQe+XWb_?g%)0vA>W-6b4|>|%j&WPuyMR};e1BBBbL**D|WXP z&AS3MqfX2f2*Pmh{syRh=PJoJ__B|)bju~5*x|4C)-+Q*z-@}FMnJi&hO_vZ6XgPh zI4gOC;ws!o0Q1U{2E~KU*t;x~S^UFiq4>=@%*a#=Ri#pRv~UKu%WB$UJGE>Jw4A;0 z)f;f(tOJb4f<%P9b>CXGAVk5%GVwnh-$bI(BP=&zI%}D*_w?IUbap;;9KR{T;rgyJ#NBwMdAVo7=O$M>+|eJB zy>Wa!k6w;~eQ!lP`oU_-&YEMH(9`^()81jycHjo-X)(eDv|wsi^+#mqPTid<(FjEd zk@Fr>NHOSvk*+EeIR((R6en#G$_HntCy|0Z{0VYH+iqI1Kzc}zuNc>RHyFy2YbfVF zo~-UQiquT2x_YD4lyf%~E<5L&y8k3XP;7a;;Dpw05}=T;0Z$~+WhJ(;tI2YdFm_&R z=k}wM>uE~wfQ%NPKIjl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X4joNoQ{FpEz@gOD@3d*6>^+WC!%nCHkKIVdJ2UG_&E4D!Yi#yf~g)#7#wLLf%I zaeVz20|l`ceM07U_tZ|X5QcDIaxk}SMzkqG|DoaOIb;Nz3tN-15MXOj0pj+#{)gi2W(&_A-%Lto!UpSR~fOI1##uTq=6xj+c2ZzEhaO1bZo}bBP(gO@$llTIK5p{5KJN4o(eA75*Yna^c zz3A+_VzShm3C(!%PA7>P1)dJtWX-DYpi>ZZPc#G&A=B47aog1J#AN-rDR zO<%-%PbF{5ET74Y!7*p)-X<;*8P#-AP5>k{qa3rX)*N$M}ghFjLL{eSo}kKNzEx>b(VWMU6A zYHO2}4bWQkqysyNS_7(z13FX0%!MQ&XI*xHY1=G^okgDj{!k!kC`acn2Z$vFxB`Yj zkqc6*oX+YJ<{M>XwoH|WVi}48F{nisAXdDgGR62Gg52|m6?zyGKuo%dBSMp`$#QO`2>gn literal 0 HcmV?d00001 diff --git a/test-data/pre-created/b4096_zero b/test-data/pre-created/b4096_zero new file mode 100644 index 0000000000000000000000000000000000000000..08e7df176454f3ee5eeda13efa0adaa54828dfd8 GIT binary patch literal 4096 ocmeIu0Sy2E0K%a6Pi+qe5hx58Fkrxd0RsjM7%*VKfPwdc0T2KH0RR91 literal 0 HcmV?d00001 diff --git a/test-data/pre-created/b512_rand b/test-data/pre-created/b512_rand new file mode 100644 index 0000000..a9aa119 --- /dev/null +++ b/test-data/pre-created/b512_rand @@ -0,0 +1 @@ +TGA&,"ԅ?$GV?)j E6nQhBJAsϗ3CDgߦ1m6r%lg~l8x qqKO!#z02;l^8ߴh~A1%#'&ҌJ=hdl&Wa+xަXĆp|Ǯ'{l0OjzrIҦ*UZ&`زHU \ No newline at end of file diff --git a/test-data/pre-created/b512_zero b/test-data/pre-created/b512_zero new file mode 100644 index 0000000000000000000000000000000000000000..a64a5a93fb4aef4d5f63d79cb2582731b9ac5063 GIT binary patch literal 512 NcmZQz7zHCa1ONg600961 literal 0 HcmV?d00001 diff --git a/test-data/pre-created/b8000_rand b/test-data/pre-created/b8000_rand new file mode 100644 index 0000000000000000000000000000000000000000..cd6ec9a58a21e878674cbf4748309beaa5b638fe GIT binary patch literal 8000 zcmV-GAHU$|BRmHS7*U7bU@p{J)}+azrgBGG$GHeC#uzBTojUb)gzm9f779VSI+WSS zr@sA%SjLwG79JB2~{{k+o&a?-#GfN0O*Fhiuy3I>bT08=< zWq^7N%lFRSUb7Z{gkJI%lZ%PwDh8(cO7dx`19>-OwBgHl3+M}3_j5xoMh?QO%ueY@ z{bIf&6A^@pOLg#YM_3OlWe=E(cAldP|IayLlV{h4IZM7=)H%*Cof-D>nNJ=r>6MC% zbb*GA&V&L-$0}K+uqi_Lww$Qnywuihs(%vuQoN$i(1F|14pXnWlK{%KJ~*R-RfvZh z5lctx6E(bDH)9vGH)zU}IiA{r%olzHbrXxujoRq`J*m+_8`jp$1Nq!(4>}X5%__#8G(w(USjG3M<+o5< z+9i=T#&;aF!oSA=H~AkR7@fmie3%;p*#?PJxMx*6$iT*yo0h%N%@tFl%YL6pS2g)+ zI@`WhtSyFa_j3P)Imni`N|*R4Nh^8=4C&~RMc#a$)4CDRpodi3NTH5>%$o}o^O*Jl z_8(|x)VK3xK8*ENxxEhmVo7SlsNA@mc8jCT5G5d-$18^5xzbdfnFN;0)4I?tSRBUs zM3Jri{z)z<5?5(~v4MQx2G4@*of|e9@zh}VVE8DWaYvY{%Y`)tN>O|+)Ncm|RXBr6 z_bwkj#S@6-P+Z2!eQFG4gm;DF;O`+N^{z32Iva}H>qs%2!~+uvY3MI;ZC22yM`y7D z1kCmr8++J4HRW}EEmBnPAqC5`YDJ_p8lf-XU&Sqdkd$K*5cowXz7N@I7X`hr7jplJUfeV(^ziSXEz7yF|cq(f1#6MxtLgD<=0CRP6Kj-`^*w60#A}u;7A{ zb4BE;PLmO_Mg2Q1K4aoxY!93DLW2+{#-+`{RF;?Az}VmSq(HXL(|81_S|YkDXzZ&2 zy7=*RacB@UMn)BTY~_MHp)P!TDN@xS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vl#m&V#72YJdn@roJ- zaEfXbLxnSasmQLulVC?JidwgNL$}_hWZSdV; zg-?qDA54|@kJ1ivZO+5KTGKN3rV2V6$Mieu1>%TW7PeamTSa+&Wzs+e zRT@#(crjh3&HrelJ>cX)bdGjNl>Ee8Sft+rqbt3arTKtWy2=z2nz&z7`3HI^3%@b( z40iZ9SPz(HiRin}ELFosv+cBIS^l4?k#cKuHT)n;^xnH-5*=1M)HmNXw|t&7Bn(tT zeGF_}4~4qgi@I=$V0(&$OP%CE@($^~!33D{QCeIX>Hlf{fqj#3OLhIlVj6jq|5vAheh3Bs*vC6kk+Eh8`|p-JI&z?-pT_@O0nrMiO*`>EuZ3JF3nt~F5V@#<8w zoS5gN!Xx>%&^SZmO&8nKNa|bVB~)w>Kf(faKC5H3BW-r7`P08U^&dZ|D>!K6Zyd0@ zT;(f{pF?LXzr+q`Nr{lJ6qL5nu)^dgk+%^`_32xtiCh+tH-^D^RK(8ETS_ee20m6- zGnkX7RF3AleqUTVwCP9!yfG!R0T>tYnkj!H!HzE>C#zxJiubFo^nxchWe!tWU~EHp C;fDkO literal 0 HcmV?d00001 diff --git a/test-data/pre-created/b8192_rand b/test-data/pre-created/b8192_rand new file mode 100644 index 0000000000000000000000000000000000000000..e4b4f6c196357a191e428b1a60fbdb82cd34f28d GIT binary patch literal 8192 zcmV+bAphU%AS7q$DX)TM=bSfaP`vfn7s+GJ`AG{h-(j(@6y!nv0S8;|e35(<8@-w4 zDM1^DAnIfb)Fh{+C8coBGLwd8;{Tfwv+GI{I#jAqHuu5;+Q)~|q>`*HE{}kskTiRk z+5RsL$h6?>uP))C(~552#BuQNgY)We)TR8`1(2(B-7|v0Pwbu%|D@}TM8DZJjKll` z!FTSw=Lm|5FG|su>3eWY8wKDGJ8H?WQbeNsu;+RoGr zE^qVN5*se7MyycZ7uJ70P|ckF+K?+Ol$lK}XGYVuD>o2iEvd~DZTpE9Qo!YMsv?A- z(h?zSjTaLUj+-S6VMR~|67eTPP!_EkWg^6w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x}ni2zmlm`&u0_rDg-kt0wG|{ z{>t(<4>NTuIKhy1o^!61BK{PgD%ute^rH1|f4dBx~_4na@yhfR6EIs(*9sB#0+efEk zfVa#y#eSS%1HEomY?V}imHD^_0hdv)1H6mja+o!Bng9N!w6ltFIQl$+t=x1S-v)-d zo||32Mta)`FR^>*N&S;0t#|3RCcAI5#P#oKX(X~r6ysQ=;QXp~TZ(axVMrgj* zr7G-~xe?%1;#Fs(7uki@WVZ_JVEH^LBfFiR7;CI~^6X9kN$>U&TA~N62zLy-=#x+I zuh!CJbsB9$6C2Rr$u$lY;7&x08zH6rkviH}IEu-3TjI+wM$DE0S$L`FEa!=Z2nEsc zPw87>KD5*^)AZMg?#8yHa{$YBC!pX9BA~AFIt9$DTTL?jJ!T~lyor|*Z%gB)1*=qNEn0z-OCHcq~1nA~zX6P|j zZe`sz)K}~t+mG-AT8U0$YFwuxvf%wCGHdch528Os#x;QZtX1`Biwgbp=CZr>-3k*p z>5$Ohj#=eijVr<2x#MC|i;1Ll*GJG50~(c0`ROH{dnZDO=T+0uqad(^Wz<>}D!_4t ziE+$cCp~r7>M7I^zfdxm`wmWn-}tUn`rMT;{Dh%Dca=tmOIp;x^k-BL(2;?Bq$wAKNYwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM GyblZ@00031 literal 0 HcmV?d00001 diff --git a/test-data/pre-created/rand_1000 b/test-data/pre-created/rand_1000 new file mode 100644 index 0000000000000000000000000000000000000000..d57e596f95ecf236e410be861151488fd524d15c GIT binary patch literal 1000 zcmVfCH!CDAooCG674K!KzFGp-uT z%}&1tpGX({i+3eboO{DSJtUV$E<%)sbroUD(}*{M-xk2foNR~#7{a4hj2xTIHF=Lo z#u{1gNzyK_wKRTFE*P;TQ{kllAW47L-|}@0POuz#R%%|zCb{&d)Yg3Zg-ri%vVqG! zA~5Gh-ls=LuKdZ`JI{z-Io6m~sw3pdOL8-jyw(MRrx>g5BCnf1rth#n{-x3fXCdJ| zE$u9m#-)RJyf7vMft&Q6k2%tJt6hBVi{}G0>m`_hyZI(!m(_PM4O{_S6_QCvp>(up zDL8e2tC?Zb#%4yI0&hs_Cnd9i4|mjU=^b*q;7JC2Yi?WTIiVYmhpZ!QC@nwe>A&3P zk16W06t75oPJ&{dHOE^%gp?Rp>sU9x1*fNvdMsFQ>BH9~r=XGBaU1C!gN}hS!2h{Y zROdG$_0<^A2$V6nme600yX@|W8QE-0|Bx0X6uaY&%Z$PDSlySd!XMejoZH5r`g0WjjlJ%~OA{8A+X{j0{5Y<^6++3rG9VHVk(xN6YQOLr20NbHHA}nLza@@o&FHnzy5xVp|~hd z`G-}6{3-sH&K{1YG3+~L)qM+LOKtoEKddkB-PHt@c=lKVQ~6Mm$0dVuoBthUcuE@? z5S!ehTbDwRcb@(@p8u{ZqSoh6AV)vdtnUw0Q<8AKY9r*LR(L>70%S445&L?Kbjy!1 za?#B!H5j-h^@Ushl6;TCsobHBJ!g#+z)~6&*Ud}5-sdg*msa-<=FcdLn$zWE6LA}b zno)wIN81QM)-l~3sj}HCpZ{$EW_#woh_;2P?4%J#!D~xD^B~j(ce`7Dcn9Gwu4d|HkxZJsMi+1+A Date: Sat, 17 Dec 2022 02:27:43 +0200 Subject: [PATCH 2/4] remove deprecated github actions --- .github/workflows/check-and-lint.yaml | 83 +++++++++++---------------- .github/workflows/test.yaml | 15 +++-- 2 files changed, 44 insertions(+), 54 deletions(-) diff --git a/.github/workflows/check-and-lint.yaml b/.github/workflows/check-and-lint.yaml index 4c73eb4..275e5a0 100644 --- a/.github/workflows/check-and-lint.yaml +++ b/.github/workflows/check-and-lint.yaml @@ -12,15 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - name: Cache dependencies uses: actions/cache@v3 env: - cache-name: cache-dependencies + cache-name: cache-check with: path: | ~/.cargo/.crates.toml @@ -30,52 +25,44 @@ jobs: ~/.cargo/registry/cache # target key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} - - uses: actions-rs/cargo@v1 - with: - command: check + - name: cargo check + run: cargo check fmt: name: Rustfmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + - name: Install rustfmt + run: rustup component add rustfmt + - name: Run Rustfmt + run: cargo fmt --all -- --check - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: clippy - override: true - - name: Cache dependencies - uses: actions/cache@v3 - env: - cache-name: cache-dependencies - with: - path: | - ~/.cargo/.crates.toml - ~/.cargo/.crates2.json - ~/.cargo/bin - ~/.cargo/registry/index - ~/.cargo/registry/cache -# target - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} - - uses: actions-rs/clippy-check@v1 - continue-on-error: true # currently Clippy would fail. TODO fix warnings. - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features - name: Clippy Output +# TODO clippy action is deprecated. Perhaps use https://github.com/actions-rs/clippy-check but it require more work +# clippy: +# name: Clippy +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - uses: dtolnay/rust-toolchain@stable +# with: +# components: clippy +# - name: Cache dependencies +# uses: actions/cache@v3 +# env: +# cache-name: cache-dependencies +# with: +# path: | +# ~/.cargo/.crates.toml +# ~/.cargo/.crates2.json +# ~/.cargo/bin +# ~/.cargo/registry/index +# ~/.cargo/registry/cache +## target +# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} +# - uses: actions-rs/clippy-check@v1 +# continue-on-error: true # currently Clippy would fail. TODO fix warnings. +# with: +# token: ${{ secrets.GITHUB_TOKEN }} +# args: --all-features +# name: Clippy Output diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b41d66c..d32a7db 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,11 +23,11 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable-${{ matrix.arch }} - override: true + - name: Install toolchain + run: rustup install stable-${{ matrix.arch }} --profile minimal --no-self-update + # needed for windows test, as we are using multiple architectures here + - name: Switch toolchain + run: rustup default stable-${{ matrix.arch }} - name: Cache dependencies uses: actions/cache@v3 env: @@ -44,7 +44,7 @@ jobs: - name: Install cargo-suity run: cargo install cargo-suity - name: Run tests - run: cargo suity + run: cargo suity - name: Upload raw Unit Test results if: always() uses: actions/upload-artifact@v3 @@ -64,6 +64,9 @@ jobs: path: artifacts - name: Publish Unit Test Results + # TODO this won't work for PRs from contributors, + # see: https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#support-fork-repositories-and-dependabot-branches + # and https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ uses: EnricoMi/publish-unit-test-result-action@v1 with: files: "artifacts/**/*.xml" From c208283332f306abf4d8b3aeb75607623bb63834 Mon Sep 17 00:00:00 2001 From: Bogdan Mart Date: Sat, 24 Dec 2022 01:23:54 +0200 Subject: [PATCH 3/4] Addressed PR comments. Removed not working CI steps. --- .github/workflows/check-and-lint.yaml | 28 ------------------------ .github/workflows/test.yaml | 31 ++------------------------- 2 files changed, 2 insertions(+), 57 deletions(-) diff --git a/.github/workflows/check-and-lint.yaml b/.github/workflows/check-and-lint.yaml index 275e5a0..c702427 100644 --- a/.github/workflows/check-and-lint.yaml +++ b/.github/workflows/check-and-lint.yaml @@ -38,31 +38,3 @@ jobs: - name: Run Rustfmt run: cargo fmt --all -- --check -# TODO clippy action is deprecated. Perhaps use https://github.com/actions-rs/clippy-check but it require more work -# clippy: -# name: Clippy -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - uses: dtolnay/rust-toolchain@stable -# with: -# components: clippy -# - name: Cache dependencies -# uses: actions/cache@v3 -# env: -# cache-name: cache-dependencies -# with: -# path: | -# ~/.cargo/.crates.toml -# ~/.cargo/.crates2.json -# ~/.cargo/bin -# ~/.cargo/registry/index -# ~/.cargo/registry/cache -## target -# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} -# - uses: actions-rs/clippy-check@v1 -# continue-on-error: true # currently Clippy would fail. TODO fix warnings. -# with: -# token: ${{ secrets.GITHUB_TOKEN }} -# args: --all-features -# name: Clippy Output diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d32a7db..14ad819 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -39,37 +39,10 @@ jobs: ~/.cargo/bin ~/.cargo/registry/index ~/.cargo/registry/cache -# target +# target <-- this can spead up CI a lot, but could lead to cache to grow indefinitely key: ${{ runner.os }}-${{ matrix.arch }}-build-v2-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} - - name: Install cargo-suity - run: cargo install cargo-suity - name: Run tests - run: cargo suity - - name: Upload raw Unit Test results - if: always() - uses: actions/upload-artifact@v3 - with: - name: Unit Test Results (${{ matrix.os }}) - path: ./test-results/* - publish-test-results: - name: "Publish Unit Tests Results" - needs: test - runs-on: ubuntu-latest - if: always() - - steps: - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - path: artifacts - - - name: Publish Unit Test Results - # TODO this won't work for PRs from contributors, - # see: https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#support-fork-repositories-and-dependabot-branches - # and https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ - uses: EnricoMi/publish-unit-test-result-action@v1 - with: - files: "artifacts/**/*.xml" + run: cargo test # orginal example used code coverage and tests reports, but disable it for now # https://github.com/BamPeers/rust-ci-github-actions-workflow/blob/main/.github/workflows/test.yaml From 803324e998153f5275c9e98d70d129790894296a Mon Sep 17 00:00:00 2001 From: Bogdan Mart Date: Wed, 8 Feb 2023 14:00:53 +0200 Subject: [PATCH 4/4] Resolve some of PR comments. Not all yet. --- Cargo.lock | 59 +++++++++++++++++++++++++++++----------------------- Cargo.toml | 4 +--- src/tests.rs | 24 ++++++++++----------- 3 files changed, 45 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index df15fb2..074c6d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -70,8 +70,8 @@ version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef196d5d972878a48da7decb7686eded338b4858fbabeed513d63a7c98b2b82d" dependencies = [ - "proc-macro2 1.0.33", - "quote 1.0.10", + "proc-macro2 1.0.51", + "quote 1.0.23", "unicode-xid 0.2.2", ] @@ -197,9 +197,9 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ - "proc-macro2 1.0.33", - "quote 1.0.10", - "syn 1.0.82", + "proc-macro2 1.0.51", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] @@ -365,11 +365,11 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.33" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ - "unicode-xid 0.2.2", + "unicode-ident", ] [[package]] @@ -383,11 +383,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.10" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ - "proc-macro2 1.0.33", + "proc-macro2 1.0.51", ] [[package]] @@ -417,9 +417,9 @@ dependencies = [ [[package]] name = "rstest" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c9dc66cc29792b663ffb5269be669f1613664e69ad56441fdb895c2347b930" +checksum = "b07f2d176c472198ec1e6551dc7da28f1c089652f66a7b722676c2238ebc0edf" dependencies = [ "futures", "futures-timer", @@ -429,15 +429,16 @@ dependencies = [ [[package]] name = "rstest_macros" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5015e68a0685a95ade3eee617ff7101ab6a3fc689203101ca16ebc16f2b89c66" +checksum = "7229b505ae0706e64f37ffc54a9c163e11022a6636d58fe1f3f52018257ff9f7" dependencies = [ "cfg-if", - "proc-macro2 1.0.33", - "quote 1.0.10", + "proc-macro2 1.0.51", + "quote 1.0.23", "rustc_version", - "syn 1.0.82", + "syn 1.0.107", + "unicode-ident", ] [[package]] @@ -482,9 +483,9 @@ version = "1.0.131" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b710a83c4e0dff6a3d511946b95274ad9ca9e5d3ae497b63fda866ac955358d2" dependencies = [ - "proc-macro2 1.0.33", - "quote 1.0.10", - "syn 1.0.82", + "proc-macro2 1.0.51", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] @@ -548,13 +549,13 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.82" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ - "proc-macro2 1.0.33", - "quote 1.0.10", - "unicode-xid 0.2.2", + "proc-macro2 1.0.51", + "quote 1.0.23", + "unicode-ident", ] [[package]] @@ -575,6 +576,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "unicode-ident" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + [[package]] name = "unicode-segmentation" version = "1.8.0" diff --git a/Cargo.toml b/Cargo.toml index 0e6b8d7..c2fbeaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,9 +21,7 @@ serde_json = "1.0.73" [dev-dependencies] const_format = "0.2.23" -# TODO update to 0.16 when it is released. -# It fixes https://github.com/la10736/rstest/issues/158, which is not showtopper, but minor annoyance. -rstest = "0.15.0" +rstest = "0.16.0" [target.'cfg(windows)'.dependencies] winapi-util = "0.1.2" diff --git a/src/tests.rs b/src/tests.rs index 7a56506..cd58ec3 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -3,8 +3,6 @@ #![allow(dead_code)] use crate::{DiskItem, FileInfo}; -// warn: don't remove `as &str` after macro invocation. -// It breaks type checker in Intellij Rust IDE use const_format::concatcp; use rstest::*; use std::fs::File; @@ -29,7 +27,7 @@ tttttttttt/ttttttttttt/ttttttttttttttt/ttttttttt/tttthhh/2222222222/22222222222/ 77777777/7777777777/7777777777777/77777777777/7777777777/77777777/7777777/77777777/8888888888/\ 99999999/999999/99999999/99999999999/99999999/999999999/9999999999/"; -const PATH_1_FULL: &str = concatcp!(TEST_DATA_DIR, LONG_PATH_DIR, PATH_1) as &str; +const PATH_1_FULL: &str = concatcp!(TEST_DATA_DIR, LONG_PATH_DIR, PATH_1); //noinspection SpellCheckingInspection const PATH_2: &str = "lll2/llllllll/llllllllllllllll/llllllllllllll/lllllllllllll/oooooo\ oooooooo/oooooooooooooooo/nnnnnnnnn/nnnnnnnnnn/nnnnnnnn/nnnnnn/gggggggggg/p/a/tttt\ @@ -39,7 +37,7 @@ tttttttttt/ttttttttttt/ttttttttttttttt/ttttttttt/tttthhh/2222222222/22222222222/ 77777777/7777777777/7777777777777/77777777777/7777777777/77777777/7777777/77777777/8888888888/\ 99999999/999999/99999999/99999999999/99999999/999999999/9999999999/"; -const PATH_2_FULL: &str = concatcp!(TEST_DATA_DIR, LONG_PATH_DIR, PATH_2) as &str; +const PATH_2_FULL: &str = concatcp!(TEST_DATA_DIR, LONG_PATH_DIR, PATH_2); const TEST_PRE_CREATED_DIR: &str = concatcp!(TEST_DATA_DIR, "pre-created/"); @@ -48,7 +46,7 @@ const TEST_PRE_CREATED_DIR: &str = concatcp!(TEST_DATA_DIR, "pre-created/"); fn test_max_path() { // do not rename it into `_` it would cause immediate destruction after creation let _guard = CleanUpGuard { - path: concatcp!(TEST_DATA_DIR, LONG_PATH_DIR) as &str, + path: concatcp!(TEST_DATA_DIR, LONG_PATH_DIR), }; // Given @@ -58,11 +56,11 @@ fn test_max_path() { create_file(&concatcp!(PATH_2_FULL, "file.bin"), 8192); // When - let test_path = Path::new(concatcp!(TEST_DATA_DIR, LONG_PATH_DIR) as &str); + let test_path = Path::new(concatcp!(TEST_DATA_DIR, LONG_PATH_DIR)); let result = FileInfo::from_path(test_path, true); // Then - if let Result::Ok(FileInfo::Directory { volume_id }) = result { + if let Ok(FileInfo::Directory { volume_id }) = result { let result = DiskItem::from_analyze(test_path, true, volume_id); let result = result.expect("Must collect data"); assert_eq!(result.disk_size, 4096 + 8192); @@ -127,15 +125,15 @@ fn test_files_physical_size(#[case] file: &str, #[case] size: u64) { #[allow(non_snake_case)] #[test] fn test_file_size_8KiB() { - const DIR: &str = concatcp!(TEST_DATA_DIR, "test_file_size/") as &str; - // do not rename it into `_` it would cause immediate destrucion after creation + const DIR: &str = concatcp!(TEST_DATA_DIR, "test_file_size/"); + // do not rename it into `_` it would cause immediate destruction after creation let _guard = CleanUpGuard { path: DIR }; // Given // Such sizes is selected to be close to filesystem sector size, and to be maximally universal // event for FS-es with sector as bif as 8KiB - create_file(&concatcp!(DIR, "foo/file.bin") as &str, 8192); - create_file(&concatcp!(DIR, "bar/file.bin") as &str, 8192 - 5); + create_file(&concatcp!(DIR, "foo/file.bin"), 8192); + create_file(&concatcp!(DIR, "bar/file.bin"), 8192 - 5); // When calculating with apparent size let test_path = Path::new(DIR); @@ -161,7 +159,7 @@ fn test_file_size_8KiB() { panic!("Can not get file info"); } - // When calculating withOUT apparent size + // When calculating without apparent size let result = FileInfo::from_path(test_path, false); // Then @@ -200,7 +198,7 @@ fn assert_size(file_name: &str, apparent: bool, expected_size: u64) { FileInfo::from_path(&Path::new(TEST_DATA_DIR), apparent).unwrap() { let result = DiskItem::from_analyze(Path::new(file_name), apparent, volume_id) - .expect("Shoud be able to get file size"); + .expect("Should be able to get file size"); assert_eq!( expected_size, result.disk_size,