Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH] metadata: automatically detect CVE via tags
Date: Mon, 22 Jun 2026 15:31:00 +0200	[thread overview]
Message-ID: <ajk5FKU8_KEBhMSU@yuki.lan> (raw)
In-Reply-To: <20260622-metadata_cve-v1-1-c8d43e0db19e@suse.com>

Hi!
>  /*
> - * Add a group to the groups array, skipping 'kernel' as it's too generic.
> - * Returns 0 if no group was added, 1 otherwise.
> + * Add a group to the groups array, skipping path components that are too
> + * generic ('kernel') or assigned from a more reliable source ('cve', which
> + * is derived from the CVE tag instead). Returns 0 if no group was added,
> + * 1 otherwise.
>   */
>  static int add_group(struct data_node *groups, const char *name)
>  {
> -	if (name && strcmp(name, "kernel")) {
> +	if (name && strcmp(name, "kernel") && strcmp(name, "cve")) {
>  		data_node_array_add(groups, data_node_string(name));
>  		return 1;
>  	}
> @@ -971,11 +973,11 @@ static void load_internal_macros(void)
>   * Add groups derived from the source file path.
>   *
>   * Groups are the two nearest parent directories (immediate parent
> - * first), skipping 'kernel' as it's too generic:
> + * first), skipping 'kernel' (too generic) and 'cve' (assigned from the
> + * CVE tag instead, see add_tag_groups()):
>   *
>   *   testcases/kernel/syscalls/clone/clone01.c  -> clone, syscalls
>   *   testcases/kernel/kvm/kvm_pagefault01.c     -> kvm
> - *   testcases/cve/cve-2017-16939.c             -> cve
>   */
>  static void add_path_groups(struct data_node *groups, const char *fname)
>  {
> @@ -1010,6 +1012,35 @@ static void add_path_groups(struct data_node *groups, const char *fname)
>  	free(buf);
>  }
>  
> +/*
> + * Add group to specific test tags.
> + */
> +static void add_tag_groups(struct data_node *groups, struct data_node *res)
> +{
> +	struct data_node *tags = data_node_hash_get(res, "tags");
> +	unsigned int i;
> +
> +	if (!tags || tags->type != DATA_ARRAY)
> +		return;
> +
> +	for (i = 0; i < data_node_array_len(tags); i++) {
> +		struct data_node *tag = tags->array.array[i];
> +		struct data_node *name;
> +
> +		if (tag->type != DATA_ARRAY || !data_node_array_len(tag))
> +			continue;
> +
> +		name = tag->array.array[0];
> +		if (name->type != DATA_STRING)
> +			continue;
> +
> +		if (!strcmp(name->string.val, "CVE")) {
> +			data_node_array_add(groups, data_node_string("cve"));
> +			return;
> +		}

We may as well add group "regression" if there is a linux-git tag
present.

Otherwise it looks good.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2026-06-22 13:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 12:10 [LTP] [PATCH] metadata: automatically detect CVE via tags Andrea Cervesato
2026-06-22 13:31 ` Cyril Hrubis [this message]

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=ajk5FKU8_KEBhMSU@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /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