[LTP] [PATCH v4 1/3] Filter mkfs version in tst_fs

Andrea Cervesato andrea.cervesato@suse.com
Wed Oct 9 15:52:14 CEST 2024


Hi

On 10/9/24 14:12, Cyril Hrubis wrote:
> Hi!
>>   	if (!op_token)
>> -		return;
>> +		goto error;
> This is not an error case, when we get NULL token it means that there is
> no version embedded in the string and that we should return 0 here. This
> does not cause any problems for us because we do not use the return
> value in the case that we pass commands without version, but we should
> stil be consistent here.
>
> That also means that in all the rest of the cases the op_token will be
> defined and we can use that directly instead of the op_msg.
>
>> diff --git a/lib/tst_test.c b/lib/tst_test.c
>> index d226157e0..4f4a53080 100644
>> --- a/lib/tst_test.c
>> +++ b/lib/tst_test.c
>> @@ -1250,6 +1250,7 @@ static const char *default_fs_type(void)
>>   static void do_setup(int argc, char *argv[])
>>   {
>>   	char *tdebug_env = getenv("LTP_ENABLE_DEBUG");
>> +	int ret = 0;
> This is now unused.
>
>>   	if (!tst_test)
>>   		tst_brk(TBROK, "No tests to run");
>> @@ -1310,7 +1311,7 @@ static void do_setup(int argc, char *argv[])
>>   		int i;
>>   
>>   		for (i = 0; (cmd = tst_test->needs_cmds[i]); ++i)
>> -			tst_check_cmd(cmd);
>> +			tst_check_cmd(cmd, 1);
>>   	}
>>   
>>   	if (tst_test->needs_drivers) {
>> @@ -1415,8 +1416,12 @@ static void do_setup(int argc, char *argv[])
>>   
>>   		tdev.fs_type = default_fs_type();
>>   
>> -		if (!tst_test->all_filesystems && count_fs_descs() <= 1)
>> +		if (!tst_test->all_filesystems && count_fs_descs() <= 1) {
>> +			if (tst_test->filesystems->mkfs_ver)
>> +				tst_check_cmd(tst_test->filesystems->mkfs_ver, 1);
>> +
>>   			prepare_device(tst_test->filesystems);
>> +		}
>>   	}
>>   
>>   	if (tst_test->needs_overlay && !tst_test->mount_device)
>> @@ -1805,6 +1810,9 @@ static int run_tcase_on_fs(struct tst_fs *fs, const char *fs_type)
>>   	tst_res(TINFO, "=== Testing on %s ===", fs_type);
>>   	tdev.fs_type = fs_type;
>>   
>> +	if (fs->mkfs_ver && tst_check_cmd(fs->mkfs_ver, 0))
>> +		return TCONF;
>> +
>>   	prepare_device(fs);
>>   
>>   	ret = fork_testrun();
>> @@ -1832,7 +1840,7 @@ static int run_tcases_per_fs(void)
>>   		if (!fs)
>>   			continue;
>>   
>> -		run_tcase_on_fs(fs, filesystems[i]);
>> +		ret = run_tcase_on_fs(fs, filesystems[i]);
> I've send a patch that fixes this separately with a proper Fixes: tag,
> it would make more sense if you added your reviewed by and I would apply
> that patch separately...

I already have a patch for it, I will send it soon.

Andrea

>
> Other than that:
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
>


More information about the ltp mailing list