* \brief Semaphore test.
*
* \version $Id$
- *
+ *
* \author Daniele Basile <asterix@develer.com>
- * \author Stefano Fedrigo <aleph@develer.com>
- *
+ * \author Stefano Fedrigo <aleph@develer.com>
+ *
*/
#include <cfg/debug.h>
/*
* These macros generate the code needed to create the test process functions.
- */
+ */
#define PROC_TEST(num) static void proc_test##num(void) \
{ \
unsigned int local_count = 0; \
ticks_t start_time = timer_clock();
kprintf("Run semaphore test..\n");
-
+
//Init the process tests
PROC_TEST_INIT(1)
PROC_TEST_INIT(2)
PROC_TEST_INIT(7)
PROC_TEST_INIT(8)
kputs("> Main: Processes created\n");
-
+
/*
- * Wait until all processes exit, if something goes wrong we return an
+ * Wait until all processes exit, if something goes wrong we return an
* error after timeout_ms.
- */
+ */
while((timer_clock() - start_time) < ms_to_ticks(TEST_TIME_OUT_MS))
{
if (sem_attempt(&sem))
}
proc_yield();
}
-
+
kputs("Semaphore Test fail..\n");
return -1;
}
kprintf("Init Semaphore..");
sem_init(&sem);
kprintf("Done.\n");
-
+
#if CONFIG_KERN_PREEMPT
kprintf("Init Interrupt (preempt mode)..");
irq_init();
kprintf("Init Timer..");
timer_init();
kprintf("Done.\n");
-
+
kprintf("Init Process..");
proc_init();
kprintf("Done.\n");
-
+
return 0;
}
return 0;
}
-TEST_MAIN(sem);
\ No newline at end of file
+TEST_MAIN(sem);
* -->
*
* \brief Signals test.
- *
+ *
* \version $Id$
- *
+ *
* \author Daniele Basile <asterix@develer.com>
*/
SIG_TIMEOUT,
SIG_SYSTEM5,
SIG_SYSTEM6,
- SIG_SINGLE
+ SIG_SINGLE
};
// Current signal to send
/*
* These macros generate the code needed to create the test process functions.
- */
+ */
#define PROC_TEST_SLAVE(index, signal) static void proc_test##index(void) \
{ \
for(;;) \
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;
}
kprintf("Init Timer..");
timer_init();
kprintf("Done.\n");
-
+
kprintf("Init Process..");
proc_init();
kprintf("Done.\n");
return 0;
}
-TEST_MAIN(signal);
\ No newline at end of file
+TEST_MAIN(signal);