* [LTP] [PATCH] sigaction:16-1: leave it untested on the Linux kernel less than 2.6.22
@ 2013-11-14 2:25 Peng Haitao
2013-11-14 9:33 ` Jan Stancek
2013-11-14 12:29 ` chrubis
0 siblings, 2 replies; 8+ messages in thread
From: Peng Haitao @ 2013-11-14 2:25 UTC (permalink / raw)
To: jstancek, gaowanlong; +Cc: ltp-list
As the Linux signal(7) said:
POSIX semaphore interfaces: sem_wait(3) and sem_timedwait(3) (since Linux 2.6.22; beforehand, always failed with EINTR).
So, on linux, we just leave this untested when the kernel version
is less than 2.6.22.
Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
testcases/open_posix_testsuite/Makefile | 4 ++++
testcases/open_posix_testsuite/Makefile.linux | 20 ++++++++++++++++++++
.../open_posix_testsuite/scripts/tst_kvercmp.sh | 20 ++++++++++++++++++++
3 files changed, 44 insertions(+)
create mode 100644 testcases/open_posix_testsuite/Makefile.linux
create mode 100755 testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
diff --git a/testcases/open_posix_testsuite/Makefile b/testcases/open_posix_testsuite/Makefile
index 9c61fa4..500ddc2 100644
--- a/testcases/open_posix_testsuite/Makefile
+++ b/testcases/open_posix_testsuite/Makefile
@@ -40,6 +40,10 @@ exec_prefix?= $(prefix)
all: conformance-all functional-all stress-all tools-all
+ifeq ($(shell uname -s), Linux)
+include Makefile.linux
+endif
+
clean: $(CRITICAL_MAKEFILES)
@rm -f $(LOGFILE)*
@for dir in $(SUBDIRS) tools; do \
diff --git a/testcases/open_posix_testsuite/Makefile.linux b/testcases/open_posix_testsuite/Makefile.linux
new file mode 100644
index 0000000..de3dd0e
--- /dev/null
+++ b/testcases/open_posix_testsuite/Makefile.linux
@@ -0,0 +1,20 @@
+all: conformance-all functional-all stress-all tools-all filter-broken
+
+cmd_disable = @set -e; \
+ echo "Disabling: $(1)"; \
+ echo "\#!/bin/sh" > $(1); \
+ echo "echo $(1) skipped" >> $(1); \
+ echo "echo $(2)" >> $(1); \
+ echo "exit 0" >> $(1); \
+ chmod a+x $(1)
+
+kver_cmp = $(shell $(top_srcdir)/scripts/tst_kvercmp.sh 2 6 22)
+ifeq ($(kver_cmp), 1)
+filter-broken: t_sigaction_16-1
+else
+filter-broken:
+endif
+
+t_sigaction_16-1:
+ $(call cmd_disable,conformance/interfaces/sigaction/sigaction_16-1.run-test, \
+ This fails on old linux because sem_wait always be interrupted by a signal.)
diff --git a/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh b/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
new file mode 100755
index 0000000..d0e101c
--- /dev/null
+++ b/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+if [ $# -ne 3 ]; then
+ echo "Usgae: ./tst_kvercmp.sh r1 r2 r3"
+ exit 1
+fi
+
+ker_ver=$(uname -r)
+r1=$(echo ${ker_ver} | awk -F. '{print $1}')
+r2=$(echo ${ker_ver} | awk -F. '{print $2}')
+r3=$(echo ${ker_ver} | awk -F. '{print $3}')
+r3=${r3%-*}
+
+test_ver=$(($1 * 65536 + $2 * 256 + $3))
+curr_ver=$((${r1} * 65536 + ${r2} * 256 + ${r3}))
+if [ ${curr_ver} -ge ${test_ver} ]; then
+ echo 0
+else
+ echo 1
+fi
--
1.8.3.1
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [LTP] [PATCH] sigaction:16-1: leave it untested on the Linux kernel less than 2.6.22
2013-11-14 2:25 [LTP] [PATCH] sigaction:16-1: leave it untested on the Linux kernel less than 2.6.22 Peng Haitao
@ 2013-11-14 9:33 ` Jan Stancek
2013-11-14 12:29 ` chrubis
1 sibling, 0 replies; 8+ messages in thread
From: Jan Stancek @ 2013-11-14 9:33 UTC (permalink / raw)
To: Peng Haitao; +Cc: ltp-list
----- Original Message -----
> From: "Peng Haitao" <penght@cn.fujitsu.com>
> To: jstancek@redhat.com, gaowanlong@cn.fujitsu.com
> Cc: ltp-list@lists.sourceforge.net
> Sent: Thursday, 14 November, 2013 3:25:07 AM
> Subject: [PATCH] sigaction:16-1: leave it untested on the Linux kernel less than 2.6.22
>
> As the Linux signal(7) said:
> POSIX semaphore interfaces: sem_wait(3) and sem_timedwait(3) (since Linux
> 2.6.22; beforehand, always failed with EINTR).
>
> So, on linux, we just leave this untested when the kernel version
> is less than 2.6.22.
>
> Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
Hi,
looks familiar. Thanks for posting - I haven't revisited this topic since then.
I suggest following change:
diff --git a/testcases/open_posix_testsuite/Makefile.linux b/testcases/open_posix_testsuite/Makefile.linux
index de3dd0e..4a32c07 100644
--- a/testcases/open_posix_testsuite/Makefile.linux
+++ b/testcases/open_posix_testsuite/Makefile.linux
@@ -8,13 +8,15 @@ cmd_disable = @set -e; \
echo "exit 0" >> $(1); \
chmod a+x $(1)
+BROKEN :=
+
kver_cmp = $(shell $(top_srcdir)/scripts/tst_kvercmp.sh 2 6 22)
ifeq ($(kver_cmp), 1)
-filter-broken: t_sigaction_16-1
-else
-filter-broken:
+BROKEN += t_sigaction_16-1
endif
+filter-broken: $(BROKEN)
+
t_sigaction_16-1:
$(call cmd_disable,conformance/interfaces/sigaction/sigaction_16-1.run-test, \
This fails on old linux because sem_wait always be interrupted by a signal.)
Regards,
Jan
> ---
> testcases/open_posix_testsuite/Makefile | 4 ++++
> testcases/open_posix_testsuite/Makefile.linux | 20
> ++++++++++++++++++++
> .../open_posix_testsuite/scripts/tst_kvercmp.sh | 20
> ++++++++++++++++++++
> 3 files changed, 44 insertions(+)
> create mode 100644 testcases/open_posix_testsuite/Makefile.linux
> create mode 100755 testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
>
> diff --git a/testcases/open_posix_testsuite/Makefile
> b/testcases/open_posix_testsuite/Makefile
> index 9c61fa4..500ddc2 100644
> --- a/testcases/open_posix_testsuite/Makefile
> +++ b/testcases/open_posix_testsuite/Makefile
> @@ -40,6 +40,10 @@ exec_prefix?= $(prefix)
>
> all: conformance-all functional-all stress-all tools-all
>
> +ifeq ($(shell uname -s), Linux)
> +include Makefile.linux
> +endif
> +
> clean: $(CRITICAL_MAKEFILES)
> @rm -f $(LOGFILE)*
> @for dir in $(SUBDIRS) tools; do \
> diff --git a/testcases/open_posix_testsuite/Makefile.linux
> b/testcases/open_posix_testsuite/Makefile.linux
> new file mode 100644
> index 0000000..de3dd0e
> --- /dev/null
> +++ b/testcases/open_posix_testsuite/Makefile.linux
> @@ -0,0 +1,20 @@
> +all: conformance-all functional-all stress-all tools-all filter-broken
> +
> +cmd_disable = @set -e; \
> + echo "Disabling: $(1)"; \
> + echo "\#!/bin/sh" > $(1); \
> + echo "echo $(1) skipped" >> $(1); \
> + echo "echo $(2)" >> $(1); \
> + echo "exit 0" >> $(1); \
> + chmod a+x $(1)
> +
> +kver_cmp = $(shell $(top_srcdir)/scripts/tst_kvercmp.sh 2 6 22)
> +ifeq ($(kver_cmp), 1)
> +filter-broken: t_sigaction_16-1
> +else
> +filter-broken:
> +endif
> +
> +t_sigaction_16-1:
> + $(call
> cmd_disable,conformance/interfaces/sigaction/sigaction_16-1.run-test, \
> + This fails on old linux because sem_wait always be interrupted by a
> signal.)
> diff --git a/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
> b/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
> new file mode 100755
> index 0000000..d0e101c
> --- /dev/null
> +++ b/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
> @@ -0,0 +1,20 @@
> +#!/bin/bash
> +
> +if [ $# -ne 3 ]; then
> + echo "Usgae: ./tst_kvercmp.sh r1 r2 r3"
> + exit 1
> +fi
> +
> +ker_ver=$(uname -r)
> +r1=$(echo ${ker_ver} | awk -F. '{print $1}')
> +r2=$(echo ${ker_ver} | awk -F. '{print $2}')
> +r3=$(echo ${ker_ver} | awk -F. '{print $3}')
> +r3=${r3%-*}
> +
> +test_ver=$(($1 * 65536 + $2 * 256 + $3))
> +curr_ver=$((${r1} * 65536 + ${r2} * 256 + ${r3}))
> +if [ ${curr_ver} -ge ${test_ver} ]; then
> + echo 0
> +else
> + echo 1
> +fi
> --
> 1.8.3.1
>
>
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [LTP] [PATCH] sigaction:16-1: leave it untested on the Linux kernel less than 2.6.22
2013-11-14 2:25 [LTP] [PATCH] sigaction:16-1: leave it untested on the Linux kernel less than 2.6.22 Peng Haitao
2013-11-14 9:33 ` Jan Stancek
@ 2013-11-14 12:29 ` chrubis
[not found] ` <187658148.31700134.1384433325925.JavaMail.root@redhat.com>
1 sibling, 1 reply; 8+ messages in thread
From: chrubis @ 2013-11-14 12:29 UTC (permalink / raw)
To: Peng Haitao; +Cc: ltp-list
Hi!
> As the Linux signal(7) said:
> POSIX semaphore interfaces: sem_wait(3) and sem_timedwait(3) (since Linux 2.6.22; beforehand, always failed with EINTR).
>
> So, on linux, we just leave this untested when the kernel version
> is less than 2.6.22.
>
> Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
Again, I'm slightly against such hacks in the Open Posix Testsuite. The
testsuite purpose is to check POSIX compilance, if older Linux fails
because the implementaion is wrong users should see the failure.
Or at least the testcases shouldn't be skipped by default. If there is
enough interest in this feature we can add specific switch or make
target that skips tests that are known to fail on Linux. Skipping them
on default run is, in my opinion, wrong.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] sigaction:16-1: leave it untested on the Linux kernel less than 2.6.22
@ 2013-08-05 2:15 Wanlong Gao
2013-08-05 9:46 ` chrubis
0 siblings, 1 reply; 8+ messages in thread
From: Wanlong Gao @ 2013-08-05 2:15 UTC (permalink / raw)
To: LTP
As the Linux signal(7) said:
POSIX semaphore interfaces: sem_wait(3) and sem_timedwait(3) (since Linux 2.6.22; beforehand, always failed with EINTR).
So, on linux, we just leave this untested when the kernel version
is less than 2.6.22.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
---
.../conformance/interfaces/sigaction/16-1.c | 6 +++
testcases/open_posix_testsuite/include/kvercmp.h | 56 ++++++++++++++++++++++
2 files changed, 62 insertions(+)
create mode 100644 testcases/open_posix_testsuite/include/kvercmp.h
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 530b5b6..8241246 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
@@ -39,6 +39,7 @@
#include <signal.h>
#include <errno.h>
#include <posixtest.h>
+#include "kvercmp.h"
/*
* Define an array of signals we want to test against.
@@ -215,6 +216,11 @@ int main(void)
struct sigaction sa;
struct sigaction sa_org;
+#ifdef __linux__
+ if (tst_kvercmp(2, 6, 22) < 0)
+ return PTS_UNTESTED;
+#endif
+
sa.sa_flags = SA_RESTART;
sa.sa_handler = handler;
diff --git a/testcases/open_posix_testsuite/include/kvercmp.h b/testcases/open_posix_testsuite/include/kvercmp.h
new file mode 100644
index 0000000..688e34a
--- /dev/null
+++ b/testcases/open_posix_testsuite/include/kvercmp.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2003 International Business Machines Corp.
+ * Copyright (c) 2013 Fujitsu Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms in version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef __linux__
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/utsname.h>
+
+static void get_kver(int *k1, int *k2, int *k3)
+{
+ struct utsname uval;
+ char *kver;
+ char *r1, *r2, *r3;
+ extern char *strsep();
+
+ uname(&uval);
+ kver = uval.release;
+ r1 = strsep(&kver, ".");
+ r2 = strsep(&kver, ".");
+ r3 = strsep(&kver, ".");
+
+ *k1 = atoi(r1);
+ *k2 = atoi(r2);
+ *k3 = atoi(r3);
+}
+
+static int tst_kvercmp(int r1, int r2, int r3)
+{
+ int a1, a2, a3;
+ int testver, currver;
+
+ get_kver(&a1, &a2, &a3);
+ testver = (r1 << 16) + (r2 << 8) + r3;
+ currver = (a1 << 16) + (a2 << 8) + a3;
+
+ return currver - testver;
+}
+#endif
--
1.8.4.rc0.11.g35f5eaa
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-11-28 14:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 2:25 [LTP] [PATCH] sigaction:16-1: leave it untested on the Linux kernel less than 2.6.22 Peng Haitao
2013-11-14 9:33 ` Jan Stancek
2013-11-14 12:29 ` chrubis
[not found] ` <187658148.31700134.1384433325925.JavaMail.root@redhat.com>
2013-11-14 12:55 ` chrubis
[not found] ` <5285EB6C.9000107@cn.fujitsu.com>
[not found] ` <5296D114.4070507@cn.fujitsu.com>
2013-11-28 14:15 ` chrubis
-- strict thread matches above, loose matches on Subject: below --
2013-08-05 2:15 Wanlong Gao
2013-08-05 9:46 ` chrubis
[not found] ` <578718909.13087059.1375776716081.JavaMail.root@redhat.com>
2013-08-06 9:30 ` chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox