From: James Dong =?unknown-8bit?b?6JGj5LiW5rGf?= <dongshijiang@inspur.com>
To: ltp@lists.linux.it
Subject: [LTP] 答复: 答复: [PATCH] ltp-aiodio/dio_append: fix dio_append()
Date: Fri, 4 Jun 2021 02:37:26 +0000 [thread overview]
Message-ID: <eddbe134055240cb8889b4df76404c1d@inspur.com> (raw)
In-Reply-To: <60B98598.7000905@fujitsu.com>
Hi xuyang
Thank you very much for your reply, but I think we should add the judgment of the return value in the "dio_append" function, because the final return value is 0 regardless of whether the test item passes or not, and 0 means PASS.
-----????-----
???: xuyang2018.jy@fujitsu.com [mailto:xuyang2018.jy@fujitsu.com]
????: 2021?6?4? 9:44
???: James Dong (???) <dongshijiang@inspur.com>
??: ltp@lists.linux.it
??: Re: ??: [LTP] [PATCH] ltp-aiodio/dio_append: fix dio_append()
Hi Dong
Please see ltp/testcases/kernel/io/ltp-aiodio/README
it said "
Run the ltp-aiodio.sh file to execute all the tests. The tests can also be run individually, just execute the program and the excepted params will be output. No scripts were created to run the test standalone."
So use runltp to excute ltp-aiodio.part4 wasn't supported.
Zorro and Cyril also discuss about ltp-aiodio directory/file non-existed problem. Please see the following url.
https://patchwork.ozlabs.org/project/ltp/patch/20210601155427.996321-1-zlang@redhat.com/
Best Regards
Yang Xu
> Hi xuyang
> 1. if not create directory, in the function dio_append The open file returns a failure, Because the directory "aiodio" does not exist.
> 2. The mkdir command is called to recursively create directories
>
> -----????-----
> ???: xuyang2018.jy@fujitsu.com [mailto:xuyang2018.jy@fujitsu.com]
> ????: 2021?6?3? 18:05
> ???: James Dong (???)<dongshijiang@inspur.com>
> ??: ltp@lists.linux.it
> ??: Re: [LTP] [PATCH] ltp-aiodio/dio_append: fix dio_append()
>
> Hi dong
>> When running the dio_append test in the ltp-aiodiio.part4 test item, there was a problem that the file could not be created, but the test result was PASS. To this end, the following operations have been added.
>> 1. create the directory where the file is located.
> Why need to create directory?
>> 2. rewrite the dio_append API. Add relevant return values.
>>
>> Signed-off-by: dongshijiang<dongshijiang@inspur.com>
>> ---
>> testcases/kernel/io/ltp-aiodio/dio_append.c | 26 +++++++++++++++------
>> 1 file changed, 19 insertions(+), 7 deletions(-)
>>
>> diff --git a/testcases/kernel/io/ltp-aiodio/dio_append.c
>> b/testcases/kernel/io/ltp-aiodio/dio_append.c
>> index 3f0ed29d5..500dfdc31 100644
>> --- a/testcases/kernel/io/ltp-aiodio/dio_append.c
>> +++ b/testcases/kernel/io/ltp-aiodio/dio_append.c
>> @@ -75,7 +75,7 @@ int read_eof(char *filename)
>> return 0;
>> }
>>
>> -void dio_append(char *filename)
>> +int dio_append(char *filename)
>> {
>> int fd;
>> void *bufptr;
>> @@ -86,14 +86,14 @@ void dio_append(char *filename)
>>
>> if (fd< 0) {
>> perror("cannot create file");
>> - return;
>> + return 1;
>> }
>>
>> TEST(posix_memalign(&bufptr, 4096, 64 * 1024));
>> if (TEST_RETURN) {
>> tst_resm(TBROK | TRERRNO, "cannot malloc aligned memory");
>> close(fd);
>> - return;
>> + return 1;
>> }
>>
>> memset(bufptr, 0, 64 * 1024);
>> @@ -102,17 +102,29 @@ void dio_append(char *filename)
>> fprintf(stderr, "write %d returned %d\n", i, w);
>> }
>> }
>> + return 0;
>> }
>>
>> int main(void)
>> {
>> - char filename[PATH_MAX];
>> + char filename[PATH_MAX], filepath[PATH_MAX-5];
>> int pid[NUM_CHILDREN];
>> int num_children = 1;
>> int i;
>> + int ret = -1;
>>
>> - snprintf(filename, sizeof(filename), "%s/aiodio/file",
>> + snprintf(filepath, sizeof(filepath), "%s/aiodio",
>> getenv("TMP") ? getenv("TMP") : "/tmp");
>> +
>> + if (access(filepath, F_OK) == -1) {
>> + char command[PATH_MAX + 10];
>> +
>> + snprintf(command, sizeof(command), "mkdir -p %s", filepath);
>> + if (system(command) != 0)
>> + return 1;
> just only call mkdir syscall instead of command.
>> + }
>> +
>> + snprintf(filename, sizeof(filename), "%s/file", filepath);
>>
>> printf("Begin dio_append test...\n");
>>
>> @@ -134,10 +146,10 @@ int main(void)
>> * Parent appends to end of file using direct i/o
>> */
>>
>> - dio_append(filename);
>> + ret = dio_append(filename);
>>
>> for (i = 0; i< num_children; i++) {
>> kill(pid[i], SIGTERM);
>> }
>> - return 0;
>> + return ret;
>> }
next prev parent reply other threads:[~2021-06-04 2:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-03 7:57 [LTP] [PATCH] ltp-aiodio/dio_append: fix dio_append() dongshijiang
2021-06-03 10:04 ` xuyang2018.jy
2021-06-03 10:27 ` [LTP] 答复: " James Dong =?unknown-8bit?b?6JGj5LiW5rGf?=
2021-06-04 1:44 ` xuyang2018.jy
2021-06-04 2:37 ` James Dong =?unknown-8bit?b?6JGj5LiW5rGf?= [this message]
2021-06-04 3:53 ` [LTP] 答复: " xuyang2018.jy
2021-06-04 6:19 ` [LTP] 答复: " James Dong =?unknown-8bit?b?6JGj5LiW5rGf?=
2021-06-04 6:50 ` [LTP] " Petr Vorel
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=eddbe134055240cb8889b4df76404c1d@inspur.com \
--to=dongshijiang@inspur.com \
--cc=ltp@lists.linux.it \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox