public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH] testsuite: Cleanup after gpg import in repro_test
Date: Fri,  3 Mar 2023 08:19:07 +0100	[thread overview]
Message-ID: <20230303071907.3346-1-ubely@ilbers.de> (raw)

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)
+
     def perform_ccache_test(self, targets, **kwargs):
         def ccache_stats(dir, field):
             # Look ccache source's 'src/core/Statistic.hpp' for field meanings
-- 
2.20.1


             reply	other threads:[~2023-03-03  7:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03  7:19 Uladzimir Bely [this message]
2023-03-03  9:10 ` Henning Schild
2023-03-03 13:57   ` Uladzimir Bely
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=20230303071907.3346-1-ubely@ilbers.de \
    --to=ubely@ilbers.de \
    --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