From: batt Date: Fri, 17 Apr 2009 14:00:57 +0000 (+0000) Subject: Make nightly build test works. X-Git-Tag: 2.1.0~141 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=e423e63cade618baf616a79b99aaab5de74ec76e;p=bertos.git Make nightly build test works. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2541 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/arm/hw/switch_arm.S b/bertos/cpu/arm/hw/switch_arm.S index 38ceff8e..0e7d6972 100644 --- a/bertos/cpu/arm/hw/switch_arm.S +++ b/bertos/cpu/arm/hw/switch_arm.S @@ -1,2 +1,6 @@ -#warning This file is deprecated, use switch_ctx_arm.S -#include "switch_ctx_arm.S" +#include + +#if !(ARCH & ARCH_NIGHTTEST) + #warning This file is deprecated, use switch_ctx_arm.S + #include "switch_ctx_arm.S" +#endif diff --git a/bertos/cpu/avr/hw/switch_avr.S b/bertos/cpu/avr/hw/switch_avr.S index e6d0edfa..8de975fc 100644 --- a/bertos/cpu/avr/hw/switch_avr.S +++ b/bertos/cpu/avr/hw/switch_avr.S @@ -1,2 +1,6 @@ -#warning This file is deprecated, use switch_ctx_avr.S -#include "switch_ctx_avr.S" +#include + +#if !(ARCH & ARCH_NIGHTTEST) + #warning This file is deprecated, use switch_ctx_avr.S + #include "switch_ctx_avr.S" +#endif diff --git a/bertos/drv/dataflash.h b/bertos/drv/dataflash.h index 4b4e994d..dd805ad2 100644 --- a/bertos/drv/dataflash.h +++ b/bertos/drv/dataflash.h @@ -197,7 +197,9 @@ bool dataflash_diskInit(struct BattFsSuper *d, DataFlash *fd, pgcnt_t *page_arra * * (see drv/datafalsh_test.c for more detail) */ -int dataflash_testSetUp(void); +int dataflash_testSetup(void); +/* For backward compatibility */ +#define dataflash_testSetUp() dataflash_testSetup() int dataflash_testRun(void); int dataflash_testTearDown(void); diff --git a/bertos/drv/dataflash_hwtest.c b/bertos/drv/dataflash_hwtest.c index 8c462150..3edf8111 100644 --- a/bertos/drv/dataflash_hwtest.c +++ b/bertos/drv/dataflash_hwtest.c @@ -108,9 +108,9 @@ static uint8_t save_buf[DATAFLASH_TEST_STR_LEN]; * Setup all needed to test dataflash memory * */ -int dataflash_testSetUp(void) +int dataflash_testSetup(void) { - kfile_testSetUp(); + kfile_testSetup(); LOG_INFO("KFILE setup..ok\n"); LOG_INFO("Check if kernel is enable (if enable you should see the assert message.)\n"); @@ -173,7 +173,7 @@ int dataflash_testRun(void) LOG_INFO("Run KFILE test.\n"); SILENT_ASSERT("bertos/drv/dataflash.c:405: Assertion failed: fd->fd.seek_pos + size <= fd->fd.size"); - if (kfile_testRun(&dflash_fd.fd, test_buf, save_buf, sizeof(test_buf)) != EOF) + if (kfile_testRunGeneric(&dflash_fd.fd, test_buf, save_buf, sizeof(test_buf)) != EOF) { LOG_INFO("KFILE test..ok\n"); } @@ -212,7 +212,7 @@ int main(void) proc_init(); #endif - if (!dataflash_testSetUp()) + if (!dataflash_testSetup()) { LOG_INFO("DATAFLASH setup..ok\n"); } diff --git a/bertos/drv/flash25_hwtest.c b/bertos/drv/flash25_hwtest.c index 814c1648..1297feea 100644 --- a/bertos/drv/flash25_hwtest.c +++ b/bertos/drv/flash25_hwtest.c @@ -75,7 +75,7 @@ bool flash25_test(KFile *channel) * Launche a kfile test interface. */ kprintf("Kfile test start..\n"); - if (!kfile_testRun(&fd.fd, test_buf, NULL, sizeof(test_buf))) + if (!kfile_testRunGeneric(&fd.fd, test_buf, NULL, sizeof(test_buf))) return false; return true; diff --git a/bertos/drv/mcp41.c b/bertos/drv/mcp41.c index 02cff086..bfa8fd4e 100644 --- a/bertos/drv/mcp41.c +++ b/bertos/drv/mcp41.c @@ -57,7 +57,6 @@ void mcp41_setResistance(Mcp41Dev dev, mcp41_res_t res) kfile_putc(MCP41_WRITE_DATA, ch); kfile_putc(((MCP41_HW_MAX * (uint32_t)res) + (MCP41_MAX / 2)) / MCP41_MAX, ch); kfile_flush(ch); - ser_drain(spi_ser); MCP41_OFF(dev); } diff --git a/bertos/drv/phase.c b/bertos/drv/phase.c index d6c0c73e..3a400a36 100644 --- a/bertos/drv/phase.c +++ b/bertos/drv/phase.c @@ -50,9 +50,6 @@ #include -#warning TODO:Generalize this moduele for all target supported. - -#if 0 /** Array of triacs */ static Triac triacs[TRIAC_CNT]; @@ -183,7 +180,7 @@ void phase_init(void) triacs[dev].running = false; SET_TRIAC_DDR(dev); TRIAC_OFF(dev); - timer_set_event_softint(&triacs[dev].timer, (Hook)phase_softint, (void *)dev); + timer_setSoftint(&triacs[dev].timer, (Hook)phase_softint, (void *)dev); } IRQ_SAVE_DISABLE(flags); @@ -192,5 +189,4 @@ void phase_init(void) DB(phase_initialized = true;) IRQ_RESTORE(flags); } -#endif diff --git a/bertos/drv/phase.h b/bertos/drv/phase.h index cf40b9c5..52bc067d 100644 --- a/bertos/drv/phase.h +++ b/bertos/drv/phase.h @@ -31,7 +31,7 @@ * * \version $Id$ * - * \brief Phase control driver, to manage triac swicth. + * \brief Phase partialization driver with TRIACs. * * \version $Id$ * \author Francesco Sacchi diff --git a/bertos/drv/pwm.h b/bertos/drv/pwm.h index 7db37d38..87ec1b4d 100644 --- a/bertos/drv/pwm.h +++ b/bertos/drv/pwm.h @@ -84,8 +84,10 @@ void pwm_init(void); * * See pwm_test.c for implemntation of these functions. */ -int pwm_testRun(void); -int pwm_testSetUp(void); +void pwm_testRun(void); +int pwm_testSetup(void); +/* For backward compatibility */ +#define pwm_testSetUp() pwm_testSetup() int pwm_testTearDown(void); #endif /* DRV_PWM_H */ diff --git a/bertos/drv/pwm_hwtest.c b/bertos/drv/pwm_hwtest.c index f66fe660..12a941dd 100644 --- a/bertos/drv/pwm_hwtest.c +++ b/bertos/drv/pwm_hwtest.c @@ -118,7 +118,7 @@ static PwmTest pwm_test_cfg[PWM_CNT] = * Setup all needed to test PWM on AT91 * */ -int pwm_testSetUp(void) +int pwm_testSetup(void) { LOG_INFO("Init pwm.."); pwm_init(); @@ -132,12 +132,12 @@ int pwm_testSetUp(void) * Test suit for genation of pwm waveform. * */ -int pwm_testRun(void) +void NORETURN pwm_testRun(void) { pwm_duty_t duty = 0; int delay = 0; - pwm_testSetUp(); + pwm_testSetup(); LOG_INFO("\n\n===== BeRTOS PWM test =====\n\n"); @@ -203,8 +203,6 @@ int pwm_testRun(void) } delay++; } - - return 0; } /** @@ -226,14 +224,14 @@ int pwm_testTearDown(void) #if 0 int main(void) { - IRQ_ENABLE; + IRQ_ENABLE; kdbg_init(); pwm_testRun(); - for(;;) - { - } + for(;;) + { + } } #endif diff --git a/bertos/fs/battfs.c b/bertos/fs/battfs.c index 6fd6ec82..4f4d4892 100644 --- a/bertos/fs/battfs.c +++ b/bertos/fs/battfs.c @@ -32,7 +32,7 @@ * * \brief BattFS: a filesystem for embedded platforms (implementation). * - * \version $Id:$ + * \version $Id$ * * \author Francesco Sacchi * diff --git a/bertos/hw/hw_phase.h b/bertos/hw/hw_phase.h index 62228cee..170e3da9 100644 --- a/bertos/hw/hw_phase.h +++ b/bertos/hw/hw_phase.h @@ -46,6 +46,9 @@ #warning TODO:This is an example implementation, you must implement it! +#define TRIAC_MAX_DUTY 100 +#define TRIAC_MAX_POWER 100 + #define PHASE_HW_INIT do { /* Implement me! */ }while (0) INLINE void TRIAC_OFF(TriacDev i) @@ -65,5 +68,16 @@ INLINE void TRIAC_ON(TriacDev i) (void)i; } +INLINE void SET_TRIAC_DDR(TriacDev i) +{ + /* Implement me! */ + + //Only for test remove when implement this function + (void)i; +} + +void zerocross_isr(void); +#define DEFINE_ZEROCROSS_ISR() void zerocross_isr(void) + #endif /* HW_PHASE_H */ diff --git a/bertos/hw/hw_sipo.h b/bertos/hw/hw_sipo.h index 82dce488..ad02c57e 100644 --- a/bertos/hw/hw_sipo.h +++ b/bertos/hw/hw_sipo.h @@ -50,8 +50,8 @@ * Define the macros needed to set the serial input bit of SIPO device * low or high. */ -#define SIPO_SI_HIGH()/* Implement me! */ -#define SIPO_SI_LOW() /* Implement me! */ +#define SIPO_SI_HIGH() do { /* Implement me! */ } while (0) +#define SIPO_SI_LOW() do { /* Implement me! */ } while (0) /** * Drive pin to load the bit, presented in serial-in pin, diff --git a/bertos/kern/kfile.h b/bertos/kern/kfile.h index 5d3ebc67..9f1dd283 100644 --- a/bertos/kern/kfile.h +++ b/bertos/kern/kfile.h @@ -279,6 +279,7 @@ INLINE void kfile_clearerr(struct KFile *fd) * Kfile test function. */ int kfile_testSetup(void); +int kfile_testRun(void); int kfile_testRunGeneric(KFile *fd, uint8_t *test_buf, uint8_t *save_buf, size_t size); int kfile_testTearDown(void); diff --git a/bertos/kern/kfile_test.c b/bertos/kern/kfile_test.c index fc760cb5..52afa98a 100644 --- a/bertos/kern/kfile_test.c +++ b/bertos/kern/kfile_test.c @@ -96,7 +96,7 @@ static size_t fake_read(KFile *fd, void *buf, size_t size) static size_t fake_write(KFile *fd, const void *buf, size_t size) { - fake_t *src = (fake_t *)buf; + const fake_t *src = (const fake_t *)buf; size_t wr_len; wr_len = MIN((kfile_off_t)size, fd->size - fd->seek_pos); @@ -109,14 +109,14 @@ static size_t fake_write(KFile *fd, const void *buf, size_t size) return wr_len; } -int fake_flush(KFile *fd) +static int fake_flush(KFile *fd) { (void)fd; return 0; } -void fake_kfileInit(void) +static void fake_kfileInit(void) { // Setup data flash programming functions. fd.reopen = kfile_genericReopen; @@ -136,12 +136,11 @@ void fake_kfileInit(void) */ static void init_testBuf(void) { - #include kprintf("Init fake buffer..\n"); for (int i = 0; i < BUF_TEST_LEN; i++) { - test_disk[i] = random(); + test_disk[i] = i; kprintf("%d ", test_disk[i]); } kprintf("\nend\n"); diff --git a/bertos/kern/monitor.h b/bertos/kern/monitor.h index ec297b78..e2a4742a 100644 --- a/bertos/kern/monitor.h +++ b/bertos/kern/monitor.h @@ -48,8 +48,6 @@ #include -#if CONFIG_KERN_MONITOR - /** * Start the kernel monitor. It is a special process which checks every second the stacks of the * running processes trying to detect stack overflows. @@ -77,6 +75,4 @@ size_t monitor_checkStack(cpu_stack_t *stack_base, size_t stack_size); /** Print a report of the stack status through kdebug */ void monitor_report(void); - -#endif /* CONFIG_KERN_MONITOR */ #endif /* KERN_MONITOR_H */ diff --git a/bertos/kern/msg.h b/bertos/kern/msg.h index 05bbd7ef..acd99c59 100644 --- a/bertos/kern/msg.h +++ b/bertos/kern/msg.h @@ -283,4 +283,8 @@ INLINE void msg_reply(Msg *msg) msg_put(msg->replyPort, msg); } +int msg_testRun(void); +int msg_testSetup(void); +int msg_testTearDown(void); + #endif /* KERN_MSG_H */ diff --git a/bertos/kern/msg_test.c b/bertos/kern/msg_test.c index 638eeddd..2cc34eee 100644 --- a/bertos/kern/msg_test.c +++ b/bertos/kern/msg_test.c @@ -51,10 +51,21 @@ #include #include -#include +#include + +#include #include +/* + * In the nightly build test, signals are disables, so this + * code won't compile. + * Since this code is used when we run "make check" it will be + * compiled and therefor tested there. + */ +#if CONFIG_KERN_SIGNALS + + // Global settings for the test. #define MAX_GLOBAL_COUNT 11040 #define TEST_TIME_OUT_MS 10 @@ -83,21 +94,22 @@ /* * These macros generate the code needed to create the test process functions. */ -#define RECV_PROC(num, sig) static void receiver_proc##num(void) \ - { \ - TestMsg *rec_msg; \ - for (;;) \ - { \ - sig_wait(sig); \ - kprintf("Proc[%d]..get message\n", num); \ - rec_msg = containerof(msg_get(&test_port##num), TestMsg, msg); \ - timer_delay(rec_msg->delay); \ - rec_msg->result += rec_msg->val; \ - kprintf("Proc[%d]..process message val[%d],delay[%d],res[%d]\n", num, rec_msg->val, rec_msg->delay, rec_msg->result); \ - msg_reply(&rec_msg->msg); \ - kprintf("Proc[%d] reply\n", num); \ - } \ - } +#define RECV_PROC(num, sig) \ +static void receiver_proc##num(void) \ +{ \ + TestMsg *rec_msg; \ + for (;;) \ + { \ + sig_wait(sig); \ + kprintf("Proc[%d]..get message\n", num); \ + rec_msg = containerof(msg_get(&test_port##num), TestMsg, msg); \ + timer_delay(rec_msg->delay); \ + rec_msg->result += rec_msg->val; \ + kprintf("Proc[%d]..process message val[%d],delay[%d],res[%d]\n", num, rec_msg->val, rec_msg->delay, rec_msg->result); \ + msg_reply(&rec_msg->msg); \ + kprintf("Proc[%d] reply\n", num); \ + } \ +} #define SEND_MSG(num) \ do { \ @@ -108,7 +120,7 @@ #define RECV_STACK(num) static cpu_stack_t receiver_stack##num[CONFIG_KERN_MINSTACKSIZE / sizeof(cpu_stack_t)] #define RECV_INIT_PROC(num) proc_new(receiver_proc##num, NULL, sizeof(receiver_stack##num), receiver_stack##num) -#define RECV_INIT_MSG(num, proc,sig) msg_initPort(&test_port##num, event_createSignal(proc, sig)) +#define RECV_INIT_MSG(num, proc, sig) msg_initPort(&test_port##num, event_createSignal(proc, sig)) // A test message with the parameters and a result. typedef struct @@ -268,3 +280,5 @@ int msg_testTearDown(void) } TEST_MAIN(msg); + +#endif /* CONFIG_KERN_SIGNALS */ diff --git a/bertos/kern/sem.h b/bertos/kern/sem.h index 71c6273a..1e3ef205 100644 --- a/bertos/kern/sem.h +++ b/bertos/kern/sem.h @@ -71,4 +71,8 @@ void sem_obtain(struct Semaphore *s); void sem_release(struct Semaphore *s); /* \} */ +int sem_testRun(void); +int sem_testSetup(void); +int sem_testTearDown(void); + #endif /* KERN_SEM_H */ diff --git a/bertos/kern/signal.h b/bertos/kern/signal.h index de3dc5ec..1118af8a 100644 --- a/bertos/kern/signal.h +++ b/bertos/kern/signal.h @@ -56,6 +56,9 @@ void sig_signal(struct Process *proc, sigmask_t sig); sigmask_t sig_wait(sigmask_t sigs); sigmask_t sig_waitTimeout(sigmask_t sigs, ticks_t timeout); +int signal_testRun(void); +int signal_testSetup(void); +int signal_testTearDown(void); /** * \name Signal definitions diff --git a/bertos/kern/signal_test.c b/bertos/kern/signal_test.c index ed799bcf..f2a4acfc 100644 --- a/bertos/kern/signal_test.c +++ b/bertos/kern/signal_test.c @@ -75,7 +75,8 @@ sigmask_t sig_to_slave; /* * These macros generate the code needed to create the test process functions. */ -#define PROC_TEST_SLAVE(index, signal) static void proc_test##index(void) \ +#define PROC_TEST_SLAVE(index, signal) \ +static void NORETURN proc_test##index(void) \ { \ for(;;) \ { \ diff --git a/examples/test/armtest.mk b/examples/test/armtest.mk index 9d2bc1aa..5c778376 100644 --- a/examples/test/armtest.mk +++ b/examples/test/armtest.mk @@ -25,7 +25,7 @@ armtest_CPPASRC = $(arm_ASRC) armtest_PREFIX = arm-none-eabi- armtest_CPPAFLAGS = -O0 -g -gdwarf-2 -g -gen-debug -armtest_CPPFLAGS = -O0 -D'ARCH=ARCH_NIGHTTEST' -D__ARM_AT91SAM7S256__ -g3 -gdwarf-2 -fverbose-asm -Iexamples/test -Ibertos/cpu/arm +armtest_CPPFLAGS = -O0 -D'ARCH=ARCH_NIGHTTEST' -D__ARM_AT91SAM7S256__ -D'CPU_FREQ=(48023000UL)' -g3 -gdwarf-2 -fverbose-asm -Iexamples/test -Ibertos/cpu/arm armtest_LDFLAGS = -nostartfiles -T bertos/cpu/arm/scripts/at91sam7_256_rom.ld -Wl,--no-warn-mismatch armtest_CPU = arm7tdmi diff --git a/examples/test/avrtest.mk b/examples/test/avrtest.mk index c2d3adb3..5d7883d3 100644 --- a/examples/test/avrtest.mk +++ b/examples/test/avrtest.mk @@ -28,5 +28,5 @@ avrtest_CPPASRC = $(avr_ASRC) avrtest_PCSRC += bertos/mware/formatwr.c avrtest_PREFIX = avr- -avrtest_CPPFLAGS = -D'ARCH=ARCH_NIGHTTEST' -Iexamples/test -Ibertos/cpu/avr +avrtest_CPPFLAGS = -D'ARCH=ARCH_NIGHTTEST' -D'CPU_FREQ=(12288000UL)' -Iexamples/test -Ibertos/cpu/avr avrtest_CFLAGS = -Os -mcall-prologues -fno-strict-aliasing diff --git a/test/get_source_list.sh b/test/get_source_list.sh index 8e9bcd60..c9795979 100755 --- a/test/get_source_list.sh +++ b/test/get_source_list.sh @@ -38,6 +38,7 @@ CPU_DIR="${BERTOS_DIR}/cpu" #Directory to exclude OS_DIR="${BERTOS_DIR}/os" EMUL_DIR="${BERTOS_DIR}/emul" +WIZARD_DIR="./wizard" APP_DIR="./examples" if [ $# \< 2 ] ; then @@ -48,7 +49,7 @@ if [ $# \< 2 ] ; then fi CPU_TARGET=$1 #Create a list of source file without a cpu specific source -GEN_SRC=`find . \( -name \.svn -prune -o -path $COPY_DIR -prune -o -path $CPU_DIR -prune -o -path $APP_DIR -prune -o -path $OS_DIR -prune -o -path $EMUL_DIR -prune \) -o -name *.${2} -print | xargs` +GEN_SRC=`find . \( -name \.svn -prune -o -path $COPY_DIR -prune -o -path $CPU_DIR -prune -o -path $APP_DIR -prune -o -path $OS_DIR -prune -o -path $WIZARD_DIR -prune -o -path $EMUL_DIR -prune \) -o -name *.${2} -print | xargs` #Select c and asm sources for selected cpu target TRG_SRC=`find ${CPU_DIR}/$CPU_TARGET -name \.svn -prune -o -name *.${2} -print | xargs` diff --git a/test/nightly_test.sh b/test/nightly_test.sh index eadccd3c..d7916d12 100755 --- a/test/nightly_test.sh +++ b/test/nightly_test.sh @@ -39,7 +39,7 @@ OPTS=1 if [ $# = 1 ] ; then if [ $1 = "-h" ] ; then printf "Nightly test help.\n" - printf "\t--no-silent disable the silent of the TODO/FIXME warning message.\n" + printf "\t--no-silent disable the silent of the TODO/FIXME warning messages.\n" exit 1 elif [ $1 = "--no-silent" ] ; then OPTS=0 @@ -49,14 +49,14 @@ fi if [ $OPTS = 1 ] ; then #Copy BeRTOS sources printf "Starting nightlytest..\n" - printf "Silent mode enable, removing the TODO/FIXME message warning.\n" + printf "Silent mode enable, removing the TODO/FIXME message warnings.\n" cp -R $BERTOS_DIR $BERTOS_DIR_BAK || exit 1 #Strip away TODOs and FIXME find $BERTOS_DIR -name "*.[ch]" | xargs perl -p -i -e 's/^\s*#warning\s*(TODO|FIXME).*//g;' fi -#Cpu target that we want to test +#Cpu targets that we want to test TRG="avr arm" for i in $TRG ; diff --git a/wizard/srctemplates/main.c b/wizard/srctemplates/main.c index 288b7f25..0a2fa1ab 100644 --- a/wizard/srctemplates/main.c +++ b/wizard/srctemplates/main.c @@ -3,4 +3,5 @@ int main(void) { return 0; -} \ No newline at end of file +} +