qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: qemu-devel@nongnu.org
Cc: "Juan Quintela" <quintela@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Laurent Vivier" <lvivier@redhat.com>
Subject: [RFC PATCH 1/2] tests/qtest: Add a script to gather migration tests list
Date: Mon,  3 Jul 2023 11:46:59 -0300	[thread overview]
Message-ID: <20230703144700.13536-2-farosas@suse.de> (raw)
In-Reply-To: <20230703144700.13536-1-farosas@suse.de>

This is a workaround for limitations with meson.

We'd like to have each migration (sub)test registered with meson's
test() function, but since they are all inside the single
migration-test.c there's no way for meson to see the tests. We need an
external way to generate the list of tests and pass it to meson.

We cannot call 'migration-test -l' because we'd need to build the
migration-test binary first and while that is possible, there's no
subsequent way to get the generated list into a meson variable for
consumption. None of meson's routines support retrieving an arbitrary
list of strings from a command at build (vs. configure) time.

We also cannot use generators to have 'migration-test' write to a file
because that would happen at build time and meson does not support
reading from a file in the build directory.

So the only approach left is to either have the list of tests
committed into the source code or to grep the source code for the
list. Committing the file would be harder to maintain and the test
registration in migration-test.c is pretty static, so this patch uses
the grep approach. But using python because it is more portable.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/gen_migration_tests_list.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/qtest/gen_migration_tests_list.py

diff --git a/tests/qtest/gen_migration_tests_list.py b/tests/qtest/gen_migration_tests_list.py
new file mode 100644
index 0000000000..5127f976fa
--- /dev/null
+++ b/tests/qtest/gen_migration_tests_list.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+import re
+import sys
+
+file_path = sys.argv[1]
+
+with open(file_path, 'r') as f:
+    for line in f.readlines():
+        match = re.search('\"(/migration/.*)\"', line)
+        if match:
+            print(match.groups()[0])
-- 
2.35.3



  reply	other threads:[~2023-07-03 14:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 14:46 [RFC PATCH 0/2] tests/qtest: Run migration subtests via meson Fabiano Rosas
2023-07-03 14:46 ` Fabiano Rosas [this message]
2023-07-03 14:47 ` [RFC PATCH 2/2] tests/qtest: Pass migration tests individually to meson Fabiano Rosas
2023-07-03 15:17 ` [RFC PATCH 0/2] tests/qtest: Run migration subtests via meson Daniel P. Berrangé

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=20230703144700.13536-2-farosas@suse.de \
    --to=farosas@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).