From: Cyril Hrubis <chrubis@suse.cz>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] linkat01: Convert to new API
Date: Tue, 19 Mar 2024 16:31:08 +0100 [thread overview]
Message-ID: <ZfmvvAQXol3rYCg_@yuki> (raw)
In-Reply-To: <20240203043813.2798-1-xuyang2018.jy@fujitsu.com>
Hi!
> +} tcases[] = {
> /* 1. relative paths */
> - {
> - &olddirfd, TEST_FILE1, &newdirfd, TEST_FILE1, 0,
> - TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> - /* 2. abs path at source */
> - {
> - &olddirfd, spathname, &newdirfd, TEST_FILE1, 0, 0, 0, 0},
> - /* 3. abs path at dst */
> - {
> - &olddirfd, TEST_FILE1, &newdirfd, dpathname, 0,
> - TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> - /* 4. relative paths to cwd */
> - {
> - &cwd_fd, TEST_DIR1 "/" TEST_FILE1, &newdirfd, TEST_FILE1, 0,
> - TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> - /* 5. relative paths to cwd */
> - {
> - &olddirfd, TEST_FILE1, &cwd_fd, TEST_DIR2 "/" TEST_FILE1, 0,
> - TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> - /* 6. abs path at source */
> - {
> - &cwd_fd, spathname, &newdirfd, TEST_FILE1, 0, 0, 0, 0},
> - /* 7. abs path at dst */
> - {
> - &olddirfd, TEST_FILE1, &cwd_fd, dpathname, 0,
> - TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> - /* 8. relative paths to invalid */
> - {
> - &stdinfd, TEST_DIR1 "/" TEST_FILE1, &newdirfd, TEST_FILE1, 0,
> - 0, 0, ENOTDIR},
> - /* 9. relative paths to invalid */
> - {
> - &olddirfd, TEST_FILE1, &stdinfd, TEST_DIR2 "/" TEST_FILE1, 0,
> - 0, 0, ENOTDIR},
> - /* 10. abs path at source */
> - {
> - &stdinfd, spathname, &newdirfd, TEST_FILE1, 0, 0, 0, 0},
> - /* 11. abs path at dst */
> - {
> - &olddirfd, TEST_FILE1, &stdinfd, dpathname, 0,
> - TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> - /* 12. relative paths to bad */
> - {
> - &badfd, TEST_DIR1 "/" TEST_FILE1, &newdirfd, TEST_FILE1, 0,
> - 0, 0, EBADF},
> - /* 13. relative paths to bad */
> - {
> - &olddirfd, TEST_FILE1, &badfd, TEST_DIR2 "/" TEST_FILE1, 0,
> - 0, 0, EBADF},
> - /* 14. abs path at source */
> - {
> - &badfd, spathname, &newdirfd, TEST_FILE1, 0, 0, 0, 0},
> - /* 15. abs path at dst */
> - {
> - &olddirfd, TEST_FILE1, &badfd, dpathname, 0,
> - TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> - /* 16. relative paths to deleted */
> - {
> - &deldirfd, TEST_DIR1 "/" TEST_FILE1, &newdirfd, TEST_FILE1, 0,
> - 0, 0, ENOENT},
> - /* 17. relative paths to deleted */
> - {
> - &olddirfd, TEST_FILE1, &deldirfd, TEST_DIR2 "/" TEST_FILE1, 0,
> - 0, 0, ENOENT},
> - /* 18. abs path at source */
> - {
> - &deldirfd, spathname, &newdirfd, TEST_FILE1, 0, 0, 0, 0},
> - /* 19. abs path at dst */
> - {
> - &olddirfd, TEST_FILE1, &deldirfd, dpathname, 0,
> - TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> - /* 20. x-device link */
> - {
> - &cwd_fd, "/proc/cpuinfo", &newdirfd, TEST_FILE1, 0, 0, 0, EXDEV},
> - /* 21. directory link */
> - {
> - &olddirfd, ".", &newdirfd, TEST_FILE1, 0, 0, 0, EPERM},
> - /* 22. invalid flag */
> - {
> - &olddirfd, TEST_FILE1, &newdirfd, TEST_FILE1, 1, 0, 0, EINVAL},
> - /* 23. fifo link */
> - /* XXX (garrcoop): Removed because it hangs the overall test. Need to
> - * find a legitimate means to exercise this functionality, if in fact
> - * it's a valid testcase -- which it should be.
> - */
> - /* { &olddirfd, TEST_FIFO, &newdirfd, TEST_FILE1, 0,
> - TEST_DIR1"/"TEST_FIFO, TEST_DIR2"/"TEST_FILE1, 0 } */
> + {&olddirfd, TEST_FILE1, &newdirfd, TEST_FILE1, 0,
> + TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> + /* 2. absolution path at source */
> + {&olddirfd, spathname, &newdirfd, TEST_FILE1, 0, 0, 0, 0},
> + /* 3. absolution path at destination */
> + {&olddirfd, TEST_FILE1, &newdirfd, dpathname, 0,
> + TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> + /* 4. relative paths to cwd */
> + {&cwd_fd, TEST_DIR1 "/" TEST_FILE1, &newdirfd, TEST_FILE1, 0,
> + TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> + /* 5. cwd to relative paths */
> + {&olddirfd, TEST_FILE1, &cwd_fd, TEST_DIR2 "/" TEST_FILE1, 0,
> + TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> + /* 6. cwd to absolution paths */
> + {&cwd_fd, spathname, &newdirfd, TEST_FILE1, 0, 0, 0, 0},
> + /* 7. absolution paths to cwd */
> + {&olddirfd, TEST_FILE1, &cwd_fd, dpathname, 0,
> + TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> + /* 8. invalid directory to relative paths */
> + {&stdinfd, TEST_DIR1 "/" TEST_FILE1, &newdirfd, TEST_FILE1, 0,
> + 0, 0, ENOTDIR},
> + /* 9. relative paths to invalid directory */
> + {&olddirfd, TEST_FILE1, &stdinfd, TEST_DIR2 "/" TEST_FILE1, 0,
> + 0, 0, ENOTDIR},
> + /* 10. invalid directory to absolution paths */
> + {&stdinfd, spathname, &newdirfd, TEST_FILE1, 0, 0, 0, 0},
> + /* 11. absolution paths to invalid directory */
> + {&olddirfd, TEST_FILE1, &stdinfd, dpathname, 0,
> + TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> + /* 12. bad fd to relative paths */
> + {&badfd, TEST_DIR1 "/" TEST_FILE1, &newdirfd, TEST_FILE1, 0,
> + 0, 0, EBADF},
> + /* 13. relative paths to bad fd */
> + {&olddirfd, TEST_FILE1, &badfd, TEST_DIR2 "/" TEST_FILE1, 0,
> + 0, 0, EBADF},
> + /* 14. bad fd to absolution paths */
> + {&badfd, spathname, &newdirfd, TEST_FILE1, 0, 0, 0, 0},
> + /* 15. absolution paths to bad fd */
> + {&olddirfd, TEST_FILE1, &badfd, dpathname, 0,
> + TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> + /* 16. deleted to relative paths */
> + {&deldirfd, TEST_DIR1 "/" TEST_FILE1, &newdirfd, TEST_FILE1, 0,
> + 0, 0, ENOENT},
> + /* 17. relative paths to deleted */
> + {&olddirfd, TEST_FILE1, &deldirfd, TEST_DIR2 "/" TEST_FILE1, 0,
> + 0, 0, ENOENT},
> + /* 18. deleted to absolution paths */
> + {&deldirfd, spathname, &newdirfd, TEST_FILE1, 0, 0, 0, 0},
> + /* 19. absolution paths to deleted */
> + {&olddirfd, TEST_FILE1, &deldirfd, dpathname, 0,
> + TEST_DIR1 "/" TEST_FILE1, TEST_DIR2 "/" TEST_FILE1, 0},
> + /* 20. x-device link */
> + {&cwd_fd, "/proc/cpuinfo", &newdirfd, TEST_FILE1, 0, 0, 0, EXDEV},
> + /* 21. directory link */
> + {&olddirfd, ".", &newdirfd, TEST_FILE1, 0, 0, 0, EPERM},
> + /* 22. invalid flag */
> + {&olddirfd, TEST_FILE1, &newdirfd, TEST_FILE1, 1, 0, 0, EINVAL},
> };
Can we please split the test into two, one for positive test and one for
failures? The we can simplify the test function to simple TST_EXP_PASS()
and TST_EXP_FAIL() instead of the ugly if else maze.
> + TEST(tst_syscall(__NR_linkat, *tc->oldfd, tc->oldfn, *tc->newfd,
> + tc->newfn, tc->flags));
The linkat() function was added to glibc 2.4 there is no point in
calling it by tst_syscall() now, we can use the glibc prototype.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2024-03-19 15:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-03 4:38 [LTP] [PATCH] linkat01: Convert to new API Yang Xu via ltp
2024-03-19 15:31 ` Cyril Hrubis [this message]
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=ZfmvvAQXol3rYCg_@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=xuyang2018.jy@fujitsu.com \
/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.