Module: xenomai-forge Branch: next Commit: cba307e88c0a83a7cda8a82468e4538a008a12b4 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=cba307e88c0a83a7cda8a82468e4538a008a12b4
Author: Philippe Gerum <r...@xenomai.org> Date: Tue May 27 14:25:15 2014 +0200 testsuite/unit: drop non-POSIX test All tests from the main suite should be POSIX-based. We may later want to resurrect the dropped test as an emulator-specific example though. --- doc/man/Makefile.in | 2 +- testsuite/unit/Makefile.am | 16 --- testsuite/unit/Makefile.in | 47 +------- testsuite/unit/wakeup-time.c | 270 ------------------------------------------ 4 files changed, 4 insertions(+), 331 deletions(-) diff --git a/doc/man/Makefile.in b/doc/man/Makefile.in index 7abdb59..65e3da8 100644 --- a/doc/man/Makefile.in +++ b/doc/man/Makefile.in @@ -80,7 +80,7 @@ host_triplet = @host@ target_triplet = @target@ DIST_COMMON = $(top_srcdir)/doc/asciidoc/asciidoc.rules \ $(top_srcdir)/doc/install-dist.rules $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am README + $(srcdir)/Makefile.am subdir = doc/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/ac_prog_cc_for_build.m4 \ diff --git a/testsuite/unit/Makefile.am b/testsuite/unit/Makefile.am index a933d99..c49ca19 100644 --- a/testsuite/unit/Makefile.am +++ b/testsuite/unit/Makefile.am @@ -3,7 +3,6 @@ testdir = @XENO_TEST_DIR@ CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC) test_PROGRAMS = \ - wakeup-time \ rtdm if XENO_COBALT @@ -108,21 +107,6 @@ else coredep_lib = endif -wakeup_time_SOURCES = wakeup-time.c - -wakeup_time_CPPFLAGS = \ - @XENO_USER_CFLAGS@ \ - -I$(top_srcdir)/include - -wakeup_time_LDFLAGS = - -wakeup_time_LDADD = \ - ../../lib/alchemy/libalchemy.la \ - ../../lib/copperplate/libcopperplate.la \ - $(coredep_lib) \ - @XENO_USER_LDADD@ \ - -lpthread -lrt -lm - rtdm_SOURCES = rtdm.c rtdm_CPPFLAGS = \ diff --git a/testsuite/unit/Makefile.in b/testsuite/unit/Makefile.in index 1aeec95..f5f5daf 100644 --- a/testsuite/unit/Makefile.in +++ b/testsuite/unit/Makefile.in @@ -79,7 +79,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -test_PROGRAMS = wakeup-time$(EXEEXT) rtdm$(EXEEXT) $(am__EXEEXT_1) +test_PROGRAMS = rtdm$(EXEEXT) $(am__EXEEXT_1) @XENO_COBALT_TRUE@am__append_1 = arith \ @XENO_COBALT_TRUE@ mutex-torture \ @XENO_COBALT_TRUE@ cond-torture \ @@ -182,13 +182,6 @@ sched_tp_OBJECTS = $(am_sched_tp_OBJECTS) sched_tp_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(sched_tp_LDFLAGS) $(LDFLAGS) -o $@ -am_wakeup_time_OBJECTS = wakeup_time-wakeup-time.$(OBJEXT) -wakeup_time_OBJECTS = $(am_wakeup_time_OBJECTS) -wakeup_time_DEPENDENCIES = ../../lib/alchemy/libalchemy.la \ - ../../lib/copperplate/libcopperplate.la $(am__DEPENDENCIES_1) -wakeup_time_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(wakeup_time_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -224,14 +217,12 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(arith_SOURCES) $(check_vdso_SOURCES) \ $(cond_torture_SOURCES) $(mutex_torture_SOURCES) \ - $(rtdm_SOURCES) $(sched_quota_SOURCES) $(sched_tp_SOURCES) \ - $(wakeup_time_SOURCES) + $(rtdm_SOURCES) $(sched_quota_SOURCES) $(sched_tp_SOURCES) DIST_SOURCES = $(am__arith_SOURCES_DIST) \ $(am__check_vdso_SOURCES_DIST) \ $(am__cond_torture_SOURCES_DIST) \ $(am__mutex_torture_SOURCES_DIST) $(rtdm_SOURCES) \ - $(am__sched_quota_SOURCES_DIST) $(am__sched_tp_SOURCES_DIST) \ - $(wakeup_time_SOURCES) + $(am__sched_quota_SOURCES_DIST) $(am__sched_tp_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -507,19 +498,6 @@ CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC) @XENO_COBALT_TRUE@ @XENO_USER_LDADD@ \ @XENO_COBALT_TRUE@ -lpthread -lrt -lm -wakeup_time_SOURCES = wakeup-time.c -wakeup_time_CPPFLAGS = \ - @XENO_USER_CFLAGS@ \ - -I$(top_srcdir)/include - -wakeup_time_LDFLAGS = -wakeup_time_LDADD = \ - ../../lib/alchemy/libalchemy.la \ - ../../lib/copperplate/libcopperplate.la \ - $(coredep_lib) \ - @XENO_USER_LDADD@ \ - -lpthread -lrt -lm - rtdm_SOURCES = rtdm.c rtdm_CPPFLAGS = \ @XENO_USER_CFLAGS@ \ @@ -645,10 +623,6 @@ sched-tp$(EXEEXT): $(sched_tp_OBJECTS) $(sched_tp_DEPENDENCIES) $(EXTRA_sched_tp @rm -f sched-tp$(EXEEXT) $(AM_V_CCLD)$(sched_tp_LINK) $(sched_tp_OBJECTS) $(sched_tp_LDADD) $(LIBS) -wakeup-time$(EXEEXT): $(wakeup_time_OBJECTS) $(wakeup_time_DEPENDENCIES) $(EXTRA_wakeup_time_DEPENDENCIES) - @rm -f wakeup-time$(EXEEXT) - $(AM_V_CCLD)$(wakeup_time_LINK) $(wakeup_time_OBJECTS) $(wakeup_time_LDADD) $(LIBS) - mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -663,7 +637,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtdm-rtdm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_quota-sched-quota.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_tp-sched-tp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wakeup_time-wakeup-time.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -798,20 +771,6 @@ sched_tp-sched-tp.obj: sched-tp.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sched_tp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sched_tp-sched-tp.obj `if test -f 'sched-tp.c'; then $(CYGPATH_W) 'sched-tp.c'; else $(CYGPATH_W) '$(srcdir)/sched-tp.c'; fi` -wakeup_time-wakeup-time.o: wakeup-time.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wakeup_time_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT wakeup_time-wakeup-time.o -MD -MP -MF $(DEPDIR)/wakeup_time-wakeup-time.Tpo -c -o wakeup_time-wakeup-time.o `test -f 'wakeup-time.c' || echo '$(srcdir)/'`wakeup-time.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/wakeup_time-wakeup-time.Tpo $(DEPDIR)/wakeup_time-wakeup-time.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wakeup-time.c' object='wakeup_time-wakeup-time.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wakeup_time_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o wakeup_time-wakeup-time.o `test -f 'wakeup-time.c' || echo '$(srcdir)/'`wakeup-time.c - -wakeup_time-wakeup-time.obj: wakeup-time.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wakeup_time_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT wakeup_time-wakeup-time.obj -MD -MP -MF $(DEPDIR)/wakeup_time-wakeup-time.Tpo -c -o wakeup_time-wakeup-time.obj `if test -f 'wakeup-time.c'; then $(CYGPATH_W) 'wakeup-time.c'; else $(CYGPATH_W) '$(srcdir)/wakeup-time.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/wakeup_time-wakeup-time.Tpo $(DEPDIR)/wakeup_time-wakeup-time.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wakeup-time.c' object='wakeup_time-wakeup-time.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wakeup_time_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o wakeup_time-wakeup-time.obj `if test -f 'wakeup-time.c'; then $(CYGPATH_W) 'wakeup-time.c'; else $(CYGPATH_W) '$(srcdir)/wakeup-time.c'; fi` - mostlyclean-libtool: -rm -f *.lo diff --git a/testsuite/unit/wakeup-time.c b/testsuite/unit/wakeup-time.c deleted file mode 100644 index d1b1e61..0000000 --- a/testsuite/unit/wakeup-time.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - Task switch latency test. - Max Krasnyansky <m...@qualcomm.com - - Based on latency.c by Philippe Gerum <r...@xenomai.org> -*/ - -#include <sys/mman.h> -#include <unistd.h> -#include <stdlib.h> -#include <math.h> -#include <stdio.h> -#include <string.h> -#include <signal.h> -#include <getopt.h> -#include <copperplate/init.h> -#include <alchemy/task.h> -#include <alchemy/timer.h> -#include <alchemy/sem.h> - -static RT_TASK event_task, worker_task; - -static RT_SEM switch_sem; -static RTIME switch_tsc; -static unsigned long long switch_count; - -static long long minjitter = 10000000; -static long long maxjitter = -10000000; -static long long avgjitter; -static long long lost; -static long long nsamples = 50000; -static long long sampling_period = CONFIG_XENO_DEFAULT_PERIOD; - -#define HISTOGRAM_CELLS 100 - -static unsigned long histogram[HISTOGRAM_CELLS]; - -static int do_histogram; -static int warmup = 5; -static int late; - -static inline void add_histogram(long addval) -{ - /* usec steps */ - long inabs = rt_timer_tsc2ns(addval >= 0 ? addval : -addval) / 1000; - histogram[inabs < HISTOGRAM_CELLS ? inabs : HISTOGRAM_CELLS - 1]++; -} - -static void dump_stats(double sum, int total_hits) -{ - int n; - double avg, variance = 0; - - avg = sum / total_hits; - for (n = 0; n < HISTOGRAM_CELLS; n++) { - long hits = histogram[n]; - if (hits) - variance += hits * (n-avg) * (n-avg); - } - - /* compute std-deviation (unbiased form) */ - variance /= total_hits - 1; - variance = sqrt(variance); - - printf("HSS| %9d| %10.3f| %10.3f\n", total_hits, avg, variance); -} - -static void dump_histogram(void) -{ - int n, total_hits = 0; - double sum = 0; - fprintf(stderr, "---|---range-|---samples\n"); - for (n = 0; n < HISTOGRAM_CELLS; n++) { - long hits = histogram[n]; - if (hits) { - total_hits += hits; - sum += n * hits; - fprintf(stderr, "HSD| %d - %d | %10ld\n", - n, n + 1, hits); - } - } - dump_stats(sum, total_hits); -} - -static void event(void *cookie) -{ - int err; - - err = rt_task_set_periodic(NULL, - TM_NOW, - rt_timer_ns2ticks(sampling_period)); - if (err) { - warning("failed to enter periodic timing (%s)\n", - symerror(err)); - return; - } - - for (;;) { - err = rt_task_wait_period(NULL); - if (err) { - if (err != -ETIMEDOUT) - exit(EXIT_FAILURE); - late++; - } - - switch_count++; - err = rt_sem_broadcast(&switch_sem); - switch_tsc = rt_timer_tsc(); - if (err) { - if (err != -EIDRM && err != -EINVAL) - warning("failed to broadcast semaphore (%s)\n", - symerror(err)); - break; - } - } -} - -static void worker(void *cookie) -{ - long long minj = 10000000, maxj = -10000000, dt, sumj = 0; - unsigned long long count = 0; - int err, n; - - err = rt_sem_create(&switch_sem, "dispsem", 0, S_FIFO); - if (err) { - warning("failed to create semaphore (%s)\n", - symerror(err)); - return; - } - - for (n = 0; n < nsamples; n++) { - err = rt_sem_p(&switch_sem, TM_INFINITE); - if (err) { - if (err != -EIDRM && err != -EINVAL) - warning("failed to pend on semaphore (%s)\n", - symerror(err)); - exit(EXIT_FAILURE); - } - - dt = (long) (rt_timer_tsc() - switch_tsc); - - if (switch_count - count > 1) { - lost += switch_count - count; - count = switch_count; - continue; - } - - if (++count < warmup) - continue; - - if (dt > maxj) - maxj = dt; - if (dt < minj) - minj = dt; - sumj += dt; - - if (do_histogram) - add_histogram(dt); - } - - rt_sem_delete(&switch_sem); - - minjitter = minj; - maxjitter = maxj; - avgjitter = sumj / n; - - printf("RTH|%12s|%12s|%12s|%12s\n", - "lat min", "lat avg", "lat max", "lost"); - - printf("RTD|%12.3f|%12.3f|%12.3f|%12lld\n", - rt_timer_tsc2ns(minjitter) / 1000.0, - rt_timer_tsc2ns(avgjitter) / 1000.0, - rt_timer_tsc2ns(maxjitter) / 1000.0, lost); - - if (late) - printf("LATE: %d\n", late); - - if (do_histogram) - dump_histogram(); - - exit(0); -} - -int main(int argc, char *const *argv) -{ - int err, c; - - copperplate_init(&argc, &argv); - - while ((c = getopt(argc, argv, "hp:n:i:")) != EOF) - switch (c) { - case 'h': - /* ./switch --h[istogram] */ - do_histogram = 1; - break; - - case 'p': - sampling_period = atoi(optarg) * 1000; - break; - - case 'n': - nsamples = atoi(optarg); - break; - - case 'i': - warmup = atoi(optarg); - break; - - default: - - fprintf(stderr, "usage: switch [options]\n" - "\t-h - enable histogram\n" - "\t-p <period_us> - timer period\n" - "\t-n <samples> - number of samples to collect\n" - "\t-i <samples> - number of _first_ samples to ignore\n"); - exit(2); - } - - if (sampling_period == 0) - sampling_period = 100000; /* ns */ - - if (nsamples <= 0) { - warning("disregarding -n <%lld>, using -n <100000> " - "samples\n", nsamples); - nsamples = 100000; - } - - signal(SIGINT, SIG_IGN); - signal(SIGTERM, SIG_IGN); - - setlinebuf(stdout); - - mlockall(MCL_CURRENT|MCL_FUTURE); - - printf("== Sampling period: %llu us\n", sampling_period / 1000); - printf("== Do not interrupt this program\n"); - - err = rt_task_create(&worker_task, "worker", 0, 98, 0); - if (err) { - warning("failed to create WORKER task (%s)\n", - symerror(err)); - return 1; - } - - err = rt_task_start(&worker_task, &worker, NULL); - if (err) { - warning("failed to start WORKER task (%s)\n", - symerror(err)); - return 1; - } - - err = rt_task_create(&event_task, "event", 0, 99, 0); - if (err) { - warning("failed to create EVENT task (%s)\n", - symerror(err)); - return 1; - } - - err = rt_task_start(&event_task, &event, NULL); - if (err) { - warning("failed to start EVENT task (%s)\n", - symerror(err)); - return 1; - } - - for (;;) - pause(); - - return 0; -} _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git