[rtems-libbsd commit] Fix sporadic test failures via uma_timeout()
Sebastian Huber
sebh at rtems.org
Thu Jul 26 12:17:16 UTC 2018
Module: rtems-libbsd
Branch: master
Commit: 6fb003f5880405d664f532ce9313f0bd666ca675
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=6fb003f5880405d664f532ce9313f0bd666ca675
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Jul 26 12:03:45 2018 +0200
Fix sporadic test failures via uma_timeout()
---
freebsd/sys/vm/uma.h | 3 +++
freebsd/sys/vm/uma_core.c | 12 ++++++++++++
testsuite/syscalls01/test_main.c | 17 +++++------------
testsuite/thread01/test_main.c | 11 ++++++++++-
4 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/freebsd/sys/vm/uma.h b/freebsd/sys/vm/uma.h
index 5e0bdd7..c968e67 100644
--- a/freebsd/sys/vm/uma.h
+++ b/freebsd/sys/vm/uma.h
@@ -695,4 +695,7 @@ struct uma_percpu_stat {
void uma_reclaim_wakeup(void);
void uma_reclaim_worker(void *);
+#ifdef __rtems__
+void rtems_uma_drain_timeout(void);
+#endif /* __rtems__ */
#endif /* _VM_UMA_H_ */
diff --git a/freebsd/sys/vm/uma_core.c b/freebsd/sys/vm/uma_core.c
index fbae47c..02f743d 100644
--- a/freebsd/sys/vm/uma_core.c
+++ b/freebsd/sys/vm/uma_core.c
@@ -3814,3 +3814,15 @@ DB_SHOW_COMMAND(umacache, db_show_umacache)
}
#endif /* DDB */
#endif /* __rtems__ */
+#ifdef __rtems__
+/*
+ * This is a helper routine for test programs. The uma_timeout() may need some
+ * dynamic memory. This could disturb out of memory tests.
+ */
+void
+rtems_uma_drain_timeout(void)
+{
+
+ callout_drain(&uma_callout);
+}
+#endif /* __rtems__ */
diff --git a/testsuite/syscalls01/test_main.c b/testsuite/syscalls01/test_main.c
index a00151b..af77d48 100644
--- a/testsuite/syscalls01/test_main.c
+++ b/testsuite/syscalls01/test_main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2013, 2018 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -38,6 +38,7 @@
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/filio.h>
+#include <vm/uma.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <err.h>
@@ -1599,23 +1600,15 @@ test_setgethostname(void)
assert(in[sizeof(in) - 1] == '\0');
}
-static void set_self_prio(rtems_task_priority prio)
-{
- rtems_status_code sc;
-
- sc = rtems_task_set_priority(RTEMS_SELF, prio, &prio);
- assert(sc == RTEMS_SUCCESSFUL);
-}
-
static void
test_main(void)
{
/*
- * No interruptions by the timer server. The uma_timeout() may need
- * some dynamic memory. This could disturb the no memory tests.
+ * Stop interferences of uma_timeout() which may need some dynamic
+ * memory. This could disturb the no memory tests.
*/
- set_self_prio(1);
+ rtems_uma_drain_timeout();
/* Must be first test to ensure resource checks work */
test_sockets();
diff --git a/testsuite/thread01/test_main.c b/testsuite/thread01/test_main.c
index f1cef30..fa15b9f 100644
--- a/testsuite/thread01/test_main.c
+++ b/testsuite/thread01/test_main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2013, 2018 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -43,6 +43,8 @@
#include <sys/kthread.h>
#include <sys/errno.h>
+#include <vm/uma.h>
+
#include <rtems/bsd/bsd.h>
#include <rtems.h>
@@ -284,8 +286,15 @@ test_rtems_bsd_get_curthread_or_null(void)
static void
test_main(void)
{
+
main_task_id = rtems_task_self();
+ /*
+ * Stop interferences of uma_timeout() which may need some dynamic
+ * memory. This could disturb the no memory tests.
+ */
+ rtems_uma_drain_timeout();
+
test_non_bsd_thread();
test_kproc_start();
test_kthread_start();
More information about the vc
mailing list