On Tue, Mar 21, 2023 at 15:39:21 +0100, Martin Kletzander wrote:
On Thu, Mar 16, 2023 at 05:11:38PM +0100, Peter Krempa wrote:
> 'qemucapabilitiestest' and other users of the capability data can
> benefit from adding a discriminator string to have multiple instances
> for the same version+architecture tuple.
>
> This will in the future allow us to have specific capability versions
> for test cases which require a specific host feature or are based on a
> different operating system.
>
> Add the basic skeleton for parsing the variant string and passing it
> around into test cases.
>
> Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
> ---
> tests/domaincapstest.c | 5 +++++
> tests/qemucapabilitiesdata/README.rst | 17 ++++++++++++++++-
> tests/qemucapabilitiesnumbering.c | 5 ++++-
> tests/qemucapabilitiestest.c | 15 +++++++++------
> tests/qemucaps2xmltest.c | 9 ++++++---
> tests/testutilsqemu.c | 12 +++++++++++-
> tests/testutilsqemu.h | 1 +
> 7 files changed, 52 insertions(+), 12 deletions(-)
>
> diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
> index fbbed40c96..20163e0a72 100644
> --- a/tests/domaincapstest.c
> +++ b/tests/domaincapstest.c
> @@ -312,11 +312,16 @@ doTestQemu(const char *inputDir G_GNUC_UNUSED,
> const char *prefix G_GNUC_UNUSED,
> const char *version,
> const char *arch,
> + const char *variant,
> const char *suffix G_GNUC_UNUSED,
> void *opaque)
> {
> int ret = 0;
>
> + /* currently variant tests are not handled here */
> + if (STRNEQ(variant, ""))
> + return 0;
> +
> if (STREQ(arch, "x86_64")) {
> /* For x86_64 we test three combinations:
> *
> diff --git a/tests/qemucapabilitiesdata/README.rst
b/tests/qemucapabilitiesdata/README.rst
> index 0bf6c97284..749d59becf 100644
> --- a/tests/qemucapabilitiesdata/README.rst
> +++ b/tests/qemucapabilitiesdata/README.rst
> @@ -17,7 +17,7 @@ Naming
>
> Files in this directory have the following naming scheme::
>
> - caps_$QEMUVERSION_$ARCHITECTURE.$SUFFIX
> + caps_$QEMUVERSION_$ARCHITECTURE$VARIANT.$SUFFIX
>
I presume you are not describing it as:
caps_$QEMUVERSION_$ARCHITECTURE+$VARIANT.$SUFFIX
because you want the easier parsing/formatting, but it's a bit confusing
when other things are separated clearly.
Well, the variant can be empty and in that case the '+' separator should
not be used.
I can add both versions as an example with the + being explicit.
Internally the variant string always contains the + as it simplifies
construction of filenames.