On 18/11/2024 13.56, Daniel P. Berrangé wrote:
On Mon, Nov 18, 2024 at 01:10:14PM +0100, Thomas Huth wrote:
On 18/11/2024 11.57, Peter Maydell wrote:
I just ran out of disk space on my dev machine, because:

$ du -h build/clang/tests/functional/
[...]
11G     build/clang/tests/functional/

That's indeed a lot. I only got 6.9G in my build tree for all targets ... I
guess there are some stale files lying around, so as a temporary mitigation,
just try to delete that folder (it should get recreated the next time you
run the tests).

The new functional tests seem to be eating disk space.

Even the build tree I have that's just arm targets is 7.1GB.

Could you have a look at what's happening here?

I am aware of the problem and got it on my TODO list already... I think we
best should set the "workdir" to a temporary folder that we can remove once
the test has finished, that will automatically delete all binary assets that
the test created during its runtime.

workdir also stores the logs currently, which we want to preserve, but we
can just move assets to a sub-tree instead. Something approx like this:

Yes, this is pretty much similar to what I had in mind! ... do you maybe want to send it as a proper patch?

@@ -40,11 +42,11 @@ def setUp(self, bin_prefix):
          self.assertIsNotNone(self.qemu_bin, 'QEMU_TEST_QEMU_BINARY must be 
set')
          self.arch = self.qemu_bin.split('-')[-1]
- self.workdir = os.path.join(BUILD_DIR, 'tests/functional', self.arch,
-                                    self.id())
-        os.makedirs(self.workdir, exist_ok=True)
+        self.outputdir = Path(BUILD_DIR, 'tests', 'functional', self.arch, 
self.id())
+        self.workdir = Path(self.outputdir, 'scratch')
+        self.workdir.mkdir(parents=True, exist_ok=True)
- self.logdir = self.workdir
+        self.logdir = self.outputdir
          self.log_filename = os.path.join(self.logdir, 'base.log')
          self.log = logging.getLogger('qemu-test')
          self.log.setLevel(logging.DEBUG)
@@ -56,6 +58,8 @@ def setUp(self, bin_prefix):
          self.log.addHandler(self._log_fh)
def tearDown(self):
+        if not "QEMU_TEST_SKIP_RMTREE" in os.environ:

I'd maybe call it "QEMU_TEST_KEEP_SCRATCHDIR" instead... but that's just bikeshedpainting.

Anyway, we'd then also need to document the env variable in docs/devel/testing/functional.rst, I think.

 Thomas


+            shutil.rmtree(self.workdir)
          self.log.removeHandler(self._log_fh)



Reply via email to