Module: xenomai-3
Branch: master
Commit: 7c4492ac779b049204c39a617f9ee22b72f81c37
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7c4492ac779b049204c39a617f9ee22b72f81c37

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Jul 29 16:18:36 2015 +0200

testsuite/smokey: fail if out of quota

---

 testsuite/smokey/sched-quota/sched-quota.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/testsuite/smokey/sched-quota/sched-quota.c 
b/testsuite/smokey/sched-quota/sched-quota.c
index e51c78e..3f7a8ea 100644
--- a/testsuite/smokey/sched-quota/sched-quota.c
+++ b/testsuite/smokey/sched-quota/sched-quota.c
@@ -9,6 +9,7 @@
 #include <stdlib.h>
 #include <limits.h>
 #include <unistd.h>
+#include <math.h>
 #include <pthread.h>
 #include <semaphore.h>
 #include <sched.h>
@@ -328,5 +329,11 @@ static int run_sched_quota(struct smokey_test *t, int 
argc, char *const argv[])
        smokey_trace("%d thread%s: cap=%d%%, effective=%.1f%%",
                     nrthreads, nrthreads > 1 ? "s": "", quota, effective);
 
+       if (fabs(effective - (double)quota) > 0.5) {
+               smokey_warning("out of quota: %.1f%%",
+                              effective - (double)quota);
+               return -EPROTO;
+       }
+
        return 0;
 }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to