[Xenomai-git] Jan Kiszka : smokey/sigdebug: Port from 2.6
Module: xenomai-3 Branch: master Commit: d6cc09786459a61cb9bc3a9f44e2d58036a1d347 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d6cc09786459a61cb9bc3a9f44e2d58036a1d347 Author: Jan Kiszka Date: Fri Dec 12 13:46:24 2014 +0100 smokey/sigdebug: Port from 2.6 This integrates the 2.6 testcase for validating the SIGDEBUG support to forge, taking interface changes into account, switching from native to POSIX and adding a test for the lock-break instrumentation. The latter is currently broken and will only succeed after the related fix is applied. Signed-off-by: Jan Kiszka --- configure.ac |1 + testsuite/smokey/Makefile.am |6 +- testsuite/smokey/sigdebug/Makefile.am | 10 ++ testsuite/smokey/sigdebug/sigdebug.c | 303 + 4 files changed, 318 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index fe647e4..2d4d61d 100644 --- a/configure.ac +++ b/configure.ac @@ -924,6 +924,7 @@ AC_CONFIG_FILES([ \ testsuite/smokey/iddp/Makefile \ testsuite/smokey/bufp/Makefile \ testsuite/smokey/fork-exec/Makefile \ + testsuite/smokey/sigdebug/Makefile \ testsuite/clocktest/Makefile \ testsuite/xeno-test/Makefile \ testsuite/regression/Makefile \ diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am index 449a69a..9ee9cf0 100644 --- a/testsuite/smokey/Makefile.am +++ b/testsuite/smokey/Makefile.am @@ -20,7 +20,8 @@ SUBDIRS = \ sched-quota \ sched-tp\ vdso-access \ - xddp + xddp\ + sigdebug else SUBDIRS = wrappers = @@ -59,4 +60,5 @@ DIST_SUBDIRS =\ sched-quota \ sched-tp\ vdso-access \ - xddp + xddp\ + sigdebug diff --git a/testsuite/smokey/sigdebug/Makefile.am b/testsuite/smokey/sigdebug/Makefile.am new file mode 100644 index 000..06b976d --- /dev/null +++ b/testsuite/smokey/sigdebug/Makefile.am @@ -0,0 +1,10 @@ + +noinst_LIBRARIES = libsigdebug.a + +libsigdebug_a_SOURCES = sigdebug.c + +CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC) + +libsigdebug_a_CPPFLAGS = \ + @XENO_USER_CFLAGS@ \ + -I$(top_srcdir)/include diff --git a/testsuite/smokey/sigdebug/sigdebug.c b/testsuite/smokey/sigdebug/sigdebug.c new file mode 100644 index 000..03f3d33 --- /dev/null +++ b/testsuite/smokey/sigdebug/sigdebug.c @@ -0,0 +1,303 @@ +/* + * Functional testing of unwanted domain switch debugging mechanism. + * + * Copyright (C) Siemens AG, 2012-2014 + * + * Authors: + * Jan Kiszka + * + * Released under the terms of GPLv2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +smokey_test_plugin(sigdebug, + SMOKEY_NOARGS, + "Check SIGDEBUG reporting." +); + +unsigned int expected_reason; +bool sigdebug_received; +pthread_mutex_t prio_invert; +sem_t send_signal; +char *mem; +FILE *wd; + +static void setup_checkdebug(unsigned int reason) +{ + sigdebug_received = false; + expected_reason = reason; +} + +static void check_inner(const char *fn, int line, const char *msg, + int status, int expected) +{ + if (status == expected) + return; + + pthread_setmode_np(PTHREAD_WARNSW, 0, NULL); + rt_print_flush_buffers(); + fprintf(stderr, "FAILURE %s:%d: %s returned %d instead of %d - %s\n", + fn, line, msg, status, expected, strerror(-status)); + exit(EXIT_FAILURE); +} + +static void check_sigdebug_inner(const char *fn, int line, const char *reason) +{ + if (sigdebug_received) + return; + + pthread_setmode_np(PTHREAD_WARNSW, 0, NULL); + rt_print_flush_buffers(); + fprintf(stderr, "FAILURE %s:%d: no %s received\n", fn, line, reason); + exit(EXIT_FAILURE); +} + +#define check(msg, status, expected) ({ \ + int __status = status; \ + check_inner(__FUNCTION__, __LINE__, msg, __status, expected); \ + __status; \ +}) + +#define check_no_error(msg, status) ({ \ + int __status = status; \ + check_inner(__FUNCTION__, __LINE__, msg,\ + __status < 0 ? __status : 0, 0);\ + __status; \ +}) + +#define check_sigdebug_received(reason) do { \ + const char *__reason = reason; \ + check_sigdebug_inner(__FUNCTION__, __LINE__, __reason); \ +} while (0) + +static void *rt_thread_body(void *cookie)
[Xenomai-git] Jan Kiszka : smokey/sigdebug: Port from 2.6
Module: xenomai-3 Branch: next Commit: d6cc09786459a61cb9bc3a9f44e2d58036a1d347 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d6cc09786459a61cb9bc3a9f44e2d58036a1d347 Author: Jan Kiszka Date: Fri Dec 12 13:46:24 2014 +0100 smokey/sigdebug: Port from 2.6 This integrates the 2.6 testcase for validating the SIGDEBUG support to forge, taking interface changes into account, switching from native to POSIX and adding a test for the lock-break instrumentation. The latter is currently broken and will only succeed after the related fix is applied. Signed-off-by: Jan Kiszka --- configure.ac |1 + testsuite/smokey/Makefile.am |6 +- testsuite/smokey/sigdebug/Makefile.am | 10 ++ testsuite/smokey/sigdebug/sigdebug.c | 303 + 4 files changed, 318 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index fe647e4..2d4d61d 100644 --- a/configure.ac +++ b/configure.ac @@ -924,6 +924,7 @@ AC_CONFIG_FILES([ \ testsuite/smokey/iddp/Makefile \ testsuite/smokey/bufp/Makefile \ testsuite/smokey/fork-exec/Makefile \ + testsuite/smokey/sigdebug/Makefile \ testsuite/clocktest/Makefile \ testsuite/xeno-test/Makefile \ testsuite/regression/Makefile \ diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am index 449a69a..9ee9cf0 100644 --- a/testsuite/smokey/Makefile.am +++ b/testsuite/smokey/Makefile.am @@ -20,7 +20,8 @@ SUBDIRS = \ sched-quota \ sched-tp\ vdso-access \ - xddp + xddp\ + sigdebug else SUBDIRS = wrappers = @@ -59,4 +60,5 @@ DIST_SUBDIRS =\ sched-quota \ sched-tp\ vdso-access \ - xddp + xddp\ + sigdebug diff --git a/testsuite/smokey/sigdebug/Makefile.am b/testsuite/smokey/sigdebug/Makefile.am new file mode 100644 index 000..06b976d --- /dev/null +++ b/testsuite/smokey/sigdebug/Makefile.am @@ -0,0 +1,10 @@ + +noinst_LIBRARIES = libsigdebug.a + +libsigdebug_a_SOURCES = sigdebug.c + +CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC) + +libsigdebug_a_CPPFLAGS = \ + @XENO_USER_CFLAGS@ \ + -I$(top_srcdir)/include diff --git a/testsuite/smokey/sigdebug/sigdebug.c b/testsuite/smokey/sigdebug/sigdebug.c new file mode 100644 index 000..03f3d33 --- /dev/null +++ b/testsuite/smokey/sigdebug/sigdebug.c @@ -0,0 +1,303 @@ +/* + * Functional testing of unwanted domain switch debugging mechanism. + * + * Copyright (C) Siemens AG, 2012-2014 + * + * Authors: + * Jan Kiszka + * + * Released under the terms of GPLv2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +smokey_test_plugin(sigdebug, + SMOKEY_NOARGS, + "Check SIGDEBUG reporting." +); + +unsigned int expected_reason; +bool sigdebug_received; +pthread_mutex_t prio_invert; +sem_t send_signal; +char *mem; +FILE *wd; + +static void setup_checkdebug(unsigned int reason) +{ + sigdebug_received = false; + expected_reason = reason; +} + +static void check_inner(const char *fn, int line, const char *msg, + int status, int expected) +{ + if (status == expected) + return; + + pthread_setmode_np(PTHREAD_WARNSW, 0, NULL); + rt_print_flush_buffers(); + fprintf(stderr, "FAILURE %s:%d: %s returned %d instead of %d - %s\n", + fn, line, msg, status, expected, strerror(-status)); + exit(EXIT_FAILURE); +} + +static void check_sigdebug_inner(const char *fn, int line, const char *reason) +{ + if (sigdebug_received) + return; + + pthread_setmode_np(PTHREAD_WARNSW, 0, NULL); + rt_print_flush_buffers(); + fprintf(stderr, "FAILURE %s:%d: no %s received\n", fn, line, reason); + exit(EXIT_FAILURE); +} + +#define check(msg, status, expected) ({ \ + int __status = status; \ + check_inner(__FUNCTION__, __LINE__, msg, __status, expected); \ + __status; \ +}) + +#define check_no_error(msg, status) ({ \ + int __status = status; \ + check_inner(__FUNCTION__, __LINE__, msg,\ + __status < 0 ? __status : 0, 0);\ + __status; \ +}) + +#define check_sigdebug_received(reason) do { \ + const char *__reason = reason; \ + check_sigdebug_inner(__FUNCTION__, __LINE__, __reason); \ +} while (0) + +static void *rt_thread_body(void *cookie) +
[Xenomai-git] Jan Kiszka : smokey/sigdebug: Port from 2.6
Module: xenomai-jki Branch: for-forge Commit: f3456627f2d6090bea0929199678fbba572c7084 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=f3456627f2d6090bea0929199678fbba572c7084 Author: Jan Kiszka Date: Fri Dec 12 13:46:24 2014 +0100 smokey/sigdebug: Port from 2.6 This integrates the 2.6 testcase for validating the SIGDEBUG support to forge, taking interface changes into account, switching from native to POSIX and adding a test for the lock-break instrumentation. The latter is currently broken and will only succeed after the related fix is applied. Signed-off-by: Jan Kiszka --- configure.ac |1 + testsuite/smokey/Makefile.am |6 +- testsuite/smokey/sigdebug/Makefile.am | 10 ++ testsuite/smokey/sigdebug/sigdebug.c | 303 + 4 files changed, 318 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index fe647e4..2d4d61d 100644 --- a/configure.ac +++ b/configure.ac @@ -924,6 +924,7 @@ AC_CONFIG_FILES([ \ testsuite/smokey/iddp/Makefile \ testsuite/smokey/bufp/Makefile \ testsuite/smokey/fork-exec/Makefile \ + testsuite/smokey/sigdebug/Makefile \ testsuite/clocktest/Makefile \ testsuite/xeno-test/Makefile \ testsuite/regression/Makefile \ diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am index 449a69a..9ee9cf0 100644 --- a/testsuite/smokey/Makefile.am +++ b/testsuite/smokey/Makefile.am @@ -20,7 +20,8 @@ SUBDIRS = \ sched-quota \ sched-tp\ vdso-access \ - xddp + xddp\ + sigdebug else SUBDIRS = wrappers = @@ -59,4 +60,5 @@ DIST_SUBDIRS =\ sched-quota \ sched-tp\ vdso-access \ - xddp + xddp\ + sigdebug diff --git a/testsuite/smokey/sigdebug/Makefile.am b/testsuite/smokey/sigdebug/Makefile.am new file mode 100644 index 000..06b976d --- /dev/null +++ b/testsuite/smokey/sigdebug/Makefile.am @@ -0,0 +1,10 @@ + +noinst_LIBRARIES = libsigdebug.a + +libsigdebug_a_SOURCES = sigdebug.c + +CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC) + +libsigdebug_a_CPPFLAGS = \ + @XENO_USER_CFLAGS@ \ + -I$(top_srcdir)/include diff --git a/testsuite/smokey/sigdebug/sigdebug.c b/testsuite/smokey/sigdebug/sigdebug.c new file mode 100644 index 000..03f3d33 --- /dev/null +++ b/testsuite/smokey/sigdebug/sigdebug.c @@ -0,0 +1,303 @@ +/* + * Functional testing of unwanted domain switch debugging mechanism. + * + * Copyright (C) Siemens AG, 2012-2014 + * + * Authors: + * Jan Kiszka + * + * Released under the terms of GPLv2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +smokey_test_plugin(sigdebug, + SMOKEY_NOARGS, + "Check SIGDEBUG reporting." +); + +unsigned int expected_reason; +bool sigdebug_received; +pthread_mutex_t prio_invert; +sem_t send_signal; +char *mem; +FILE *wd; + +static void setup_checkdebug(unsigned int reason) +{ + sigdebug_received = false; + expected_reason = reason; +} + +static void check_inner(const char *fn, int line, const char *msg, + int status, int expected) +{ + if (status == expected) + return; + + pthread_setmode_np(PTHREAD_WARNSW, 0, NULL); + rt_print_flush_buffers(); + fprintf(stderr, "FAILURE %s:%d: %s returned %d instead of %d - %s\n", + fn, line, msg, status, expected, strerror(-status)); + exit(EXIT_FAILURE); +} + +static void check_sigdebug_inner(const char *fn, int line, const char *reason) +{ + if (sigdebug_received) + return; + + pthread_setmode_np(PTHREAD_WARNSW, 0, NULL); + rt_print_flush_buffers(); + fprintf(stderr, "FAILURE %s:%d: no %s received\n", fn, line, reason); + exit(EXIT_FAILURE); +} + +#define check(msg, status, expected) ({ \ + int __status = status; \ + check_inner(__FUNCTION__, __LINE__, msg, __status, expected); \ + __status; \ +}) + +#define check_no_error(msg, status) ({ \ + int __status = status; \ + check_inner(__FUNCTION__, __LINE__, msg,\ + __status < 0 ? __status : 0, 0);\ + __status; \ +}) + +#define check_sigdebug_received(reason) do { \ + const char *__reason = reason; \ + check_sigdebug_inner(__FUNCTION__, __LINE__, __reason); \ +} while (0) + +static void *rt_thread_body(void *