qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] docs/devel/testing: improvements on make check-acceptance
@ 2021-09-22 20:03 Willian Rampazzo
  2021-09-22 20:03 ` [PATCH v2 1/2] docs/devel/testing: add instruction to run a single acceptance test Willian Rampazzo
  2021-09-22 20:03 ` [PATCH v2 2/2] tests/Makefile: add AVOCADO_TEST_FILES option to make check-acceptance Willian Rampazzo
  0 siblings, 2 replies; 3+ messages in thread
From: Willian Rampazzo @ 2021-09-22 20:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Alex Bennée, Wainer dos Santos Moschetta, Cleber Rosa,
	Philippe Mathieu-Daudé

Improve the documentation about how to run a single test within a file
or all the tests from a file using the standalone avocado command.

Add a way to run specific tests using the `make check-acceptance` command.

GitLab pipeline: https://gitlab.com/willianrampazzo/qemu/-/pipelines/375517782

Changes from V1:
  - Rename TESTFILES to AVOCADO_TEST_FILES on patch 2
  - Add Suggested-by tag on patch 2

Willian Rampazzo (2):
  docs/devel/testing: add instruction to run a single acceptance test
  tests/Makefile: add AVOCADO_TEST_FILES option to make check-acceptance

 docs/devel/testing.rst | 41 +++++++++++++++++++++++++++++++++++++++++
 tests/Makefile.include |  5 ++++-
 2 files changed, 45 insertions(+), 1 deletion(-)

-- 
2.31.1




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] docs/devel/testing: add instruction to run a single acceptance test
  2021-09-22 20:03 [PATCH v2 0/2] docs/devel/testing: improvements on make check-acceptance Willian Rampazzo
@ 2021-09-22 20:03 ` Willian Rampazzo
  2021-09-22 20:03 ` [PATCH v2 2/2] tests/Makefile: add AVOCADO_TEST_FILES option to make check-acceptance Willian Rampazzo
  1 sibling, 0 replies; 3+ messages in thread
From: Willian Rampazzo @ 2021-09-22 20:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Alex Bennée, Wainer dos Santos Moschetta, Cleber Rosa,
	Philippe Mathieu-Daudé

Add instructions to the Acceptance tests section about running a
single test file or a test within the test file.

Signed-off-by: Willian Rampazzo <willianr@redhat.com>
---
 docs/devel/testing.rst | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index 4a0abbf23d..b03df34f7b 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -740,6 +740,20 @@ may be invoked by running:
 
   tests/venv/bin/avocado run $OPTION1 $OPTION2 tests/acceptance/
 
+It is also possible to run tests from a single file or a single test
+within a test file. To run tests from a single file within the build
+tree, use:
+
+ .. code::
+
+  tests/venv/bin/avocado run tests/acceptance/$TESTFILE
+
+To run a single test within a test file, use:
+
+ .. code::
+
+  tests/venv/bin/avocado run tests/acceptance/$TESTFILE:$TESTCLASS.$TESTNAME
+
 Manual Installation
 -------------------
 
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] tests/Makefile: add AVOCADO_TEST_FILES option to make check-acceptance
  2021-09-22 20:03 [PATCH v2 0/2] docs/devel/testing: improvements on make check-acceptance Willian Rampazzo
  2021-09-22 20:03 ` [PATCH v2 1/2] docs/devel/testing: add instruction to run a single acceptance test Willian Rampazzo
@ 2021-09-22 20:03 ` Willian Rampazzo
  1 sibling, 0 replies; 3+ messages in thread
From: Willian Rampazzo @ 2021-09-22 20:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Alex Bennée, Wainer dos Santos Moschetta, Cleber Rosa,
	Philippe Mathieu-Daudé

Add the possibility of running all the tests from a single file, or
multiple files, running a single test within a file or multiple tests
within multiple files using `make check-acceptance` and the
AVOCADO_TEST_FILES environment variable.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Willian Rampazzo <willianr@redhat.com>
---
 docs/devel/testing.rst | 27 +++++++++++++++++++++++++++
 tests/Makefile.include |  5 ++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index b03df34f7b..785f82fc65 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -732,6 +732,33 @@ available.  On Debian and Ubuntu based systems, depending on the
 specific version, they may be on packages named ``python3-venv`` and
 ``python3-pip``.
 
+To run a single test file, a couple of them, or a test within a file
+using the ``make check-acceptance`` command, set the ``AVOCADO_TEST_FILES``
+environment variable with the test files or test names. To run all
+tests from a single file, use:
+
+ .. code::
+
+  make check-acceptance AVOCADO_TEST_FILES=$FILEPATH
+
+The same is valid to run tests from multiple test files:
+
+ .. code::
+
+  make check-acceptance AVOCADO_TEST_FILES='$FILEPATH1 $FILEPATH2'
+
+To run a single test within a file, use:
+
+ .. code::
+
+  make check-acceptance AVOCADO_TEST_FILES=$FILEPATH:$TESTCLASS.$TESTNAME
+
+The same is valid to run single tests from multiple test files:
+
+ .. code::
+
+  make check-acceptance AVOCADO_TEST_FILES='$FILEPATH1:$TESTCLASS1.$TESTNAME1 $FILEPATH2:$TESTCLASS2.$TESTNAME2'
+
 The scripts installed inside the virtual environment may be used
 without an "activation".  For instance, the Avocado test runner
 may be invoked by running:
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 6e16c05f10..1f1b4aa089 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -88,6 +88,9 @@ clean-tcg: $(CLEAN_TCG_TARGET_RULES)
 TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
 TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
 TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
+ifndef AVOCADO_TEST_FILES
+	AVOCADO_TEST_FILES=tests/acceptance
+endif
 # Controls the output generated by Avocado when running tests.
 # Any number of command separated loggers are accepted.  For more
 # information please refer to "avocado --help".
@@ -130,7 +133,7 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images
             --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
             --filter-by-tags-include-empty --filter-by-tags-include-empty-key \
             $(AVOCADO_TAGS) \
-            $(if $(GITLAB_CI),,--failfast) tests/acceptance, \
+            $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TEST_FILES), \
             "AVOCADO", "tests/acceptance")
 
 # Consolidated targets
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-22 20:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-22 20:03 [PATCH v2 0/2] docs/devel/testing: improvements on make check-acceptance Willian Rampazzo
2021-09-22 20:03 ` [PATCH v2 1/2] docs/devel/testing: add instruction to run a single acceptance test Willian Rampazzo
2021-09-22 20:03 ` [PATCH v2 2/2] tests/Makefile: add AVOCADO_TEST_FILES option to make check-acceptance Willian Rampazzo

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).