From 02d5fb6e4b5ef6e702b3e6142ca2a291e6e19f8c Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 18 Feb 2022 22:10:08 +0100 Subject: [PATCH 01/10] Add draft for integration test --- .github/workflows/CICD.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 922be50..4297497 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -160,6 +160,32 @@ jobs: command: test args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} + - name: Integration tests + shell: bash + run: | + mkdir test-directory + touch test-directory/empty-file + mkdir test-directory/empty-subdirectory + echo -n "123" > test-directory/file-3-bytes + echo -n "1234567" > test-directory/file-7-bytes + + echo "Disk usage" + echo "==========" + ${{ steps.strip.outputs.BIN_PATH }} test-directory + if [ "$RUNNER_OS" == "Windows" ]; then + du test-directory + else + du -s --block-size=1 test-directory + fi + + if [ "$RUNNER_OS" != "Windows" ]; then + echo + echo "Apparent size" + echo "=============" + ${{ steps.strip.outputs.BIN_PATH }} --apparent-size test-directory + du -s --apparent-size --block-size=1 test-directory + fi + - name: Create tarball id: package shell: bash From 88be48d61207db106d9862294651e75afa105e63 Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 18 Feb 2022 22:46:15 +0100 Subject: [PATCH 02/10] Windows: Show du help --- .github/workflows/CICD.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 4297497..30b1084 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -173,6 +173,8 @@ jobs: echo "==========" ${{ steps.strip.outputs.BIN_PATH }} test-directory if [ "$RUNNER_OS" == "Windows" ]; then + du -h + du /? du test-directory else du -s --block-size=1 test-directory From a0928f30d77e55cbaead74ddaa546c222fb72f70 Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 18 Feb 2022 22:51:44 +0100 Subject: [PATCH 03/10] Fix for macOS --- .github/workflows/CICD.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 30b1084..0999d38 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -176,11 +176,13 @@ jobs: du -h du /? du test-directory + elif [ "$RUNNER_OS" == "macOS" ]; then + du -c test-directory else du -s --block-size=1 test-directory fi - if [ "$RUNNER_OS" != "Windows" ]; then + if [ "$RUNNER_OS" == "Linux" ]; then echo echo "Apparent size" echo "=============" From b88c5bca8a1800e4aaebf3cfc825b3ebbc3340f8 Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 18 Feb 2022 22:54:54 +0100 Subject: [PATCH 04/10] Use DU on Windows --- .github/workflows/CICD.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 0999d38..52c2c85 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -173,9 +173,9 @@ jobs: echo "==========" ${{ steps.strip.outputs.BIN_PATH }} test-directory if [ "$RUNNER_OS" == "Windows" ]; then - du -h - du /? - du test-directory + wget https://download.sysinternals.com/files/DU.zip + unzip DU.zip + ./du64.exe -q test-directory elif [ "$RUNNER_OS" == "macOS" ]; then du -c test-directory else From fab3452b8d9a57de14c5a31c9928cc9642082b89 Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 18 Feb 2022 22:56:41 +0100 Subject: [PATCH 05/10] Another fix for macOS --- .github/workflows/CICD.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 52c2c85..742f092 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -177,6 +177,7 @@ jobs: unzip DU.zip ./du64.exe -q test-directory elif [ "$RUNNER_OS" == "macOS" ]; then + export BLOCKSIZE=1 du -c test-directory else du -s --block-size=1 test-directory From 4e207910e5fd8d8afee9c67b9ec7ef28ed455042 Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 18 Feb 2022 23:05:53 +0100 Subject: [PATCH 06/10] Fix download --- .github/workflows/CICD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 742f092..8c41d4e 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -173,7 +173,7 @@ jobs: echo "==========" ${{ steps.strip.outputs.BIN_PATH }} test-directory if [ "$RUNNER_OS" == "Windows" ]; then - wget https://download.sysinternals.com/files/DU.zip + curl https://download.sysinternals.com/files/DU.zip --output DU-zip unzip DU.zip ./du64.exe -q test-directory elif [ "$RUNNER_OS" == "macOS" ]; then From dc09024173a085a21b07f02620808b4c1c638b62 Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 18 Feb 2022 23:07:38 +0100 Subject: [PATCH 07/10] macOS fix --- .github/workflows/CICD.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 8c41d4e..8e402d6 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -177,8 +177,7 @@ jobs: unzip DU.zip ./du64.exe -q test-directory elif [ "$RUNNER_OS" == "macOS" ]; then - export BLOCKSIZE=1 - du -c test-directory + du -c -k test-directory else du -s --block-size=1 test-directory fi From ae7d6d346030aff5be4f0295512ace19584fbf15 Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 18 Feb 2022 23:10:06 +0100 Subject: [PATCH 08/10] fix filename --- .github/workflows/CICD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 8e402d6..2d37814 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -173,7 +173,7 @@ jobs: echo "==========" ${{ steps.strip.outputs.BIN_PATH }} test-directory if [ "$RUNNER_OS" == "Windows" ]; then - curl https://download.sysinternals.com/files/DU.zip --output DU-zip + curl https://download.sysinternals.com/files/DU.zip --output DU.zip unzip DU.zip ./du64.exe -q test-directory elif [ "$RUNNER_OS" == "macOS" ]; then From 8b7cf3ec55b6fb573ada70ad8c200967e0f14405 Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 18 Feb 2022 23:16:03 +0100 Subject: [PATCH 09/10] accept EULA --- .github/workflows/CICD.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 2d37814..dadaf09 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -175,6 +175,7 @@ jobs: if [ "$RUNNER_OS" == "Windows" ]; then curl https://download.sysinternals.com/files/DU.zip --output DU.zip unzip DU.zip + ./du64.exe -accepteula ./du64.exe -q test-directory elif [ "$RUNNER_OS" == "macOS" ]; then du -c -k test-directory From 7f6726faf28398aa84324e0f41758a779266eca9 Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 18 Feb 2022 23:23:23 +0100 Subject: [PATCH 10/10] Update formatting on Windows --- .github/workflows/CICD.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index dadaf09..5522a5b 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -169,13 +169,16 @@ jobs: echo -n "123" > test-directory/file-3-bytes echo -n "1234567" > test-directory/file-7-bytes + if [ "$RUNNER_OS" == "Windows" ]; then + curl https://download.sysinternals.com/files/DU.zip --output DU.zip + unzip DU.zip + ./du64.exe -accepteula -q test-directory/empty-file + fi + echo "Disk usage" echo "==========" ${{ steps.strip.outputs.BIN_PATH }} test-directory if [ "$RUNNER_OS" == "Windows" ]; then - curl https://download.sysinternals.com/files/DU.zip --output DU.zip - unzip DU.zip - ./du64.exe -accepteula ./du64.exe -q test-directory elif [ "$RUNNER_OS" == "macOS" ]; then du -c -k test-directory