Module: xenomai-3
Branch: next
Commit: 623f072be3e37f8a3aa6b03f92a63480c63a2ba5
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=623f072be3e37f8a3aa6b03f92a63480c63a2ba5

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Jun 20 10:39:54 2015 +0200

lib/smokey, testsuite/smokey: issue terminating newline on note/warning

---

 include/smokey/smokey.h              |    4 ++--
 lib/smokey/helpers.c                 |    5 ++++-
 lib/smokey/init.c                    |    5 +++--
 testsuite/smokey/Makefile.am         |    4 ++--
 testsuite/smokey/bufp/bufp.c         |    4 ++--
 testsuite/smokey/iddp/iddp.c         |    4 ++--
 testsuite/smokey/main.c              |    4 ++--
 testsuite/smokey/sigdebug/sigdebug.c |   16 ++++++++--------
 testsuite/smokey/xddp/xddp.c         |    6 +++---
 9 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/include/smokey/smokey.h b/include/smokey/smokey.h
index d8aa9d8..bf968f7 100644
--- a/include/smokey/smokey.h
+++ b/include/smokey/smokey.h
@@ -102,7 +102,7 @@ struct smokey_test {
                int __ret = (__expr);                                   \
                if (__ret < 0) {                                        \
                        __ret = -errno;                                 \
-                       smokey_warning(__FILE__, __LINE__, "%s: %s\n",  \
+                       smokey_warning(__FILE__, __LINE__, "%s: %s",    \
                                       #__expr, strerror(errno));       \
                }                                                       \
                __ret;                                                  \
@@ -113,7 +113,7 @@ struct smokey_test {
                int __ret = (__expr);                                   \
                if (!__ret)                                             \
                        smokey_warning(__FILE__, __LINE__,              \
-                                      "assertion failed: %s\n", #__expr); \
+                                      "assertion failed: %s", #__expr); \
                __ret;                                                  \
        })
 
diff --git a/lib/smokey/helpers.c b/lib/smokey/helpers.c
index 53ff879..cef86aa 100644
--- a/lib/smokey/helpers.c
+++ b/lib/smokey/helpers.c
@@ -124,8 +124,10 @@ void smokey_note(const char *fmt, ...)
 
        va_start(ap, fmt);
 
-       if (smokey_verbose_mode)
+       if (smokey_verbose_mode) {
                __RT(vfprintf(stdout, fmt, ap));
+               __RT(fprintf(stdout, "\n"));
+       }
 
        va_end(ap);
 }
@@ -140,6 +142,7 @@ void smokey_warning(const char *file, int lineno,
        if (smokey_verbose_mode) {
                __RT(fprintf(stderr, "%s:%d, ", basename(file), lineno));
                __RT(vfprintf(stderr, fmt, ap));
+               __RT(fprintf(stdout, "\n"));
        }
 
        va_end(ap);
diff --git a/lib/smokey/init.c b/lib/smokey/init.c
index c6dfa79..876fc0d 100644
--- a/lib/smokey/init.c
+++ b/lib/smokey/init.c
@@ -203,7 +203,8 @@
  *
  * The printf-like @a smokey_note() routine is available for issuing
  * progress messages to the output device (currently stdout), unless
- * --silent was detected on the command line.
+ * --silent was detected on the command line. smokey_note() outputs
+ * a terminating newline character.
  *
  * Therefore, a possible implementation of a test driver could be as
  * basic as:
@@ -228,7 +229,7 @@
  *                             continue;
  *                     error(1, -ret, "test %s failed", t->name);
  *             }
- *             smokey_note("%s OK\n", t->name);
+ *             smokey_note("%s OK", t->name);
  *     }
  *
  *     return 0;
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index f5a866c..b1a6426 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -10,7 +10,7 @@ wrappers = $(XENO_POSIX_WRAPPERS)
 SUBDIRS =              \
        arith           \
        bufp            \
-       clock           \
+       posix-clock      \
        cond-torture    \
        fork-exec       \
        iddp            \
@@ -50,7 +50,7 @@ smokey_LDADD =                                        \
 DIST_SUBDIRS =                 \
        arith           \
        bufp            \
-       clock           \
+       posix-clock     \
        cond-torture    \
        fork-exec       \
        iddp            \
diff --git a/testsuite/smokey/bufp/bufp.c b/testsuite/smokey/bufp/bufp.c
index d839f44..14ff033 100644
--- a/testsuite/smokey/bufp/bufp.c
+++ b/testsuite/smokey/bufp/bufp.c
@@ -83,7 +83,7 @@ static void *server(void *arg)
                        errno = -EINVAL;
                        fail("recvfrom");
                }
-               smokey_note("%s: received %d bytes, %ld from port %d\n",
+               smokey_note("%s: received %d bytes, %ld from port %d",
                          __FUNCTION__, ret, data, claddr.sipc_port);
        }
 
@@ -123,7 +123,7 @@ static void *client(void *arg)
                        close(s);
                        fail("sendto");
                }
-               smokey_note("%s: sent %d bytes, %ld\n", __FUNCTION__, ret, 
data);
+               smokey_note("%s: sent %d bytes, %ld", __FUNCTION__, ret, data);
                ts.tv_sec = 0;
                ts.tv_nsec = 100000000; /* 100 ms */
                clock_nanosleep(CLOCK_REALTIME, 0, &ts, NULL);
diff --git a/testsuite/smokey/iddp/iddp.c b/testsuite/smokey/iddp/iddp.c
index 01c9461..dc65f2e 100644
--- a/testsuite/smokey/iddp/iddp.c
+++ b/testsuite/smokey/iddp/iddp.c
@@ -83,7 +83,7 @@ static void *server(void *arg)
                        errno = -EINVAL;
                        fail("recvfrom");
                }
-               smokey_note("%s: received %d bytes, %ld from port %d\n",
+               smokey_note("%s: received %d bytes, %ld from port %d",
                          __FUNCTION__, ret, data, claddr.sipc_port);
        }
 
@@ -127,7 +127,7 @@ static void *client(void *arg)
                        close(s);
                        fail("sendto");
                }
-               smokey_note("%s: sent %d bytes, %ld\n", __FUNCTION__, ret, 
data);
+               smokey_note("%s: sent %d bytes, %ld", __FUNCTION__, ret, data);
                ts.tv_sec = 0;
                ts.tv_nsec = 100000000; /* 100 ms */
                clock_nanosleep(CLOCK_REALTIME, 0, &ts, NULL);
diff --git a/testsuite/smokey/main.c b/testsuite/smokey/main.c
index ea87390..e946880 100644
--- a/testsuite/smokey/main.c
+++ b/testsuite/smokey/main.c
@@ -31,7 +31,7 @@ int main(int argc, char *const argv[])
                ret = t->run(t, argc, argv);
                if (ret) {
                        if (ret == -ENOSYS) {
-                               smokey_note("%s skipped (no kernel support)\n",
+                               smokey_note("%s skipped (no kernel support)",
                                            t->name);
                                continue;
                        }
@@ -41,7 +41,7 @@ int main(int argc, char *const argv[])
                        if (smokey_verbose_mode)
                                error(1, -ret, "test %s failed", t->name);
                }
-               smokey_note("%s OK\n", t->name);
+               smokey_note("%s OK", t->name);
        }
 
        return fails != 0;
diff --git a/testsuite/smokey/sigdebug/sigdebug.c 
b/testsuite/smokey/sigdebug/sigdebug.c
index aa04301..ccaef7c 100644
--- a/testsuite/smokey/sigdebug/sigdebug.c
+++ b/testsuite/smokey/sigdebug/sigdebug.c
@@ -96,12 +96,12 @@ static void *rt_thread_body(void *cookie)
        err = pthread_setmode_np(0, PTHREAD_WARNSW, NULL);
        check_no_error("pthread_setmode_np", err);
 
-       smokey_note("syscall\n");
+       smokey_note("syscall");
        setup_checkdebug(SIGDEBUG_MIGRATE_SYSCALL);
        syscall(__NR_gettid);
        check_sigdebug_received("SIGDEBUG_MIGRATE_SYSCALL");
 
