From: chrubis@suse.cz
To: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
Cc: ltp-list <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH v2] open/open12.c: add new tests
Date: Wed, 14 May 2014 17:07:42 +0200 [thread overview]
Message-ID: <20140514150741.GA6175@rei> (raw)
In-Reply-To: <1396589471.2098.6.camel@G08JYZSD130126>
Hi!
Pushed with following changes, thanks.
diff --git a/testcases/kernel/syscalls/open/open12.c b/testcases/kernel/syscalls/open/open12.c
index 8b78b83..5b7576b 100644
--- a/testcases/kernel/syscalls/open/open12.c
+++ b/testcases/kernel/syscalls/open/open12.c
@@ -86,7 +86,7 @@ static void setup(void)
static void test_append(void)
{
- off_t len;
+ off_t len1, len2;
TEST(open(TEST_FILE, O_RDWR | O_APPEND, 0777));
@@ -95,11 +95,12 @@ static void test_append(void)
return;
}
+ len1 = SAFE_LSEEK(cleanup, TEST_RETURN, 0, SEEK_CUR);
SAFE_WRITE(cleanup, 1, TEST_RETURN, TEST_FILE, sizeof(TEST_FILE));
- len = SAFE_LSEEK(cleanup, TEST_RETURN, 0, SEEK_CUR);
+ len2 = SAFE_LSEEK(cleanup, TEST_RETURN, 0, SEEK_CUR);
SAFE_CLOSE(cleanup, TEST_RETURN);
- if (len > (off_t)sizeof(TEST_FILE))
+ if (len2 > len1)
tst_resm(TPASS, "test O_APPEND for open success");
else
tst_resm(TFAIL, "test O_APPEND for open failed");
This makes the test better on -i N (because the len would be greater
than the initial lenght after the first append write no matter what).
@@ -118,10 +119,10 @@ static void test_noatime(void)
return;
}
- if (tst_path_has_mnt_flags(TEST_FILE, flags)) {
+ if (tst_path_has_mnt_flags(cleanup, NULL, flags)) {
tst_resm(TCONF,
"test O_NOATIME flag for open needs filesystems which "
- "are mounted without noatime and relatime");
+ "is mounted without noatime and relatime");
return;
}
This fixes the tst_path_has_mnt_flags() usage. The path to this function
must be full path (not just filename). I've changed the library to use
tst_tmpdir path if NULL is passed as a path (which simplifies the
usage).
@@ -173,7 +174,7 @@ static void test_cloexec(void)
if (pid == 0) {
if (execlp("open12_cloexec", "open12_cloexec", buf, NULL))
- exit(1);
+ exit(2);
}
SAFE_CLOSE(cleanup, TEST_RETURN);
@@ -183,13 +184,14 @@ static void test_cloexec(void)
if (WIFEXITED(status)) {
switch ((int8_t)WEXITSTATUS(status)) {
- case -1:
+ case 0:
tst_resm(TPASS, "test O_CLOEXEC for open success");
- break;
+ break;
case 1:
- tst_brkm(TBROK, cleanup, "execlp() failed");
- default:
tst_resm(TFAIL, "test O_CLOEXEC for open failed");
+ break;
+ default:
+ tst_brkm(TBROK, cleanup, "execlp() failed");
}
} else {
tst_brkm(TBROK, cleanup,
diff --git a/testcases/kernel/syscalls/open/open12_cloexec.c b/testcases/kernel/syscalls/open/open12_cloexec.c
index 5b55a05..a6dabd5 100644
--- a/testcases/kernel/syscalls/open/open12_cloexec.c
+++ b/testcases/kernel/syscalls/open/open12_cloexec.c
@@ -26,12 +26,12 @@ int main(int argc, char **argv)
int fd;
if (argc != 2) {
- fprintf(stderr, "Only two arguments: %s <fd>", argv[0]);
+ fprintf(stderr, "Only two arguments: %s <fd>\n", argv[0]);
exit(1);
}
fd = atoi(argv[1]);
ret = write(fd, argv[1], strlen(argv[1]));
- exit(ret);
+ return ret != -1;
}
This fixes the return values, because as it was return value 1 was
assigned to both failed execlp() and failed testcase (write() succeded
and returned size of the written data which was 1).
Now execlp failure maps to 2, testcase failure to 1 and success to 0 (in
accordance with shell 0 == succes).
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2014-05-14 15:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-09 8:12 [LTP] [PATCH 1/2] lapi: fcntl.h: Add O_NOATIME Zeng Linggang
2014-03-09 8:14 ` [LTP] [PATCH 2/2] open/open12.c: add new tests Zeng Linggang
2014-03-11 15:43 ` chrubis
[not found] ` <1394716096.2087.10.camel@G08JYZSD130126>
[not found] ` <1394716306.2087.14.camel@G08JYZSD130126>
2014-04-01 16:14 ` [LTP] [PATCH v2 4/4] " chrubis
[not found] ` <1396589471.2098.6.camel@G08JYZSD130126>
2014-05-14 15:07 ` chrubis [this message]
[not found] ` <1394716248.2087.13.camel@G08JYZSD130126>
2014-04-01 16:14 ` [LTP] [PATCH v2 3/4] open/open02.c: add EPERM errno test chrubis
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=20140514150741.GA6175@rei \
--to=chrubis@suse.cz \
--cc=ltp-list@lists.sourceforge.net \
--cc=zenglg.jy@cn.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox