RTEMS5: update libbsd logging

Show messages synchronously during boot,
then redirect through errlog before user app.

Disable syslog() during tests
This commit is contained in:
Michael Davidsaver
2021-06-26 22:02:33 -07:00
parent c1dcd728d7
commit 5ef537684e
2 changed files with 66 additions and 6 deletions

View File

@@ -28,6 +28,13 @@
# endif
#endif
#ifdef __rtems__
# include <syslog.h>
# ifndef RTEMS_LEGACY_STACK
# include <rtems/bsd/bsd.h>
# endif
#endif
#include "epicsThread.h"
#include "epicsMutex.h"
#include "epicsUnitTest.h"
@@ -95,6 +102,18 @@ static int testReportHook(int reportType, char *message, int *returnValue)
static void testOnce(void *dummy) {
testLock = epicsMutexMustCreate();
perlHarness = (getenv("HARNESS_ACTIVE") != NULL);
#ifdef __rtems__
// syslog() on RTEMS prints to stdout, which will interfere with test output.
// setlogmask() ignores empty mask, so must allow at least one level.
(void)setlogmask(LOG_MASK(LOG_CRIT));
printf("# mask syslog() output\n");
#ifndef RTEMS_LEGACY_STACK
// with libbsd setlogmask() is a no-op :(
// name strings in sys/syslog.h
rtems_bsd_setlogpriority("crit");
#endif
#endif
#ifdef _WIN32
#ifdef HAVE_SETERROMODE
/* SEM_FAILCRITICALERRORS - Don't display modal dialog