qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, "John Snow" <jsnow@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH 1/2] tests/functional: Set current time stamp of assets when using them
Date: Fri, 10 Oct 2025 10:53:38 +0100	[thread overview]
Message-ID: <aOjXokhfml2QZzJc@redhat.com> (raw)
In-Reply-To: <906535c5-515d-4960-b633-63b137f5f635@redhat.com>

On Fri, Oct 10, 2025 at 11:46:44AM +0200, Thomas Huth wrote:
> On 10/10/2025 11.39, Daniel P. Berrangé wrote:
> > On Fri, Oct 10, 2025 at 11:32:42AM +0200, Thomas Huth wrote:
> > > From: Thomas Huth <thuth@redhat.com>
> > > 
> > > We are going to remove obsolete assets from the cache, so keep
> > > the time stamps of the assets that we use up-to-date to have a way
> > > to detect stale assets later.
> > > 
> > > Signed-off-by: Thomas Huth <thuth@redhat.com>
> > > ---
> > >   tests/functional/qemu_test/asset.py | 8 ++++++++
> > >   1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_test/asset.py
> > > index 2971a989d1e..251953ed99f 100644
> > > --- a/tests/functional/qemu_test/asset.py
> > > +++ b/tests/functional/qemu_test/asset.py
> > > @@ -10,6 +10,7 @@
> > >   import os
> > >   import stat
> > >   import sys
> > > +import time
> > >   import unittest
> > >   import urllib.request
> > >   from time import sleep
> > > @@ -113,6 +114,11 @@ def _wait_for_other_download(self, tmp_cache_file):
> > >           self.log.debug("Time out while waiting for %s!", tmp_cache_file)
> > >           raise
> > > +    def _save_time_stamp(self):
> > > +        with open(self.cache_file.with_suffix(".stamp"), 'w',
> > > +                  encoding='utf-8') as fh:
> > > +            fh.write(f"{int(time.time())}")
> > 
> > Rather than creating a parallel timestamp file, it feels like we could
> > just call  'os.utime(self.cache_file)' which will set atime + mtime
> > to the current timestamp, which we can check later with os.stat().
> 
> That was my first idea, too (sorry, I should maybe have mentioned it in the
> patch description), but it does not work: In the gitlab CI runners, the
> files get re-initialized from the runners cache each time the functional
> test job is started, so the atime and mtime is always close to the the
> current date there --> we would never expire files in the gitlab CI that
> way.

Oh well, I had assumed gitlab would preserve timestamps when taring/untaring
files for the cache :-(


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2025-10-10  9:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-10  9:32 [PATCH 0/2] Clean up the functional download cache after some months Thomas Huth
2025-10-10  9:32 ` [PATCH 1/2] tests/functional: Set current time stamp of assets when using them Thomas Huth
2025-10-10  9:39   ` Daniel P. Berrangé
2025-10-10  9:46     ` Thomas Huth
2025-10-10  9:53       ` Daniel P. Berrangé [this message]
2025-10-10  9:32 ` [PATCH 2/2] tests: Evict stale files in the functional download cache after a while Thomas Huth
2025-10-10  9:50   ` Daniel P. Berrangé
2025-10-13 11:47     ` Thomas Huth
2025-10-13 11:50       ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aOjXokhfml2QZzJc@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=jsnow@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).