-       smokey_note("signal\n");
+       smokey_note("signal");
        setup_checkdebug(SIGDEBUG_MIGRATE_SIGNAL);
        err = sem_post(&send_signal);
        check_no_error("sem_post", err);
@@ -109,13 +109,13 @@ static void *rt_thread_body(void *cookie)
        check_no_error("clock_nanosleep", err);
        check_sigdebug_received("SIGDEBUG_MIGRATE_SIGNAL");
 
-       smokey_note("relaxed mutex owner\n");
+       smokey_note("relaxed mutex owner");
        setup_checkdebug(SIGDEBUG_MIGRATE_PRIOINV);
        err = pthread_mutex_lock(&prio_invert);
        check_no_error("pthread_mutex_lock", err);
        check_sigdebug_received("SIGDEBUG_MIGRATE_PRIOINV");
 
-       smokey_note("page fault\n");
+       smokey_note("page fault");
        setup_checkdebug(SIGDEBUG_MIGRATE_FAULT);
        delay.tv_nsec = 0;
        err = clock_nanosleep(CLOCK_MONOTONIC, 0, &delay, NULL);
@@ -124,7 +124,7 @@ static void *rt_thread_body(void *cookie)
        check_sigdebug_received("SIGDEBUG_MIGRATE_FAULT");
 
        if (wd) {
-               smokey_note("watchdog\n");
+               smokey_note("watchdog");
                rt_print_flush_buffers();
                setup_checkdebug(SIGDEBUG_WATCHDOG);
                clock_gettime(CLOCK_MONOTONIC, &now);
@@ -137,9 +137,9 @@ static void *rt_thread_body(void *cookie)
                         !sigdebug_received);
                check_sigdebug_received("SIGDEBUG_WATCHDOG");
        } else
-               smokey_note("watchdog not tested\n");
+               smokey_note("watchdog not tested");
 
-       smokey_note("lock break\n");
+       smokey_note("lock break");
        setup_checkdebug(SIGDEBUG_LOCK_BREAK);
        err = pthread_setmode_np(0, PTHREAD_LOCK_SCHED |
                                    PTHREAD_DISABLE_LOCKBREAK, NULL);
@@ -251,7 +251,7 @@ static int run_sigdebug(struct smokey_test *t, int argc, 
char *const argv[])
        err = pthread_attr_setschedparam(&attr, &params);
        check_no_error("pthread_attr_setschedparam", err);
 
-       smokey_note("mlockall\n");
+       smokey_note("mlockall");
        munlockall();
        setup_checkdebug(SIGDEBUG_NOMLOCK);
        err = pthread_create(&rt_thread, &attr, rt_thread_body, NULL);
diff --git a/testsuite/smokey/xddp/xddp.c b/testsuite/smokey/xddp/xddp.c
index 0d1202a..258411c 100644
--- a/testsuite/smokey/xddp/xddp.c
+++ b/testsuite/smokey/xddp/xddp.c
@@ -87,7 +87,7 @@ static void *realtime_thread1(void *arg)
                        fail("recvfrom");
                }
 
-               smokey_note("%s: %ld relayed by peer\n", __FUNCTION__, data);
+               smokey_note("%s: %ld relayed by peer", __FUNCTION__, data);
        }
 
        return NULL;
@@ -150,7 +150,7 @@ static void *realtime_thread2(void *arg)
        if (ret || addrlen != sizeof(saddr))
                fail("getpeername");
 
-       smokey_note("%s: NRT peer is reading from /dev/rtp%d\n",
+       smokey_note("%s: NRT peer is reading from /dev/rtp%d",
                  __FUNCTION__, saddr.sipc_port);
 
        FD_ZERO(&set);
@@ -173,7 +173,7 @@ static void *realtime_thread2(void *arg)
                if (ret != sizeof(data))
                        fail("sendto");
 
-               smokey_note("%s: sent %d bytes, %ld\n", __FUNCTION__, ret, 
data);
+               smokey_note("%s: sent %d bytes, %ld", __FUNCTION__, ret, data);
 
                ts.tv_sec = 0;
                ts.tv_nsec = 100000000; /* 100 ms */


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

Reply via email to