From: Uladzimir Bely <ubely@ilbers.de>
To: Henning Schild <henning.schild@siemens.com>
Cc: isar-users@googlegroups.com
Subject: Re: [PATCH] testsuite: Cleanup after gpg import in repro_test
Date: Fri, 03 Mar 2023 16:57:27 +0300 [thread overview]
Message-ID: <2173862.hkbZ0PkbqX@hp> (raw)
In-Reply-To: <20230303101056.3bef674c@md1za8fc.ad001.siemens.net>
In mail from Friday, 3 March 2023 12:10:56 +03 user Henning Schild wrote:
> Am Fri, 3 Mar 2023 08:19:07 +0100
>
> schrieb Uladzimir Bely <ubely@ilbers.de>:
> > After each repro_test a random GNUPGHOME directory and `gpg-agent`
> > process are left.
> >
> > After multiple full tests in CI we may come to the situation when
> > all inotify descriptors are busy:
> >
> > ```
> > File "<path>/bitbake/lib/pyinotify.py", line 1728, in _init_
> >
> > raise OSError(err % self._inotify_wrapper.str_errno())
> >
> > OSError: Cannot initialize new instance of inotify,
> >
> > Errno=Too many open files (EMFILE)
> >
> > ```
> >
> > This patch provides an appropriate cleanup routine.
> >
> > Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> > ---
> >
> > testsuite/cibase.py | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/testsuite/cibase.py b/testsuite/cibase.py
> > index f2e4e957..7ac8ebc7 100755
> > --- a/testsuite/cibase.py
> > +++ b/testsuite/cibase.py
> > @@ -3,6 +3,7 @@
> >
> > import glob
> > import os
> > import re
> >
> > +import shutil
> >
> > import tempfile
> > import time
> >
> > @@ -35,7 +36,7 @@ class CIBaseTest(CIBuilder):
> > os.chdir(self.build_dir)
> >
> > - os.environ['GNUPGHOME'] = tempfile.mkdtemp()
> > + os.environ['GNUPGHOME'] = gnupg_home = tempfile.mkdtemp()
> >
> > result = process.run('gpg --import %s %s' % (gpg_pub_key,
> >
> > gpg_priv_key))
> >
> > if result.exit_status:
> > @@ -56,6 +57,10 @@ class CIBaseTest(CIBuilder):
> > self.configure(**kwargs)
> > self.bitbake(targets, **kwargs)
> >
> > + # Cleanup
> > + process.run('gpgconf --kill gpg-agent')
> > + shutil.rmtree(gnupg_home, True)
>
> Does that really always run? We have a self.fail('GPG import failed'),
> if that returns from this function we might have agents around, and
> that directory.
>
I'm not sure gpg-agent process will be start in this case, but yes, at least
temporary directory will remain. On the other hand, having this undeleted
might be helpful for debugging...
>
> the tearDown() fixture might be better
> Henning
Do you mean just a separate function that executed from 2 places? Or is it
some kind a method that run automatically?
P.S. Walked through avocado documentation while writing this mail and found
that it's a method that runs automatically. Will try with this approach,
thanks for the hint.
>
> > +
> >
> > def perform_ccache_test(self, targets, **kwargs):
> > def ccache_stats(dir, field):
> > # Look ccache source's 'src/core/Statistic.hpp' for
> >
> > field meanings
next prev parent reply other threads:[~2023-03-03 13:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 7:19 Uladzimir Bely
2023-03-03 9:10 ` Henning Schild
2023-03-03 13:57 ` Uladzimir Bely [this message]
2023-03-06 6:12 ` Uladzimir Bely
2023-03-06 6:12 ` Uladzimir Bely
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=2173862.hkbZ0PkbqX@hp \
--to=ubely@ilbers.de \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.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