public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Chris Dearman <chris@mips.com>
To: ltp-list@lists.sourceforge.net
Cc: Chris Dearman <chris@mips.com>
Subject: [LTP] [PATCH] pipe01 should only check the data actually received from the pipe
Date: Tue, 16 Oct 2012 07:18:21 -0700	[thread overview]
Message-ID: <507D6CAD.1040209@mips.com> (raw)

The pipe write does not include the string terminator and the way the
test is written it's valid for the writer to send less than the
requested amount and for the reader to read less than the number of
written bytes, so just compare the actual bytes received.

Signed-off-by: Chris Dearman <chris@mips.com>
---
  testcases/kernel/syscalls/pipe/pipe01.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/pipe/pipe01.c 
b/testcases/kernel/syscalls/pipe/pipe01.c
index 08cf612..04d1b11 100644
--- a/testcases/kernel/syscalls/pipe/pipe01.c
+++ b/testcases/kernel/syscalls/pipe/pipe01.c
@@ -119,7 +119,7 @@ int main(int ac, char **av)
  			}
   			/* are the strings written and read equal */
-			if ((greater = strcmp(rebuf, wrbuf)) != 0) {
+			if ((greater = strncmp(rebuf, wrbuf, red)) != 0) {
  				tst_resm(TFAIL, "Condition #3 test failed");
  				continue;
  			}
@@ -155,4 +155,4 @@ void cleanup()
  	 * print errno log if that option was specified.
  	 */
  	TEST_CLEANUP;
-}
\ No newline at end of file
+}
-- 
1.7.1


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

             reply	other threads:[~2012-10-16 14:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-16 14:18 Chris Dearman [this message]
2012-10-17 17:38 ` [LTP] [PATCH] pipe01 should only check the data actually received from the pipe Chris Dearman
2012-10-18  1:36   ` Wanlong Gao

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=507D6CAD.1040209@mips.com \
    --to=chris@mips.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox