public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: chrubis@suse.cz
To: Xing Gu <gux.fnst@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v3 1/2] renameat/renameat01.c: cleanup
Date: Tue, 24 Jun 2014 16:02:58 +0200	[thread overview]
Message-ID: <20140624140258.GA9159@rei> (raw)
In-Reply-To: <1402989991-19613-1-git-send-email-gux.fnst@cn.fujitsu.com>

Hi!
> Add renameat.h to encapsulate renameat syscall.
> Delete some useless comments.
> Use some SAFE_* macros.
> Move the test body from main() to renameat_verify().

Pushed with folling changes, thanks.
(because it's important to check not only the errno but the return value
 as well)

 /*
  * Copyright (c) International Business Machines  Corp., 2006
+ *  Author: Yi Yang <yyangcdl@cn.ibm.com>
  *
  * This program is free software;  you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -150,6 +151,16 @@ static void renameat_verify(const struct test_case_t *tc)
 	TEST(renameat(*(tc->oldfdptr), tc->oldpath,
 			*(tc->newfdptr), tc->newpath));
 
+	if (tc->exp_errno && TEST_RETURN != -1) {
+		tst_resm(TFAIL, "renameat() succeeded unexpectedly");
+		return;
+	}
+
+	if (tc->exp_errno == 0 && TEST_RETURN != 0) {
+		tst_resm(TFAIL | TTERRNO, "renameat() failed unexpectedly");
+		return;
+	}
+
 	if (TEST_ERRNO == tc->exp_errno) {
 		tst_resm(TPASS | TTERRNO,
 		"renameat() returned the expected value");

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

      parent reply	other threads:[~2014-06-24 14:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 11:17 [LTP] [PATCH 1/2] renameat/renameat01.c: cleanup gux.fnst
2014-04-21 11:17 ` [LTP] [PATCH 2/2] renameat/renameat01.c: add ELOOP, EROFS and EMLINK error value tests gux.fnst
2014-05-16  4:35 ` [LTP] [PATCH v2 1/2] renameat/renameat01.c: cleanup Xing Gu
2014-05-16  4:35   ` [LTP] [PATCH v2 2/2] renameat/renameat01.c: add ELOOP, EROFS and EMLINK error value tests Xing Gu
2014-05-20 15:42 ` [LTP] [PATCH 1/2] renameat/renameat01.c: cleanup chrubis
2014-06-17  7:26 ` [LTP] [PATCH v3 " Xing Gu
2014-06-17  7:26   ` [LTP] [PATCH v3 2/2] renameat/renameat01.c: add ELOOP, EROFS and EMLINK error value tests Xing Gu
2014-06-24 14:03     ` chrubis
2014-06-24 14:02   ` 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=20140624140258.GA9159@rei \
    --to=chrubis@suse.cz \
    --cc=gux.fnst@cn.fujitsu.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