[LTP] [PATCH v5 2/2] firmware/fw_load: add fw_load02 for custom firmware path

Cyril Hrubis chrubis@suse.cz
Thu Jun 11 11:26:34 CEST 2026


Hi!
> +static void setup(void)
> +{
> +	char fw_size_param[32];
> +	char *tmpdir = tst_tmpdir_path();
> +	struct tst_path_val fw_path = {
> +		.path = FW_PATH,
> +		.val = tmpdir,
> +		.flags = TST_SR_TCONF,
> +	};
> +
> +	tst_requires_module_signature_disabled();
> +
> +	/*
> +	 * Point the kernel firmware loader at our writable tmpdir so the
> +	 * test does not depend on a writable /lib/firmware. The previous
> +	 * value is restored automatically during cleanup.
> +	 */
> +	tst_sys_conf_save(&fw_path);

I would say that it's cleaner to add the save_restore to the tst_test
structure without the tmpdir value and use
SAFE_FILE_PRINTF(FW_PATH, "%s", tmpdir) in the test setup. Since if the
test crashes the test library will still restore the FW_PATH

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list