All of lore.kernel.org
 help / color / mirror / Atom feed
From: chrubis@suse.cz
To: Jan Stancek <jstancek@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test
Date: Wed, 20 Aug 2014 15:14:31 +0200	[thread overview]
Message-ID: <20140820131431.GA22299@rei> (raw)
In-Reply-To: <e20fc51f1c2cd8c19583050135c50b807677ee40.1408527528.git.jstancek@redhat.com>

Hi!
> Using LLONG_MAX as maximum can fail on XFS, because here the maximum
> file size is 2^63-1, so this test may unexpectedly succeed.

I've found this failure on ext3 on SLES as well and tested that the
patch fixes the problem.

> ---
>  testcases/kernel/syscalls/truncate/truncate03.c |   18 +++++++++++++++++-
>  1 files changed, 17 insertions(+), 1 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/truncate/truncate03.c b/testcases/kernel/syscalls/truncate/truncate03.c
> index ed5073d..54b7d3c 100644
> --- a/testcases/kernel/syscalls/truncate/truncate03.c
> +++ b/testcases/kernel/syscalls/truncate/truncate03.c
> @@ -50,6 +50,7 @@
>  #include <string.h>
>  #include <signal.h>
>  #include <pwd.h>
> +#include <sys/resource.h>
>  
>  #include "test.h"
>  #include "usctest.h"
> @@ -65,6 +66,7 @@
>  #define NEW_MODE	S_IRUSR | S_IRGRP | S_IROTH
>  #define DIR_MODE	S_IRWXU
>  #define TRUNC_LEN	256
> +#define MAX_FSIZE	(16*1024*1024)
>  
>  static char long_pathname[PATH_MAX + 2];
>  
> @@ -82,7 +84,7 @@ static struct test_case_t {
>  	{ long_pathname, TRUNC_LEN, ENAMETOOLONG },
>  	{ "", TRUNC_LEN, ENOENT },
>  	{ TEST_DIR1, TRUNC_LEN, EISDIR },
> -	{ TEST_FILE3, LLONG_MAX, EFBIG },
> +	{ TEST_FILE3, MAX_FSIZE*2, EFBIG },
>  	{ TEST_SYM1, TRUNC_LEN, ELOOP }
>  };
>  
> @@ -124,6 +126,8 @@ void setup(void)
>  {
>  	struct passwd *ltpuser;
>  	char *bad_addr;
> +	struct rlimit rlim;
> +	sigset_t sigset;
>  
>  	tst_sig(NOFORK, DEF_HANDLER, cleanup);
>  
> @@ -156,6 +160,18 @@ void setup(void)
>  
>  	SAFE_SYMLINK(cleanup, TEST_SYM1, TEST_SYM2);
>  	SAFE_SYMLINK(cleanup, TEST_SYM2, TEST_SYM1);
> +
> +	rlim.rlim_cur = MAX_FSIZE;
> +	rlim.rlim_max = MAX_FSIZE;
> +	TEST(setrlimit(RLIMIT_FSIZE, &rlim));
> +	if (TEST_RETURN != 0)
> +		tst_brkm(TBROK | TTERRNO, cleanup, "setrlimit");

We have SAFE_SETRLIMIT() but that is merely cometic change.

Otherwise it's acked and tested, and as it fixes testcase regression it
should go in before the release.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2014-08-20 13:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20  9:42 [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test Jan Stancek
2014-08-20 13:14 ` chrubis [this message]
2015-01-14  9:15 ` Shuang Qiu
2015-01-16  9:26   ` Jan Stancek
2015-01-16  9:33     ` Shuang Qiu

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=20140820131431.GA22299@rei \
    --to=chrubis@suse.cz \
    --cc=jstancek@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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.