[riot-notifications] [RIOT-OS/RIOT] tests: add tests to reproduce #10881 (#10908)

Kaspar Schleiser notifications at github.com
Wed Feb 13 13:00:59 CET 2019


kaspar030 commented on this pull request.



> +     * used to not call `sched_run()` which was the cause of the bug tested
+     * here */
+    _sched_next();
+    pid = thread_create(_stack, sizeof(_stack), THREAD_PRIORITY_MAIN + 1,
+                        THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST,
+                        _thread, NULL, "nr2");
+    assert(pid != KERNEL_PID_UNDEF);
+
+    while (1) {
+        msg_t msg = { .type = CANARY_TYPE };
+
+        /* receive blocked */
+        msg_receive(&msg);
+        /* check msg_receive() returned without blocking (i.e. the sending
+         * thread did not get a chance to copy the message over) */
+        assert(msg.type != CANARY_TYPE);

We don't have conventions on using assert for tests, right? IMO, the thing that a test tests for shouldn't be tested by "assert()", as it is too easy to accidentally compile it out. It would also make it difficult to run the test but with production CFLAGS.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10908#pullrequestreview-203171078
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190213/40940d83/attachment.html>


More information about the notifications mailing list