Skip to contentSkip to conversation

testsuite: Add test for x86 port io

PATCH Superseded Richard Weinberger 1 participant 2 messages Apr 8, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testsuite: Add test for x86 port io

Test case for the following regression:
https://www.xenomai.org/pipermail/xenomai/2022-March/047451.html

---
 configure.ac                       |  2 +
 testsuite/smokey/Makefile.am       |  7 +++
 testsuite/smokey/x86io/Makefile.am |  7 +++
 testsuite/smokey/x86io/x86io.c     | 77 ++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+)
 create mode 100644 testsuite/smokey/x86io/Makefile.am
 create mode 100644 testsuite/smokey/x86io/x86io.c
configure.ac +2 -0
index 019453793..62506de69 100644
@@ -169,6 +169,7 @@ esac
 
 AC_MSG_RESULT([$target_cpu_arch])
 XENO_TARGET_ARCH=$target_cpu_arch
+AM_CONDITIONAL(XENO_X86,[test x$target_cpu_arch = xx86])
 AC_ENABLE_SHARED
 AC_PROG_LIBTOOL
 
@@ -1044,6 +1045,7 @@ AC_CONFIG_FILES([ \
 	testsuite/smokey/gdb/Makefile \
 	testsuite/smokey/y2038/Makefile \
 	testsuite/smokey/can/Makefile
+	testsuite/smokey/x86io/Makefile
 	testsuite/clocktest/Makefile \
 	testsuite/xeno-test/Makefile \
 	utils/Makefile \
testsuite/smokey/Makefile.am +7 -0
index 4a9773f58..79dc61e9f 100644
@@ -82,6 +82,10 @@ DIST_SUBDIRS = 		\
 	xddp		\
 	y2038
 
+if XENO_X86
+DIST_SUBDIRS += x86io
+endif
+
 if XENO_COBALT
 if CONFIG_XENO_LIBS_DLOPEN
 COBALT_SUBDIRS += dlopen
@@ -89,6 +93,9 @@ endif
 if XENO_PSHARED
 COBALT_SUBDIRS += memory-pshared
 endif
+if XENO_X86
+COBALT_SUBDIRS += x86io
+endif
 wrappers = $(XENO_POSIX_WRAPPERS)
 SUBDIRS = $(COBALT_SUBDIRS)
 else
testsuite/smokey/x86io/Makefile.am new file +7 -0
new file mode 100644
index 000000000..d623af042
@@ -0,0 +1,7 @@
+noinst_LIBRARIES = libx86io.a
+
+libx86io_a_SOURCES = x86io.c
+
+libx86io_a_CPPFLAGS = 		\
+	@XENO_USER_CFLAGS@	\
+	-I$(top_srcdir)/include
testsuite/smokey/x86io/x86io.c new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw

----- Ursprüngliche Mail -----

Quoted 6 lines
testsuite/smokey/x86io/x86io.c new file +6 -0
+	if (!__Terrno(ret, sigaction(SIGSEGV, &sa, &old_sa)))
+		goto out;
+
+	if (!__Terrno(ret, iopl(3)))
+		goto out;
+

testsuite/smokey/x86io/x86io.c line 69

Quoted 10 lines
testsuite/smokey/x86io/x86io.c new file +10 -0
+	if (!__T(ret, pthread_create(&pt, NULL, tfn, NULL)))
+		goto out;
+
+	if (!__T(ret, pthread_join(pt, (void *)&ptret)))
+		goto out;
+
+	if (!__Terrno(ret, sigaction(SIGSEGV, &old_sa, NULL)))
+		goto out;
+
+out:

I missed here to restore old_sa. ;-\
If iopl(), pthread_create() or pthread_join() fail we end up with the current signal handler for SIGSEGV.

Will fix in a later v2.

Thanks,
//richard