[LTP] [PATCH v6] Add rename15 test

Cyril Hrubis chrubis@suse.cz
Thu Sep 12 16:56:32 CEST 2024


Hi!
> +static void test_non_existing(void)
> +{
> +	tst_res(TINFO, "Test rename() on symlink pointing to a non-existent path");
> +
> +	struct stat path_stat;
> +
> +	SAFE_SYMLINK("this_path_doesnt_exist", oldname);
> +	TST_EXP_FAIL(stat(oldname, &path_stat), ENOENT);

I meant to have here:

	TST_EXP_PASS(lstat(oldname, &path_stat));

> +	SAFE_RENAME(oldname, newname);
> +	TST_EXP_FAIL(stat(newname, &path_stat), ENOENT);

And here to add:

	TST_EXP_PASS(lstat(newname, &path_stat));

instead of the:

	TST_EXP_FAIL(access(oldname, F_OK), ENOENT);

> +	SAFE_UNLINK(newname);
> +}


That way we are sure that the actual symlinks were created and that we
get the enoent for the symlink target.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list