From a84835e481d9b5fcfc101bb1fa5aba38a245b6f3 Mon Sep 17 00:00:00 2001 Message-ID: From: Fabio Natali 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 href='/guix/commit/tests/publish.scm?id=54be7795b5cc2f6cad05f8649121372c9d5af806'>utils: Don’t re-export ‘call-with-temporary-output-file’....* guix/utils.scm: Remove re-export of ‘call-with-temporary-output-file’. Autoload a number of modules. * guix/download.scm, guix/import/hackage.scm, guix/import/hexpm.scm, guix/import/opam.scm, guix/import/pypi.scm, tests/cpio.scm, tests/egg.scm, tests/opam.scm, tests/publish.scm, tests/store-database.scm, tests/utils.scm: Adjust imports accordingly. Change-Id: I3f5e94631397996a30be2ea4ff8b50a3371e8ee7 Ludovic Courtès 2022-04-29publish: Send uncached narinfo replies from the main thread....Fixes <https://issues.guix.gnu.org/54723>. Reported by Guillaume Le Vaillant <glv@posteo.net>. Regression introduced in f743f2046be2c5a338ab871ae8666d8f6de7440b. With commit f743f2046be2c5a338ab871ae8666d8f6de7440b, responses to pipelined GETs would end up being written concurrently by many threads. Thus the body of those responses could be interleaved and garbled. * guix/scripts/publish.scm: Revert f743f2046be2c5a338ab871ae8666d8f6de7440b. * tests/publish.scm ("/*.narinfo pipeline"): New test. Ludovic Courtès 2022-02-14publish: Do not sign the URL/Compression/FileSize narinfo fields....This will allow mirror operators to alter these non-normative bits of a narinfo without having to resign narinfos. * guix/scripts/publish.scm (narinfo-string): Remove URL/Compression/FileSize from BASE-INFO. Move them after "Signature". * tests/publish.scm ("/*.narinfo") ("/*.narinfo with properly encoded '+' sign") ("/*.narinfo with lzip + gzip") ("with cache, lzip + gzip"): Adjust accordingly. * tests/substitute.scm ("query narinfo with signature over relevant subset"): New test. Ludovic Courtès 2022-01-19tests: Adjust to gzip as the default log compression....This is a followup to 575e52ac2b090fd194086e9c1c53bbf8055acbc2. * tests/publish.scm ("/log/NAME"): Expect a gzip-encoded log. Ludovic Courtès