Module: xenomai-3 Branch: next Commit: 34885aea6229a25d2965533d92b886297a866e68 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=34885aea6229a25d2965533d92b886297a866e68
Author: Philippe Gerum <r...@xenomai.org> Date: Thu Mar 26 11:47:46 2015 +0100 testsuite/smokey: skip tests lacking kernel support --- testsuite/smokey/bufp/bufp.c | 8 ++++++++ testsuite/smokey/iddp/iddp.c | 8 ++++++++ testsuite/smokey/main.c | 5 +++++ testsuite/smokey/rtdm/rtdm.c | 7 +++++-- testsuite/smokey/sched-quota/sched-quota.c | 7 ++++++- testsuite/smokey/sched-tp/sched-tp.c | 7 ++++++- testsuite/smokey/xddp/xddp.c | 8 ++++++++ 7 files changed, 46 insertions(+), 4 deletions(-) diff --git a/testsuite/smokey/bufp/bufp.c b/testsuite/smokey/bufp/bufp.c index 6c5d2e3..d839f44 100644 --- a/testsuite/smokey/bufp/bufp.c +++ b/testsuite/smokey/bufp/bufp.c @@ -137,6 +137,14 @@ static int run_bufp(struct smokey_test *t, int argc, char *const argv[]) struct sched_param svparam = {.sched_priority = 71 }; struct sched_param clparam = {.sched_priority = 70 }; pthread_attr_t svattr, clattr; + int s; + + s = socket(AF_RTIPC, SOCK_DGRAM, IPCPROTO_BUFP); + if (s < 0) { + if (errno == EAFNOSUPPORT) + return -ENOSYS; + } else + close(s); pthread_attr_init(&svattr); pthread_attr_setdetachstate(&svattr, PTHREAD_CREATE_JOINABLE); diff --git a/testsuite/smokey/iddp/iddp.c b/testsuite/smokey/iddp/iddp.c index 8b73a3b..01c9461 100644 --- a/testsuite/smokey/iddp/iddp.c +++ b/testsuite/smokey/iddp/iddp.c @@ -141,6 +141,14 @@ static int run_iddp(struct smokey_test *t, int argc, char *const argv[]) struct sched_param svparam = {.sched_priority = 71 }; struct sched_param clparam = {.sched_priority = 70 }; pthread_attr_t svattr, clattr; + int s; + + s = socket(AF_RTIPC, SOCK_DGRAM, IPCPROTO_IDDP); + if (s < 0) { + if (errno == EAFNOSUPPORT) + return -ENOSYS; + } else + close(s); pthread_attr_init(&svattr); pthread_attr_setdetachstate(&svattr, PTHREAD_CREATE_JOINABLE); diff --git a/testsuite/smokey/main.c b/testsuite/smokey/main.c index 54ec339..37af8b5 100644 --- a/testsuite/smokey/main.c +++ b/testsuite/smokey/main.c @@ -30,6 +30,11 @@ int main(int argc, char *const argv[]) for_each_smokey_test(t) { ret = t->run(t, argc, argv); if (ret) { + if (ret == -ENOSYS) { + smokey_note("%s skipped (no kernel support)\n", + t->name); + continue; + } fails++; if (smokey_keep_going) continue; diff --git a/testsuite/smokey/rtdm/rtdm.c b/testsuite/smokey/rtdm/rtdm.c index cc85abb..1e2d6bc 100644 --- a/testsuite/smokey/rtdm/rtdm.c +++ b/testsuite/smokey/rtdm/rtdm.c @@ -76,10 +76,13 @@ static const char *devname2 = "/dev/rtdm/rtdm1"; static int run_rtdm(struct smokey_test *t, int argc, char *const argv[]) { unsigned long long start; - int dev, dev2; + int dev, dev2, status; + + status = system("modprobe xeno_rtdmtest"); + if (status < 0 || WEXITSTATUS(status)) + return -ENOSYS; printf("Setup\n"); - check("modprobe", system("modprobe xeno_rtdmtest"), 0); dev = check_no_error("open", open(devname, O_RDWR)); printf("Exclusive open\n"); diff --git a/testsuite/smokey/sched-quota/sched-quota.c b/testsuite/smokey/sched-quota/sched-quota.c index 9c08924..ece17e9 100644 --- a/testsuite/smokey/sched-quota/sched-quota.c +++ b/testsuite/smokey/sched-quota/sched-quota.c @@ -14,6 +14,7 @@ #include <sched.h> #include <errno.h> #include <error.h> +#include <sys/cobalt.h> #include <boilerplate/time.h> #include <boilerplate/ancillaries.h> #include <boilerplate/atomic.h> @@ -277,11 +278,15 @@ static unsigned long long calibrate(void) static int run_sched_quota(struct smokey_test *t, int argc, char *const argv[]) { pthread_t me = pthread_self(); + int ret, quota = 0, policies; struct sched_param param; - int ret, quota = 0; cpu_set_t affinity; double effective; + ret = cobalt_corectl(_CC_COBALT_GET_POLICIES, &policies, sizeof(policies)); + if (ret || (policies & _CC_COBALT_SCHED_QUOTA) == 0) + return -ENOSYS; + CPU_ZERO(&affinity); CPU_SET(0, &affinity); ret = sched_setaffinity(0, sizeof(affinity), &affinity); diff --git a/testsuite/smokey/sched-tp/sched-tp.c b/testsuite/smokey/sched-tp/sched-tp.c index b946c85..8635a97 100644 --- a/testsuite/smokey/sched-tp/sched-tp.c +++ b/testsuite/smokey/sched-tp/sched-tp.c @@ -17,6 +17,7 @@ #include <sched.h> #include <errno.h> #include <error.h> +#include <sys/cobalt.h> #include <smokey/smokey.h> smokey_test_plugin(sched_tp, @@ -103,9 +104,13 @@ static void __create_thread(pthread_t *tid, const char *name, int seq) static int run_sched_tp(struct smokey_test *t, int argc, char *const argv[]) { union sched_config *p; + int ret, n, policies; size_t len; - int ret, n; + ret = cobalt_corectl(_CC_COBALT_GET_POLICIES, &policies, sizeof(policies)); + if (ret || (policies & _CC_COBALT_SCHED_TP) == 0) + return -ENOSYS; + /* * For a recurring global time frame of 400 ms, we define a TP * schedule as follows: diff --git a/testsuite/smokey/xddp/xddp.c b/testsuite/smokey/xddp/xddp.c index 8c4a4af..0d1202a 100644 --- a/testsuite/smokey/xddp/xddp.c +++ b/testsuite/smokey/xddp/xddp.c @@ -220,6 +220,14 @@ static int run_xddp(struct smokey_test *t, int argc, char *const argv[]) { struct sched_param param = { .sched_priority = 42 }; pthread_attr_t rtattr, regattr; + int s; + + s = socket(AF_RTIPC, SOCK_DGRAM, IPCPROTO_XDDP); + if (s < 0) { + if (errno == EAFNOSUPPORT) + return -ENOSYS; + } else + close(s); sem_init(&semsync, 0, 0); _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git