qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, "Ani Sinha" <anisinha@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: [PATCH 02/15] tests/functional: automatically clean up scratch files after tests
Date: Tue, 19 Nov 2024 18:28:03 +0100	[thread overview]
Message-ID: <fb3e6a04-acf3-45b2-954c-bad769a81c3f@redhat.com> (raw)
In-Reply-To: <87frnnp53d.fsf@draig.linaro.org>

On 19/11/2024 17.21, Alex Bennée wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
> 
>> The build/tests/functional subdirectories are consuming huge amounts
>> of disk space.
>>
>> Split the location for scratch files into a 'scratch' sub-directory,
>> separate from log files, and delete it upon completion of each test.
>> The new env variable QEMU_TEST_KEEP_SCRATCH can be set to preserve
>> this scratch dir for debugging access if required.
>>
>> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>> ---
>>   docs/devel/testing/functional.rst      |  6 ++++++
>>   tests/functional/qemu_test/testcase.py | 14 +++++++++-----
>>   2 files changed, 15 insertions(+), 5 deletions(-)
>>
>> diff --git a/docs/devel/testing/functional.rst b/docs/devel/testing/functional.rst
>> index bf6f1bb81e..6b5d0c5b98 100644
>> --- a/docs/devel/testing/functional.rst
>> +++ b/docs/devel/testing/functional.rst
>> @@ -65,6 +65,12 @@ to the QEMU binary that should be used for the test, for example::
>>     $ export QEMU_TEST_QEMU_BINARY=$PWD/qemu-system-x86_64
>>     $ python3 ../tests/functional/test_file.py
>>   
>> +The test framework will automatically purge any scratch files created during
>> +the tests. If needing to debug a failed test, it is possible to keep these
>> +files around on disk by setting ```QEMU_TEST_KEEP_SCRATCH=1``` as an env
>> +variable.  Any preserved files will be deleted the next time the test is run
>> +without this variable set.
>> +
>>   Overview
>>   --------
>>   
>> diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py
>> index 411978b5ef..b9418e2ac0 100644
>> --- a/tests/functional/qemu_test/testcase.py
>> +++ b/tests/functional/qemu_test/testcase.py
>> @@ -13,8 +13,9 @@
>>   
>>   import logging
>>   import os
>> -import subprocess
>>   import pycotap
>> +import shutil
>> +import subprocess
>>   import sys
>>   import unittest
>>   import uuid
>> @@ -40,11 +41,12 @@ 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())
>> +        self.outputdir = os.path.join(BUILD_DIR, 'tests', 'functional',
>> +                                      self.arch, self.id())
> 
> I don't think you need save self.outputdir as only self.logdir is used
> by the other functions.

I guess it might be useful to have this variable as a reference point in 
future patches, so I'm in favor of keeping it.

Reviewed-by: Thomas Huth <thuth@redhat.com>



  reply	other threads:[~2024-11-19 17:28 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 15:05 [PATCH 00/15] test/functional: improve functional test debugging & fix tuxrun Daniel P. Berrangé
2024-11-19 15:05 ` [PATCH 01/15] tests/functional: fix mips64el test to honour workdir Daniel P. Berrangé
2024-11-19 15:35   ` Alex Bennée
2024-11-19 17:08   ` Philippe Mathieu-Daudé
2024-11-19 15:05 ` [PATCH 02/15] tests/functional: automatically clean up scratch files after tests Daniel P. Berrangé
2024-11-19 16:21   ` Alex Bennée
2024-11-19 17:28     ` Thomas Huth [this message]
2024-11-19 15:05 ` [PATCH 03/15] tests/functional: remove "AVOCADO" from env variable name Daniel P. Berrangé
2024-11-19 16:22   ` Alex Bennée
2024-11-19 17:09   ` Philippe Mathieu-Daudé
2024-11-19 15:05 ` [PATCH 04/15] tests/functional: remove todo wrt avocado.utils.wait_for Daniel P. Berrangé
2024-11-19 16:37   ` Alex Bennée
2024-11-19 15:05 ` [PATCH 05/15] tests/functional: remove leftover :avocado: tags Daniel P. Berrangé
2024-11-19 16:37   ` Alex Bennée
2024-11-19 15:05 ` [PATCH 06/15] tests/functional: remove obsolete reference to avocado bug Daniel P. Berrangé
2024-11-19 16:39   ` Alex Bennée
2024-11-19 15:05 ` [PATCH 07/15] tests/functional: remove comments talking about avocado Daniel P. Berrangé
2024-11-19 17:32   ` Thomas Huth
2024-11-19 15:05 ` [PATCH 08/15] tests/functional: honour self.workdir in ACPI bits tests Daniel P. Berrangé
2024-11-19 17:09   ` Alex Bennée
2024-11-19 15:05 ` [PATCH 09/15] tests/functional: put QEMUMachine logs in testcase log directory Daniel P. Berrangé
2024-11-19 17:10   ` Alex Bennée
2024-11-19 15:05 ` [PATCH 10/15] tests/functional: honour requested test VM name in QEMUMachine Daniel P. Berrangé
2024-11-19 17:40   ` Thomas Huth
2024-11-19 15:05 ` [PATCH 11/15] tests/functional: enable debug logging for QEMUMachine Daniel P. Berrangé
2024-11-21  6:52   ` Thomas Huth
2024-11-19 15:05 ` [PATCH 12/15] tests/functional: logs details of console interaction operations Daniel P. Berrangé
2024-11-21  6:58   ` Thomas Huth
2024-11-19 15:05 ` [PATCH 13/15] tests/functional: rewrite console handling to be bytewise Daniel P. Berrangé
2024-11-19 17:11   ` Paolo Bonzini
2024-11-19 18:54     ` Daniel P. Berrangé
2024-11-19 19:26       ` Paolo Bonzini
2024-11-19 15:05 ` [PATCH 14/15] tests/functional: remove time.sleep usage from tuxrun tests Daniel P. Berrangé
2024-11-19 15:05 ` [PATCH 15/15] tests/functional: add a QMP backdoor for debugging stalled tests Daniel P. Berrangé
2024-11-21  7:01   ` Thomas Huth
2024-11-19 17:59 ` [PATCH 00/15] test/functional: improve functional test debugging & fix tuxrun Cédric Le Goater

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=fb3e6a04-acf3-45b2-954c-bad769a81c3f@redhat.com \
    --to=thuth@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=anisinha@redhat.com \
    --cc=berrange@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).