| 1 | From a84835e481d9b5fcfc101bb1fa5aba38a245b6f3 Mon Sep 17 00:00:00 2001
|
| 2 | Message-ID: <a84835e481d9b5fcfc101bb1fa5aba38a245b6f3.1711177846.git.vivien@planete-kraus.eu>
|
| 3 | From: Fabio Natali <[email protected]>
|
| 4 | Date: Wed, 30 Aug 2023 11:35:40 +0100
|
| 5 | Subject: [PATCH] Fix test.sh which used to fail in some circumstances
|
| 6 |
|
| 7 | duc's behaviour may legitimately vary depending on the system it is being run
|
| 8 | on. The test.sh script used to fail in some circumstances as it was too strict
|
| 9 | and it did not account for some legitimate behaviour differences.
|
| 10 |
|
| 11 | Fix: update `test.sh' variable
|
| 12 | ---
|
| 13 |
|
| 14 | This is a squash of pull request https://github.com/zevv/duc/pull/318,
|
| 15 | waiting to be merged.
|
| 16 |
|
| 17 | test.sh | 22 ++++++++++++++++------
|
| 18 | 1 file changed, 16 insertions(+), 6 deletions(-)
|
| 19 |
|
| 20 | diff --git a/test.sh b/test.sh
|
| 21 | index eb592be..7668499 100755
|
| 22 | |
| 23 | |
| 24 | @@ -130,8 +130,8 @@ fi
|
| 25 | # Actual tests are below. If you add test cases above, these need to be tweaked.
|
| 26 | #---------------------------------------------------------------------------------
|
| 27 |
|
| 28 | -
|
| 29 | -cat ${DUC_TEST_DIR}.out | grep -q "Indexed 77 files and 47 directories, (91869B apparent, 540672B actual)"
|
| 30 | +# An exact match is expected on the apparent size; the actual size may vary.
|
| 31 | +cat ${DUC_TEST_DIR}.out | grep -q "Indexed 77 files and 47 directories, (91869B apparent, [0-9]*B actual)"
|
| 32 |
|
| 33 | if [ "$?" = "0" ]; then
|
| 34 | echo "report: ok"
|
| 35 | @@ -153,16 +153,26 @@ if [ "$?" != "0" ]; then
|
| 36 | exit 1
|
| 37 | fi
|
| 38 |
|
| 39 | -testsum="33e2be27a9e70e81d4006a2d7b555948"
|
| 40 | +# When two or more hard links point to the same file and when running duc with
|
| 41 | +# the `--check-hard-links' option, only one of the hard links will be
|
| 42 | +# counted. However, duc may pick up and display a different hard link depending
|
| 43 | +# on the system it is being run on. Since our tests include three hard links to
|
| 44 | +# the same file, we should be expecting three possible outcomes, all equally
|
| 45 | +# valid, each corresponding to one of the following MD5 checksums.
|
| 46 | +testsum0="78dbf880ef6917ea665fddb5ebb44428"
|
| 47 | +testsum1="38ab7b7d1ec6ac57d672c5618371386d"
|
| 48 | +testsum2="33e2be27a9e70e81d4006a2d7b555948"
|
| 49 | md5sum ${DUC_TEST_DIR}.out > /tmp/.duc.md5sum
|
| 50 | -grep -q $testsum /tmp/.duc.md5sum
|
| 51 | +grep -q "$testsum0\|$testsum1\|$testsum2" /tmp/.duc.md5sum
|
| 52 |
|
| 53 | if [ "$?" = "0" ]; then
|
| 54 | echo "md5sum: ok"
|
| 55 | else
|
| 56 | echo "md5sum: failed"
|
| 57 | - echo "expected: "
|
| 58 | - echo "$testsum ${DUC_TEST_DIR}.out"
|
| 59 | + echo "expected one of: "
|
| 60 | + echo "$testsum0 ${DUC_TEST_DIR}.out"
|
| 61 | + echo "$testsum1 ${DUC_TEST_DIR}.out"
|
| 62 | + echo "$testsum2 ${DUC_TEST_DIR}.out"
|
| 63 | echo "got: "
|
| 64 | cat /tmp/.duc.md5sum
|
| 65 | exit 1
|
| 66 |
|
| 67 | base-commit: b8f9659688a38476df9f613be3342bb8e2d65402
|
| 68 | --
|
| 69 | 2.41.0
|
| 70 |
|