All of lore.kernel.org
 help / color / mirror / Atom feed
From: chrubis@suse.cz
To: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
Cc: ltp-list <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH] read/read02.c: cleanup
Date: Tue, 29 Apr 2014 18:10:16 +0200	[thread overview]
Message-ID: <20140429161016.GF12523@rei> (raw)
In-Reply-To: <1395991214.5017.2.camel@G08JYZSD130126>

Hi!
> -#ifndef UCLINUX
> -	    /* Skip since uClinux does not implement memory protection */
> -	    /* the buffer is invalid - EFAULT */
> -	{
> -	&fd3, (void *)-1, EFAULT}
> -#endif
> +	{&badfd, buf, EBADF},
> +	{&fd2, buf, EISDIR},
> +	{&fd3, (void *)-1, EFAULT},
>  };

Removing the ifdefs breaks the testcases on uClinux, please keep them
there.

> -#if !defined(UCLINUX)
> -	bad_addr = mmap(0, 1, PROT_NONE,
> -			MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0);
> -	if (bad_addr == MAP_FAILED) {
> -		tst_brkm(TBROK, cleanup, "mmap failed");
> +
> +	TEST_ERROR_LOG(TEST_ERRNO);
> +
> +	if (TEST_ERRNO == test->exp_error) {
> +		tst_resm(TPASS | TTERRNO, "expected failure - errno = %d : %s",
> +			 TEST_ERRNO, strerror(TEST_ERRNO));
> +	} else {
> +		tst_resm(TFAIL | TTERRNO,
> +			 "unexpected error - %d : %s - expected %d",
> +			 TEST_ERRNO, strerror(TEST_ERRNO), test->exp_error);
>  	}
> -	TC[2].buf = bad_addr;
> -#endif

And removing the mmap() possibly breaks the testcases on platforms where
there is something mapped on address (void*)-1. Looking at the git log,
this may be case for some 64 bit machines (at least this is what the
patch from 2002 says).

Given that we have quite a lot of testcases that passes addresses that
are expected to generate EFAULT to various syscalls we should unify the
way these are generated.

I would go for creating tst_bad_addr() function that would replace all
the adhoc (and posibly wrong) definitions. I will look into that asap.

-- 
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

      parent reply	other threads:[~2014-04-29 16:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28  7:20 [LTP] [PATCH] read/read02.c: cleanup Zeng Linggang
2014-03-28  7:22 ` [LTP] [PATCH] read/read02.c: add new error number tests Zeng Linggang
2014-04-29 16:31   ` chrubis
     [not found]     ` <1399262735.3177.14.camel@G08JYZSD130126>
2014-05-05 11:53       ` chrubis
     [not found]         ` <1399362493.3177.40.camel@G08JYZSD130126>
     [not found]           ` <1399362582.3177.41.camel@G08JYZSD130126>
2014-05-26 13:37             ` [LTP] [PATCH v2 1/3] SAFE_MACROS: Add memalign() chrubis
     [not found]           ` <1399362661.3177.43.camel@G08JYZSD130126>
2014-05-26 13:37             ` [LTP] [PATCH v2 2/3] read/read02.c: cleanup chrubis
     [not found]           ` <1399362721.3177.44.camel@G08JYZSD130126>
2014-05-26 13:39             ` [LTP] [PATCH v2 3/3] read/read02.c: add new error number tests chrubis
2014-05-26 13:44             ` chrubis
     [not found]               ` <1401171983.23078.0.camel@G08JYZSD130126>
2014-05-27 16:41                 ` [LTP] [PATCH] read/read02.c: fix skipping all testes on tmpfs chrubis
2014-04-29 16:10 ` chrubis [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=20140429161016.GF12523@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 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.