From: Cyril Hrubis <chrubis@suse.cz>
To: Caspar Zhang <czhang@redhat.com>
Cc: LTP List <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH v2] [syscalls] io_submit: fix broken testcase
Date: Wed, 13 Apr 2011 19:33:33 +0200 [thread overview]
Message-ID: <20110413173333.GC3206@saboteur.suse.cz> (raw)
In-Reply-To: <b262ce2a7b471caa002c96fbef62b10c3229b56a.1302595212.git.czhang@redhat.com>
Hi!
> -int TST_TOTAL = 3;
> +int TST_TOTAL = 8;
>
> #ifdef HAVE_LIBAIO_H
> #include <libaio.h>
> #include <errno.h>
> #include <string.h>
> -
> -static void cleanup(void)
> -{
> - TEST_CLEANUP;
> +#include <fcntl.h>
> +
> +#define TESTFILE "testfile"
> +#define NEG_RESULT(exp, act) {\
> + if (act == 0) {\
> + tst_resm(TFAIL, "call succeeded unexpectedly");\
> + } else if (act == exp) {\
> + tst_resm(TPASS, "expected failure - "\
> + "returned value = %ld : %s", \
> + act, strerror(-1 * act));\
> + } else {\
> + tst_resm(TFAIL, "unexpected failure - "\
> + "returned value = %ld : %s, "\
> + "expected value = %d : %s",\
> + act, strerror(-1 * act),\
> + exp, strerror(-1 * exp));\
> + } \
> }
> -
> -static void setup(void)
> -{
> - tst_sig(NOFORK, DEF_HANDLER, cleanup);
> -
> - TEST_PAUSE;
> +#define POS_RESULT(act) {\
> + if (act >= 0) {\
> + tst_resm(TPASS, "expected success - "\
> + "returned value = %ld", act);\
> + } else {\
> + tst_resm(TFAIL, "unexpected failure - "\
> + "returned value = %ld : %s",\
> + act, strerror(-1 * act));\
> + } \
> }
Any particular reason why these couldn't be functions? Macros are harder
to read and easier to misuse, so generally they shouldn't be used unless
it's really necessary.
Or maybe even better to have a funciton that gets io_submit parameters
and expected result as an arguments and does the test itself.
And also please avoid unnecessary code moving. If you contributed a test
that has setup() and cleanup() after main, that's ok. But there is no
need to shuffle that code in the existings testcases.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now! http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2011-04-13 17:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-27 13:41 [LTP] [PATCH] [syscalls] io_submit: fix broken testcase czhang
2011-03-27 14:04 ` Caspar Zhang
2011-03-27 14:13 ` czhang
2011-04-01 14:44 ` Cyril Hrubis
2011-04-07 7:31 ` [LTP] [PATCH v2] " Caspar Zhang
2011-04-12 8:06 ` Caspar Zhang
2011-04-13 17:33 ` Cyril Hrubis [this message]
2011-04-14 3:33 ` [LTP] [PATCH v3] " Caspar Zhang
2011-04-14 14:44 ` Cyril Hrubis
2011-04-14 14:28 ` [LTP] [PATCH v4] " Caspar Zhang
2011-04-14 14:46 ` Masatake YAMATO
2011-04-14 16:33 ` Cyril Hrubis
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=20110413173333.GC3206@saboteur.suse.cz \
--to=chrubis@suse.cz \
--cc=czhang@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.