From: Jan Stancek <jstancek@redhat.com>
To: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
Cc: ltp-list <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH v2 2/2] sbrk/sbrk02.c: add ENOMEM errno test
Date: Wed, 23 Apr 2014 07:29:16 -0400 (EDT) [thread overview]
Message-ID: <229210287.8574143.1398252556096.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1398225176.3850.3.camel@G08JYZSD130126>
----- Original Message -----
> From: "Zeng Linggang" <zenglg.jy@cn.fujitsu.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: "ltp-list" <ltp-list@lists.sourceforge.net>
> Sent: Wednesday, 23 April, 2014 5:52:56 AM
> Subject: [PATCH v2 2/2] sbrk/sbrk02.c: add ENOMEM errno test
>
> Add ENOMEM errno test for sbrk(2)
>
> Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
> ---
> runtest/ltplite | 1 +
> runtest/stress.part3 | 1 +
> runtest/syscalls | 1 +
> testcases/kernel/syscalls/.gitignore | 1 +
> testcases/kernel/syscalls/sbrk/sbrk02.c | 114
> ++++++++++++++++++++++++++++++++
Hi,
looks good to me. I saw sbrk02 taking up to couple seconds
to complete on some systems, but that seems acceptable.
If anyone objects, we could change setup() to increment
even more rapidly.
Regards,
Jan
> 5 files changed, 118 insertions(+)
> create mode 100644 testcases/kernel/syscalls/sbrk/sbrk02.c
>
> diff --git a/runtest/ltplite b/runtest/ltplite
> index ebe171e..26b7753 100644
> --- a/runtest/ltplite
> +++ b/runtest/ltplite
> @@ -653,6 +653,7 @@ rmdir04 rmdir04
> rmdir05 rmdir05
>
> sbrk01 sbrk01
> +sbrk02 sbrk02
>
> sched_get_priority_max01 sched_get_priority_max01
> sched_get_priority_max02 sched_get_priority_max02
> diff --git a/runtest/stress.part3 b/runtest/stress.part3
> index b21e44b..021decf 100644
> --- a/runtest/stress.part3
> +++ b/runtest/stress.part3
> @@ -563,6 +563,7 @@ rmdir04 rmdir04
> rmdir05 rmdir05
>
> sbrk01 sbrk01
> +sbrk02 sbrk02
>
> sched_get_priority_max01 sched_get_priority_max01
> sched_get_priority_max02 sched_get_priority_max02
> diff --git a/runtest/syscalls b/runtest/syscalls
> index fb3e59f..3adeb8a 100644
> --- a/runtest/syscalls
> +++ b/runtest/syscalls
> @@ -868,6 +868,7 @@ rt_sigqueueinfo01 rt_sigqueueinfo01
> rt_sigsuspend01 rt_sigsuspend01
>
> sbrk01 sbrk01
> +sbrk02 sbrk02
>
> sched_get_priority_max01 sched_get_priority_max01
> sched_get_priority_max02 sched_get_priority_max02
> diff --git a/testcases/kernel/syscalls/.gitignore
> b/testcases/kernel/syscalls/.gitignore
> index d5c7bac..cd51000 100644
> --- a/testcases/kernel/syscalls/.gitignore
> +++ b/testcases/kernel/syscalls/.gitignore
> @@ -706,6 +706,7 @@
> /rt_sigsuspend/rt_sigsuspend01
> /rt_sigtimedwait/rt_sigtimedwait01
> /sbrk/sbrk01
> +/sbrk/sbrk02
> /sched_get_priority_max/sched_get_priority_max01
> /sched_get_priority_max/sched_get_priority_max02
> /sched_get_priority_min/sched_get_priority_min01
> diff --git a/testcases/kernel/syscalls/sbrk/sbrk02.c
> b/testcases/kernel/syscalls/sbrk/sbrk02.c
> new file mode 100644
> index 0000000..8961fa9
> --- /dev/null
> +++ b/testcases/kernel/syscalls/sbrk/sbrk02.c
> @@ -0,0 +1,114 @@
> +/*
> + * Copyright (c) 2014 Fujitsu Ltd.
> + * Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of version 2 of the GNU General Public License as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it would be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> + */
> +/*
> + * DESCRIPTION
> + * Check sbrk() with error condition that should produce ENOMEM.
> + */
> +
> +#include <errno.h>
> +#include <unistd.h>
> +#include "test.h"
> +#include "usctest.h"
> +
> +char *TCID = "sbrk02";
> +int TST_TOTAL = 1;
> +
> +#if !defined(UCLINUX)
> +
> +static void setup(void);
> +static void sbrk_verify(void);
> +static void cleanup(void);
> +static int exp_enos[] = { ENOMEM, 0 };
> +
> +static long increment;
> +
> +int main(int argc, char *argv[])
> +{
> + int lc;
> + int i;
> + char *msg;
> +
> + msg = parse_opts(argc, argv, NULL, NULL);
> + if (msg != NULL)
> + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
> +
> + setup();
> +
> + for (lc = 0; TEST_LOOPING(lc); lc++) {
> + tst_count = 0;
> + for (i = 0; i < TST_TOTAL; i++)
> + sbrk_verify();
> + }
> +
> + cleanup();
> + tst_exit();
> +}
> +
> +static void setup(void)
> +{
> + tst_sig(NOFORK, DEF_HANDLER, cleanup);
> +
> + TEST_PAUSE;
> +
> + for (increment = 16*1024*1024; errno == 0; increment++)
> + sbrk(increment);
> +
> + errno = 0;
> +
> + TEST_EXP_ENOS(exp_enos);
> +}
> +
> +static void sbrk_verify(void)
> +{
> + void *tret;
> +
> + tret = sbrk(increment);
> + TEST_ERRNO = errno;
> +
> + if (tret != (void *)-1) {
> + tst_resm(TFAIL,
> + "sbrk(%ld) returned %p, expected (void *)-1, errno=%d",
> + increment, tret, ENOMEM);
> + return;
> + }
> +
> + TEST_ERROR_LOG(TEST_ERRNO);
> +
> + if (TEST_ERRNO == ENOMEM) {
> + tst_resm(TPASS | TTERRNO, "sbrk(%ld) failed as expected",
> + increment);
> + } else {
> + tst_resm(TFAIL | TTERRNO,
> + "sbrk(%ld) failed unexpectedly; expected: %d - %s",
> + increment, ENOMEM, strerror(ENOMEM));
> + }
> +}
> +
> +static void cleanup(void)
> +{
> + TEST_CLEANUP;
> +}
> +
> +#else
> +
> +int main(void)
> +{
> + tst_resm(TINFO, "test is not available on uClinux");
> + tst_exit();
> +}
> +
> +#endif /* if !defined(UCLINUX) */
> --
> 1.8.4.2
>
>
>
>
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2014-04-23 11:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 9:40 [LTP] [PATCH 1/2] sbrk/sbrk01.c: cleanup Zeng Linggang
2014-04-22 9:41 ` [LTP] [PATCH 2/2] sbrk/sbrk02.c: add ENOMEM errno test Zeng Linggang
2014-04-22 13:14 ` Jan Stancek
2014-04-23 1:23 ` Zeng Linggang
2014-04-23 3:51 ` [LTP] [PATCH v2 1/2] sbrk/sbrk01.c: cleanup Zeng Linggang
2014-04-23 3:52 ` [LTP] [PATCH v2 2/2] sbrk/sbrk02.c: add ENOMEM errno test Zeng Linggang
2014-04-23 11:29 ` Jan Stancek [this message]
2014-04-25 9:29 ` Zeng Linggang
2014-05-20 15:50 ` chrubis
2014-05-20 15:56 ` chrubis
2014-05-20 16:03 ` [LTP] [PATCH v2 1/2] sbrk/sbrk01.c: cleanup chrubis
2014-04-22 12:38 ` [LTP] [PATCH " Jan Stancek
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=229210287.8574143.1398252556096.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.com \
--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