Make nightly build test works.
[bertos.git] / bertos / kern / signal_test.c
index ddd26485e4092eeed0db271470a5cf7b71074643..f2a4acfc62d22fd098393fa98322b4cd24b97103 100644 (file)
  * -->
  *
  * \brief Signals test.
- * 
+ *
  * \version $Id$
- * 
+ *
  * \author Daniele Basile <asterix@develer.com>
+ *
+ * $test$: cp bertos/cfg/cfg_proc.h $cfgdir/
+ * $test$: echo  "#undef CONFIG_KERN" >> $cfgdir/cfg_proc.h
+ * $test$: echo "#define CONFIG_KERN 1" >> $cfgdir/cfg_proc.h
+ * $test$: cp bertos/cfg/cfg_signal.h $cfgdir/
+ * $test$: echo  "#undef CONFIG_KERN_SIGNALS" >> $cfgdir/cfg_signal.h
+ * $test$: echo "#define CONFIG_KERN_SIGNALS 1" >> $cfgdir/cfg_signal.h
  */
 
-#include <cfg/cfg_timer.h>
+#include "cfg/cfg_timer.h"
 #include <cfg/debug.h>
 #include <cfg/test.h>
 
@@ -56,7 +63,7 @@ int test_signal[] = {
        SIG_TIMEOUT,
        SIG_SYSTEM5,
        SIG_SYSTEM6,
-       SIG_SINGLE      
+       SIG_SINGLE
 };
 
 // Current signal to send
@@ -65,7 +72,11 @@ int count = 0;
 sigmask_t sig_to_master;
 sigmask_t sig_to_slave;
 
-#define PROC_TEST_SLAVE(index, signal) static void proc_test##index(void) \
+/*
+ * These macros generate the code needed to create the test process functions.
+ */
+#define PROC_TEST_SLAVE(index, signal) \
+static void NORETURN proc_test##index(void) \
 { \
        for(;;) \
        { \
@@ -88,6 +99,7 @@ sigmask_t sig_to_slave;
 #define PROC_TEST_SLAVE_STACK(index) static cpu_stack_t proc_test##index##_stack[CONFIG_KERN_MINSTACKSIZE / sizeof(cpu_stack_t)];
 #define PROC_TEST_SLAVE_INIT(index, master_process) proc_new(proc_test##index, master_process, sizeof(proc_test##index##_stack), proc_test##index##_stack)
 
+// Generate the code for signal test.
 PROC_TEST_SLAVE(0, SIG_USER0)
 PROC_TEST_SLAVE(1, SIG_USER1)
 PROC_TEST_SLAVE(2, SIG_USER2)
@@ -139,13 +151,13 @@ int signal_testRun(void)
        MAIN_CHECK_SIGNAL(5, slave_5);
        MAIN_CHECK_SIGNAL(6, slave_6);
        MAIN_CHECK_SIGNAL(7, slave_7);
-       
+
        if(count == countof(test_signal))
        {
                kprintf("Signal test finished..ok!\n");
                return 0;
        }
-       
+
        kprintf("Signal test finished..fail!\n");
        return -1;
 }
@@ -163,7 +175,7 @@ int signal_testSetup(void)
        kprintf("Init Timer..");
        timer_init();
        kprintf("Done.\n");
-       
+
        kprintf("Init Process..");
        proc_init();
        kprintf("Done.\n");
@@ -176,4 +188,4 @@ int signal_testTearDown(void)
        return 0;
 }
 
-TEST_MAIN(signal);
\ No newline at end of file
+TEST_MAIN(signal);