All of lore.kernel.org
 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 v6 2/4] fw_load: rewrite test using new LTP API
Date: Mon, 15 Jun 2026 13:33:00 +0200	[thread overview]
Message-ID: <ai_i7H1Vfoy5H4oP@yuki.lan> (raw)
In-Reply-To: <20260611-fw_load-v6-2-c2aec79a7ed7@suse.com>

Hi!
> +static void run(void)
>  {
> -	setup(argc, argv);
> +	struct fw_data *fw;
> +	int result = 0;
> +	int fail, offset;
>  
> -	test_run();
> +	SAFE_FILE_PRINTF(DEV_FWNUM, "%d", fw_count);
> +	SAFE_FILE_SCANF(DEV_RESULT, "%d", &result);
>  
> -	cleanup();
> +	for (int i = 0; i < fw_count; i++) {
> +		fw = &firmware[i];
>  
> -	tst_exit();
> -}
> +		fail = (result & (1 << i)) == 0 && !fw->fake;
> +		offset = fw->dir[0] ? strlen(fw->dir) : 0;
>  
> -static void help(void)
> -{
> -	printf("  -n x    Write x bytes to firmware file, default is %d\n",
> -		fw_size);
> -	printf("  -s      Skip cleanup\n");
> -	printf("  -v      Verbose\n");
> +		if (fw->fake) {
> +			tst_res(result & (1 << i) ? TFAIL : TPASS,
> +				"Firmware '%s' correctly not loaded",
> +				fw->file + offset);
> +		} else {
> +			tst_res(fail ? TFAIL : TPASS,
> +				"Firmware '%s' loaded",
> +				fw->file + offset);
> +		}

If you are splitting the tst_res() by the fw->fake then do it right. We
should drop the && !fw->fake from the fail above and use a variable
only to get the right bit from the result:

int pass = result && (1<<i);

if (fw->fake)
	tst_res(pass ? TFAIL : TPASS, ...)
else
	tst_res(pass ? TPASS : TFAIL, ...)


> +	}
>  }
>  
> -void setup(int argc, char *argv[])
> +static void setup(void)
>  {
> -	if (tst_lockdown_enabled() > 0 || tst_secureboot_enabled() > 0)
> -		tst_brkm(TCONF, NULL, "Cannot load unsigned modules in Lockdown/Secure Boot");

I assume that we dropped this because we have
tst_requires_module_signature_disabled() later in the setup() right?


The rest looks good.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2026-06-15 11:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 13:44 [LTP] [PATCH v6 0/4] Rewrite fw_load test using new API Andrea Cervesato
2026-06-11 13:44 ` [LTP] [PATCH v6 1/4] fw_load: Modernize ltp_fw_load kernel module Andrea Cervesato
2026-06-11 14:44   ` [LTP] " linuxtestproject.agent
2026-06-15 11:03   ` [LTP] [PATCH v6 1/4] " Cyril Hrubis
2026-06-11 13:44 ` [LTP] [PATCH v6 2/4] fw_load: rewrite test using new LTP API Andrea Cervesato
2026-06-15 11:33   ` Cyril Hrubis [this message]
2026-06-15 11:50     ` Andrea Cervesato via ltp
2026-06-11 13:44 ` [LTP] [PATCH v6 3/4] fw_load: merge module and test into fw_load folder Andrea Cervesato
2026-06-11 13:44 ` [LTP] [PATCH v6 4/4] fw_load: add fw_load02 for custom firmware path Andrea Cervesato
2026-06-15 11:49   ` Cyril Hrubis
2026-06-15 12:01     ` Andrea Cervesato via ltp

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=ai_i7H1Vfoy5H4oP@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.