[LTP] [PATCH v1] Add chdir05 test
Cyril Hrubis
chrubis@suse.cz
Fri Feb 2 18:17:40 CET 2024
Hi!
> +/*\
> + * [Description]
> + *
> + * This test verifies that chdir() is working correctly on symlink()
> + * generated files.
> + */
> +
> +#include "tst_test.h"
> +
> +static void test_chdir(void)
> +{
> + char *symname = "my_symlink0";
> +
> + SAFE_SYMLINK(tst_get_tmpdir(), symname);
> + TST_EXP_PASS(chdir(symname));
> +
> + SAFE_UNLINK(symname);
> +}
> +
> +static void test_chdir_no_path(void)
> +{
> + char *symname = "my_symlink1";
> +
> + SAFE_SYMLINK("bc+eFhi!k", symname);
> + TST_EXP_FAIL(chdir(symname), ENOENT);
> +
> + SAFE_UNLINK(symname);
> +}
This two should go to chdir01.c and possibly chdir01 should be split
into positive cases and negative cases when you are at it.
> +static void test_chdir_loop(void)
> +{
> + char *symname = "my_symlink2";
> +
> + TST_EXP_PASS(symlink(symname, symname));
> + TST_EXP_FAIL(chdir(symname), ELOOP);
> +
> + SAFE_UNLINK(symname);
> +}
This is already in chdir01.c
> +static void run(void)
> +{
> + test_chdir();
> + test_chdir_no_path();
> + test_chdir_loop();
> +}
> +
> +static struct tst_test test = {
> + .test_all = run,
> + .needs_tmpdir = 1,
> +};
> --
> 2.35.3
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list