From: Bian Naimeng <biannm@cn.fujitsu.com>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: Mitani <mitani@ryobi.co.jp>, "當座 健市" <toza@ryobi.co.jp>,
ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] fix "sigaction" tests
Date: Thu, 18 Nov 2010 12:35:25 +0800 [thread overview]
Message-ID: <4CE4AD0D.1050501@cn.fujitsu.com> (raw)
In-Reply-To: <AANLkTi=TyhLVZ5OOcRduBwvkxS3-u4f7A1W+bv+WO6Y1@mail.gmail.com>
Garrett Cooper wrote:
> On Mon, Nov 1, 2010 at 1:00 AM, Gui Jianfeng <guijianfeng@cn.fujitsu.com> wrote:
>> Garrett Cooper wrote:
>>> 2010/10/31 Mitani <mitani@ryobi.co.jp>:
>> ...
>>>> int main()
>>>> {
>>>> @@ -133,6 +152,12 @@
>>>>
>>>> struct sigaction sa;
>>>>
>>>> + /* Checking for Kernel Version */
>>>> + if ( kernel_ver_cmp(2, 6, 21) != 0 )
>>>> + {
>>>> + UNTESTED( "sem_wait() returned EINTR on kernel versions
>>>> lower than 2.6.22" );
>>>> + }
>>>> +
>>>> /* Initialize output */
>>>> output_init();
>>>>
>>>> ============
>>>>
>>>> Above patch is revision only for templates.
>>>> The following procedure is necessary after applying patch:
>>>> ------------
>>>> #cd testcases/open_posix_testsuite/conformance/interfaces/sigaction/
>>>> #./gentests.pl
>>>> ------------
>>>>
>>>> Similar revisions are necessary for other 25 "sigaction" tests.
>>> Sorry, but Linux-isms can't leak into the open_posix_testsuite.
>>> Same with BSDisms (at least they shouldn't... if they do, then slap me
>>> or whoever did the commit).
>> Do you mean the culprit is Linux-isms?
>
> Mitani-san is proposing that I `fix' the testcases to work on RHEL
> 4.8. These testcases should function with minimal change for all
> versions of Unix.
>
This open_posix_suite is the part of LTP(linux test project), must we
make sure it can work at all versions of unix?
What about this patch? If you think so, other similar patchs will be post.
-------------------------------------------------------------------------------
At older linux kernel(2.6.22 before), a signal handler always interrupts a
blocked call to one of these functions, regardless of the use of the sigaction
SA_RESTART flag, so we should not test these cases at this situation.
Althought uname is not exsit at 4.3 BSD, but this open_posix_suite just
the part of LTP(linux test project), so i think it's not a problem.
Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
---
.../conformance/interfaces/sigaction/16-1.c | 27 ++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
index 706dbfc..3d6e1a1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
@@ -50,6 +50,7 @@ Anyway, a false negative status cannot be returned.
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/utsname.h>
#include <semaphore.h>
#include <signal.h>
@@ -95,6 +96,27 @@ Anyway, a false negative status cannot be returned.
volatile sig_atomic_t caught = 0;
sem_t sem;
+#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
+
+int check_linux()
+{
+ struct utsname tn;
+ int r1, r2, r3;
+
+ if (0 > uname(&tn)) {
+ UNRESOLVED( errno, "uname failed" );
+ }
+
+ if (strcmp(tn.sysname, "Linux") != 0)
+ return 0;
+
+ sscanf(tn.release, "%d.%d.%d", &r1, &r2, &r3);
+ if (KERNEL_VERSION(r1, r2, r3) >= KERNEL_VERSION(2, 6, 22))
+ return 1;
+
+ return 0;
+}
+
/* Handler function */
void handler( int signo )
{
@@ -133,6 +155,11 @@ int main()
struct sigaction sa;
+ if (!check_linux())
+ UNTESTED( "A signal handler always interrupts sem_wait "
+ "at linux release, regardless of the use of "
+ "the sigaction SA_RESTART flag" );
+
/* Initialize output */
output_init();
--
1.6.5.2
--
Regards
Bian Naimeng
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2010-11-18 4:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-01 6:22 [LTP] [PATCH] fix "sigaction" tests Mitani
2010-11-01 7:08 ` Garrett Cooper
2010-11-01 8:00 ` Gui Jianfeng
2010-11-01 9:43 ` Garrett Cooper
2010-11-18 4:35 ` Bian Naimeng [this message]
2010-11-18 4:37 ` Garrett Cooper
2010-11-18 4:59 ` Bian Naimeng
2010-11-18 6:57 ` Mitani
2010-11-18 7:50 ` Bian Naimeng
2010-11-19 13:16 ` Cyril Hrubis
[not found] ` <4CE9CAE0.2070808@cn.fujitsu.com>
2010-11-25 18:44 ` Cyril Hrubis
[not found] ` <AANLkTim2rWksdiugWwFU_TRu44t5gqzHFwJPYLV-YdsY@mail.gmail.com>
2010-11-25 19:38 ` 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=4CE4AD0D.1050501@cn.fujitsu.com \
--to=biannm@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=mitani@ryobi.co.jp \
--cc=toza@ryobi.co.jp \
--cc=yanegomi@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox