diff mbox series

tests/fetch: don't rely on wget --continue in the corrupt partial test

Message ID 20261006213334.3360919-1-ricardo.salveti@oss.qualcomm.com
State New
Headers show
Series tests/fetch: don't rely on wget --continue in the corrupt partial test | expand

Commit Message

Ricardo Salveti Oct. 6, 2026, 9:33 p.m. UTC
test_wget_corrupt_partial_download expected wget --continue to leave an
existing .tmp file as large as the remote one alone when the server
ignores Range, which is what GNU wget 1.21.4 does. wget2 2.1.0 rewrites
the file instead, so the fetch succeeds, and wget2 2.2.1 (Fedora 45)
appends the whole download to it, so the bad file ends up under another
checksum than the one the test looks for. Don't run wget for that first
fetch, so the fetcher sees the partial download as it was left,
whichever wget is in use.

Tested with wget 1.21.4, wget2 2.1.0 and wget2 2.2.1 (Fedora 45). The
test still fails without the fetcher fix.

Fixes: 37b9c56ae3b2 ("fetch/wget: rename the partial download on checksum mismatch")
Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
---
 lib/bb/tests/fetch.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Yoann Congal Oct. 6, 2026, 10:50 p.m. UTC | #1
On Tue Oct 6, 2026 at 11:33 PM CEST, Ricardo Salveti via lists.openembedded.org wrote:
> test_wget_corrupt_partial_download expected wget --continue to leave an
> existing .tmp file as large as the remote one alone when the server
> ignores Range, which is what GNU wget 1.21.4 does. wget2 2.1.0 rewrites
> the file instead, so the fetch succeeds, and wget2 2.2.1 (Fedora 45)
> appends the whole download to it, so the bad file ends up under another
> checksum than the one the test looks for. Don't run wget for that first
> fetch, so the fetcher sees the partial download as it was left,
> whichever wget is in use.
>
> Tested with wget 1.21.4, wget2 2.1.0 and wget2 2.2.1 (Fedora 45). The
> test still fails without the fetcher fix.
>
> Fixes: 37b9c56ae3b2 ("fetch/wget: rename the partial download on checksum mismatch")
> Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> AI-Generated: Uses Claude Code (Claude Opus 5.5)
> Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
> ---
>  lib/bb/tests/fetch.py | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Hello,

Do you think this could be a fix for
https://bugzilla.yoctoproject.org/show_bug.cgi?id=16153 ?
(previous patch definitely sound related)

Thanks!
diff mbox series

Patch

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 9627b3b1b..0f29cdf11 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -1708,8 +1708,6 @@  class FetchLatestVersionTest(FetcherTest):
 
 class WgetChecksumTest(FetcherTest):
     content = b"bitbake wget test data\n" * 64
-    # As large as the real file, so wget --continue has nothing left to fetch
-    # and keeps it as is
     corrupt = b"x" * len(content)
 
     def setUp(self):
@@ -1743,8 +1741,10 @@  class WgetChecksumTest(FetcherTest):
         self.write(os.path.join(self.dldir, "test.bin.tmp"), self.corrupt)
 
         fetcher = bb.fetch.Fetch([self.url], self.d)
-        with self.assertRaises(bb.fetch.FetchError):
-            fetcher.download()
+        # Skip wget, so the fetcher verifies the file seeded above as is
+        with unittest.mock.patch.object(bb.fetch.wget.Wget, "_runwget"):
+            with self.assertRaises(bb.fetch.FetchError):
+                fetcher.download()
         self.assertFalse(os.path.exists(os.path.join(self.dldir, "test.bin.tmp")))
 
         fetcher.download()