Re: [Xenomai-core] [PATCH 2/2] Testcase for the xnvdso mechanism
Gilles Chanteperdrix wrote: Wolfgang Mauerer wrote: Gilles Chanteperdrix wrote: Wolfgang Mauerer wrote: This testcase checks if the value in xnvdso-features matches the value of XNVDSO_FEATURES, that is, if the information is correctly transferred from kernel to userland. Notice that the approach will fail once configurations are supported that know of multiple features and implement only some of them. In this case, the testcase needs to be extended accordingly to check that only the expected features are present. Please allow to pass the value we want to check on the test command line. here you go. I suppose keeping XNVDSO_FEATURES as default value unless something different is specified is okay? Yes, ok. I am fine with the two patches. Ok. I merged them, but renamed a bit the symbols to get things more in line with what we do usually. xnvdso is the struct nkvdso is the global variable the xnsysinfo_t member is now simply vdso. -- Gilles. ___ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core
[Xenomai-core] [PATCH 2/2] Testcase for the xnvdso mechanism
This testcase checks if the value in xnvdso-features matches the value of XNVDSO_FEATURES, that is, if the information is correctly transferred from kernel to userland. Notice that the approach will fail once configurations are supported that know of multiple features and implement only some of them. In this case, the testcase needs to be extended accordingly to check that only the expected features are present. Signed-off-by: Wolfgang Mauerer wolfgang.maue...@siemens.com Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- src/testsuite/unit/Makefile.am | 15 +- src/testsuite/unit/runinfo.in |1 + src/testsuite/unit/xnvdso.c| 43 3 files changed, 58 insertions(+), 1 deletions(-) create mode 100644 src/testsuite/unit/xnvdso.c diff --git a/src/testsuite/unit/Makefile.am b/src/testsuite/unit/Makefile.am index 24d077a..c77cc54 100644 --- a/src/testsuite/unit/Makefile.am +++ b/src/testsuite/unit/Makefile.am @@ -2,7 +2,8 @@ testdir = $(exec_prefix)/share/xenomai/testsuite/unit CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC) -bin_PROGRAMS = arith wakeup-time mutex-torture-posix mutex-torture-native +bin_PROGRAMS = arith wakeup-time mutex-torture-posix mutex-torture-native \ + xnvdso arith_SOURCES = arith.c arith-noinline.c arith-noinline.h @@ -53,6 +54,18 @@ mutex_torture_native_LDADD = \ ../../skins/native/libnative.la \ -lpthread -lm +xnvdso_SOURCES = xnvdso.c + +xnvdso_CPPFLAGS = \ + @XENO_USER_CFLAGS@ \ + -I$(top_srcdir)/include + +xnvdso_LDFLAGS = @XENO_USER_LDFLAGS@ + +xnvdso_LDADD = \ + ../../skins/native/libnative.la \ + -lpthread -lm + install-data-local: $(mkinstalldirs) $(DESTDIR)$(testdir) @sed -e's,@exec_prefix\@,$(exec_prefix),g' $(srcdir)/runinfo.in $(DESTDIR)$(testdir)/.runinfo diff --git a/src/testsuite/unit/runinfo.in b/src/testsuite/unit/runinfo.in index f4cd208..a22afc0 100644 --- a/src/testsuite/unit/runinfo.in +++ b/src/testsuite/unit/runinfo.in @@ -2,3 +2,4 @@ arith:native:!...@exec_prefix@/bin/arith;popall:control_c wakeup-time:native:!...@exec_prefix@/bin/wakeup-time;popall:control_c mutex-torture-posix:posix:!...@exec_prefix@/bin/mutex-torture-posix;popall:control_c mutex-torture-native:native:!...@exec_prefix@/bin/mutex-torture-native;popall:control_c +xnvdso:native:!...@exec_prefix@/bin/xnvdso;popall:control_c diff --git a/src/testsuite/unit/xnvdso.c b/src/testsuite/unit/xnvdso.c new file mode 100644 index 000..6d7d8e1 --- /dev/null +++ b/src/testsuite/unit/xnvdso.c @@ -0,0 +1,43 @@ +/* + * VDSO feature set testcase + * by Wolfgang Mauerer wolfgang.maue...@siemens.com + */ + +#include stdio.h +#include asm/xenomai/syscall.h +#include nucleus/xnvdso.h + +extern unsigned long xeno_sem_heap[2]; + +int main(int argc, char **argv) +{ + int err; + xnsysinfo_t sysinfo; + struct xnvdso *xnvdso; + + if (!xeno_sem_heap[1]) { + fprintf(stderr, Could not determine position of the + global semaphore heap\n); + return 1; + } + + /* The muxid is irrelevant for this test as long as it's valid */ + err = XENOMAI_SYSCALL2(__xn_sys_info, 1, sysinfo); + if (err 0) { + fprintf(stderr, sys_sys_info failed: %d\n, err); + return 1; + } + + printf(Address of the global semaphore heap: 0x%lx\n, + xeno_sem_heap[1]); + printf(Offset of xnvdso: %lu\n, sysinfo.xnvdso_off); + + xnvdso = (struct xnvdso *)(xeno_sem_heap[1] + sysinfo.xnvdso_off); + printf(Contents of the features flag: %llu\n, xnvdso-features); + + if (xnvdso-features == XNVDSO_FEATURES) + return 0; + + fprintf(stderr, error: xnvdso-features != XNVDSO_FEATURES\n); + return 1; +} -- 1.6.4 ___ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core
Re: [Xenomai-core] [PATCH 2/2] Testcase for the xnvdso mechanism
Wolfgang Mauerer wrote: This testcase checks if the value in xnvdso-features matches the value of XNVDSO_FEATURES, that is, if the information is correctly transferred from kernel to userland. Notice that the approach will fail once configurations are supported that know of multiple features and implement only some of them. In this case, the testcase needs to be extended accordingly to check that only the expected features are present. Please allow to pass the value we want to check on the test command line. -- Gilles. ___ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core
Re: [Xenomai-core] [PATCH 2/2] Testcase for the xnvdso mechanism
Gilles Chanteperdrix wrote: Wolfgang Mauerer wrote: This testcase checks if the value in xnvdso-features matches the value of XNVDSO_FEATURES, that is, if the information is correctly transferred from kernel to userland. Notice that the approach will fail once configurations are supported that know of multiple features and implement only some of them. In this case, the testcase needs to be extended accordingly to check that only the expected features are present. Please allow to pass the value we want to check on the test command line. here you go. I suppose keeping XNVDSO_FEATURES as default value unless something different is specified is okay? Cheers, Wolfgang commit 0f31dc5c50f7034dddbac67c22e53823f1be72d3 Author: Wolfgang Mauerer wolfgang.maue...@siemens.com Date: Tue Dec 22 23:11:31 2009 +0100 Testcase for the xnvdso mechanism This testcase checks if the value in xnvdso-features matches the feature set specified on the command line. When no explicit feature test set is given, XNVDSO_FEATURES (i.e., the set of all features known to the current Xenomai revision) is used. Notice that the default approach will naturally fail once configurations are supported that know of multiple features and implement only some of them. Signed-off-by: Wolfgang Mauerer wolfgang.maue...@siemens.com Signed-off-by: Jan Kiszka jan.kis...@siemens.com diff --git a/src/testsuite/unit/Makefile.am b/src/testsuite/unit/Makefile.am index 24d077a..c77cc54 100644 --- a/src/testsuite/unit/Makefile.am +++ b/src/testsuite/unit/Makefile.am @@ -2,7 +2,8 @@ testdir = $(exec_prefix)/share/xenomai/testsuite/unit CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC) -bin_PROGRAMS = arith wakeup-time mutex-torture-posix mutex-torture-native +bin_PROGRAMS = arith wakeup-time mutex-torture-posix mutex-torture-native \ + xnvdso arith_SOURCES = arith.c arith-noinline.c arith-noinline.h @@ -53,6 +54,18 @@ mutex_torture_native_LDADD = \ ../../skins/native/libnative.la \ -lpthread -lm +xnvdso_SOURCES = xnvdso.c + +xnvdso_CPPFLAGS = \ + @XENO_USER_CFLAGS@ \ + -I$(top_srcdir)/include + +xnvdso_LDFLAGS = @XENO_USER_LDFLAGS@ + +xnvdso_LDADD = \ + ../../skins/native/libnative.la \ + -lpthread -lm + install-data-local: $(mkinstalldirs) $(DESTDIR)$(testdir) @sed -e's,@exec_prefix\@,$(exec_prefix),g' $(srcdir)/runinfo.in $(DESTDIR)$(testdir)/.runinfo diff --git a/src/testsuite/unit/runinfo.in b/src/testsuite/unit/runinfo.in index f4cd208..a22afc0 100644 --- a/src/testsuite/unit/runinfo.in +++ b/src/testsuite/unit/runinfo.in @@ -2,3 +2,4 @@ arith:native:!...@exec_prefix@/bin/arith;popall:control_c wakeup-time:native:!...@exec_prefix@/bin/wakeup-time;popall:control_c mutex-torture-posix:posix:!...@exec_prefix@/bin/mutex-torture-posix;popall:control_c mutex-torture-native:native:!...@exec_prefix@/bin/mutex-torture-native;popall:control_c +xnvdso:native:!...@exec_prefix@/bin/xnvdso;popall:control_c diff --git a/src/testsuite/unit/xnvdso.c b/src/testsuite/unit/xnvdso.c new file mode 100644 index 000..69305c2 --- /dev/null +++ b/src/testsuite/unit/xnvdso.c @@ -0,0 +1,52 @@ +/* + * VDSO feature set testcase + * by Wolfgang Mauerer wolfgang.maue...@siemens.com + */ + +#include stdio.h +#include stdlib.h +#include asm/xenomai/syscall.h +#include nucleus/xnvdso.h + +extern unsigned long xeno_sem_heap[2]; + +int main(int argc, char **argv) +{ + int err; + xnsysinfo_t sysinfo; + struct xnvdso *xnvdso; + unsigned long long test_features; + + if (argc != 2) { + printf(No specific feature(s) given, using XNVDSO_FEATURE\n); + test_features = XNVDSO_FEATURES; + } else { + test_features = strtoull(argv[1], NULL, 0); + } + + if (!xeno_sem_heap[1]) { + fprintf(stderr, Could not determine position of the + global semaphore heap\n); + return 1; + } + + /* The muxid is irrelevant for this test as long as it's valid */ + err = XENOMAI_SYSCALL2(__xn_sys_info, 1, sysinfo); + if (err 0) { + fprintf(stderr, sys_sys_info failed: %d\n, err); + return 1; + } + + printf(Address of the global semaphore heap: 0x%lx\n, + xeno_sem_heap[1]); + printf(Offset of xnvdso: %lu\n, sysinfo.xnvdso_off); + + xnvdso = (struct xnvdso *)(xeno_sem_heap[1] + sysinfo.xnvdso_off); + printf(Contents of the features flag: %llu\n, xnvdso-features); + + if (xnvdso-features == test_features) + return 0; + + fprintf(stderr, error: xnvdso-features != %llu\n, test_features); + return 1; +} ___ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core
Re: [Xenomai-core] [PATCH 2/2] Testcase for the xnvdso mechanism
Wolfgang Mauerer wrote: Gilles Chanteperdrix wrote: Wolfgang Mauerer wrote: This testcase checks if the value in xnvdso-features matches the value of XNVDSO_FEATURES, that is, if the information is correctly transferred from kernel to userland. Notice that the approach will fail once configurations are supported that know of multiple features and implement only some of them. In this case, the testcase needs to be extended accordingly to check that only the expected features are present. Please allow to pass the value we want to check on the test command line. here you go. I suppose keeping XNVDSO_FEATURES as default value unless something different is specified is okay? Yes, ok. I am fine with the two patches. -- Gilles. ___ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core