From b2d534b458f911eba7b4b0d71ae2ae31174ced32 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 27 Feb 2025 13:26:14 +0100 Subject: test-apt-ftparchive-cachedb: Avoid race condition in test case apt-ftparchive skips regenerating Contents if they are newer than the Packages files. Most of the time, the test ended up generating Contents and Packages files with the same-second timestamp; so we ended up regenerating them and passing the test. However, sometimes, the timestamp of the Contents file was 1s higher and we ended up not regenerating the Contents file and hence failed the test case. Ensure the timestamps actually are the same to avoid the race condition and make this stable. --- test/integration/test-apt-ftparchive-cachedb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb index f6e71ccdb..c005804e6 100755 --- a/test/integration/test-apt-ftparchive-cachedb +++ b/test/integration/test-apt-ftparchive-cachedb @@ -86,6 +86,11 @@ testsuccessequal ' Misses in Cache: 2 dists/test/Contents-i386: New 402 B Misses in Cache: 0' grep Misses stats-out.txt # generate again +# ensure Contents file is not newer than Packages file; to avoid a race condition with the +# test case: If Contents file happened to be newer than the Packages file, we'd skip its +# generation (failing the test case); but if they are generated at the same time it may +# be out-of-date strictly speaking and needed regenerating. +touch -r ./aptarchive/dists/test/main/binary-i386/Packages ./aptarchive/dists/test/Contents-i386* testsuccess aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 cp rootdir/tmp/testsuccess.output stats-out.txt ensure_correct_packages_file -- cgit v1.2.3-70-g09d2