unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 8b79e4bd038f097e092e5f8b365b8cc49e0a2bac 2619 bytes (raw)
name: gnu/packages/patches/duc-fix-test-sh.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
From a84835e481d9b5fcfc101bb1fa5aba38a245b6f3 Mon Sep 17 00:00:00 2001
Message-ID: <a84835e481d9b5fcfc101bb1fa5aba38a245b6f3.1711177846.git.vivien@planete-kraus.eu>
From: Fabio Natali <me@fabionatali.com>
Date: Wed, 30 Aug 2023 11:35:40 +0100
Subject: [PATCH] Fix test.sh which used to fail in some circumstances

duc's behaviour may legitimately vary depending on the system it is being run
on. The test.sh script used to fail in some circumstances as it was too strict
and it did not account for some legitimate behaviour differences.

Fix: update `test.sh' variable
---

This is a squash of pull request https://github.com/zevv/duc/pull/318,
waiting to be merged.

 test.sh | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/test.sh b/test.sh
index eb592be..7668499 100755
--- a/test.sh
+++ b/test.sh
@@ -130,8 +130,8 @@ fi
 # Actual tests are below.  If you add test cases above, these need to be tweaked.
 #---------------------------------------------------------------------------------
 
-
-cat ${DUC_TEST_DIR}.out | grep -q "Indexed 77 files and 47 directories, (91869B apparent, 540672B actual)"
+# An exact match is expected on the apparent size; the actual size may vary.
+cat ${DUC_TEST_DIR}.out | grep -q "Indexed 77 files and 47 directories, (91869B apparent, [0-9]*B actual)"
 
 if [ "$?" = "0" ]; then
 	echo "report: ok"
@@ -153,16 +153,26 @@ if [ "$?" != "0" ]; then
 	exit 1
 fi
 
-testsum="33e2be27a9e70e81d4006a2d7b555948"
+# When two or more hard links point to the same file and when running duc with
+# the `--check-hard-links' option, only one of the hard links will be
+# counted. However, duc may pick up and display a different hard link depending
+# on the system it is being run on. Since our tests include three hard links to
+# the same file, we should be expecting three possible outcomes, all equally
+# valid, each corresponding to one of the following MD5 checksums.
+testsum0="78dbf880ef6917ea665fddb5ebb44428"
+testsum1="38ab7b7d1ec6ac57d672c5618371386d"
+testsum2="33e2be27a9e70e81d4006a2d7b555948"
 md5sum ${DUC_TEST_DIR}.out > /tmp/.duc.md5sum
-grep -q $testsum /tmp/.duc.md5sum
+grep -q "$testsum0\|$testsum1\|$testsum2" /tmp/.duc.md5sum
 
 if [ "$?" = "0" ]; then
 	echo "md5sum: ok"
 else
 	echo "md5sum: failed"
-	echo "expected: "
-	echo "$testsum  ${DUC_TEST_DIR}.out"
+	echo "expected one of: "
+	echo "$testsum0  ${DUC_TEST_DIR}.out"
+	echo "$testsum1  ${DUC_TEST_DIR}.out"
+	echo "$testsum2  ${DUC_TEST_DIR}.out"
 	echo "got: "
 	cat /tmp/.duc.md5sum
 	exit 1

base-commit: b8f9659688a38476df9f613be3342bb8e2d65402
-- 
2.41.0


debug log:

solving 8b79e4bd03 ...
found 8b79e4bd03 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).