From a41152d79cfa6286e6fb3255dc2d98f5c3562cb6 Mon Sep 17 00:00:00 2001 From: asterix Date: Fri, 30 May 2008 14:12:57 +0000 Subject: [PATCH] Add automatically test for bertos code. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1410 38d2e660-2303-0410-9eaa-f027e97ec537 --- Makefile.test | 10 ++++++ app/test/armtest.mk | 37 ++++++++++++++++++++ app/test/avrtest.mk | 39 +++++++++++++++++++++ app/test/empty_main.c | 47 +++++++++++++++++++++++++ test/gen_mk_src.sh | 77 +++++++++++++++++++++++++++++++++++++++++ test/get_source_list.sh | 60 ++++++++++++++++++++++++++++++++ test/nightly_test.sh | 47 +++++++++++++++++++++++++ 7 files changed, 317 insertions(+) create mode 100644 Makefile.test create mode 100644 app/test/armtest.mk create mode 100644 app/test/avrtest.mk create mode 100644 app/test/empty_main.c create mode 100755 test/gen_mk_src.sh create mode 100755 test/get_source_list.sh create mode 100755 test/nightly_test.sh diff --git a/Makefile.test b/Makefile.test new file mode 100644 index 00000000..4ddda36b --- /dev/null +++ b/Makefile.test @@ -0,0 +1,10 @@ +#Makefile for BeRTOS test. +#This makefile was generated automatically. + +V:= 0 +default: all + +include bertos/config.mk +include ./app/test/avrtest.mk +include ./app/test/armtest.mk +include bertos/rules.mk diff --git a/app/test/armtest.mk b/app/test/armtest.mk new file mode 100644 index 00000000..0e8dd93c --- /dev/null +++ b/app/test/armtest.mk @@ -0,0 +1,37 @@ +# +# $Id: armtest.mk 18234 2007-10-08 13:39:48Z rasky $ +# Copyright 2006 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# Makefile fragment for DevLib armtest application. +# +# Author: Bernardo Innocenti +# +# + +# Set to 1 for debug builds +armtest_DEBUG = 1 + +# Our target application +TRG += armtest + +#include arm c and asm sources +include ./app/test/arm_src.mk + +armtest_CSRC = $(arm_CSRC) app/test/empty_main.c + +armtest_CPPASRC = $(arm_ASRC) + +armtest_CROSS = arm-elf- + +armtest_CPPAFLAGS = -O0 -g -gdwarf-2 -g -gen-debug +armtest_CPPFLAGS = -O0 -D'ARCH=0xFFFFFF' -D__ARM_AT91SAM7S256__ -g3 -gdwarf-2 -fverbose-asm -Iapp/test -Iapp/test/hw -Ibertos/cpu/arm +armtest_LDFLAGS = #-nostartfiles -T bertos/cpu/arm/scripts/at91sam7_256_ram.ld -Wl,--no-warn-mismatch + +armtest_CPU = arm7tdmi + +# Debug stuff +ifeq ($(armtest_DEBUG),1) + armtest_CFLAGS += -D_DEBUG +endif + diff --git a/app/test/avrtest.mk b/app/test/avrtest.mk new file mode 100644 index 00000000..49129fbb --- /dev/null +++ b/app/test/avrtest.mk @@ -0,0 +1,39 @@ +# +# $Id: avrtest.mk,v 1.3 2006/06/12 21:37:02 marco Exp $ +# Copyright 2006 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# Makefile fragment for DevLib avrtest application. +# +# Author: Bernardo Innocenti +# + + + +# Set to 1 for debug builds +avrtest_DEBUG = 1 + +# Our target application +TRG += avrtest + +avrtest_MCU = atmega64 + +#include avr c and asm sources +include app/test/avr_src.mk + +avrtest_CSRC = $(avr_CSRC) app/test/empty_main.c + +avrtest_CPPASRC = $(avr_ASRC) + +avrtest_PCSRC += bertos/mware/formatwr.c + +avrtest_CROSS = avr- +avrtest_CPPFLAGS = -D'ARCH=1' -Iapp/test -Ibertos/cpu/avr -Ibertos/hw +avrtest_CFLAGS = -Os -mcall-prologues -fno-strict-aliasing + +# Debug stuff +ifeq ($(avrtest_DEBUG),1) + avrtest_CFLAGS += -D_DEBUG + avrtest_PCSRC += bertos/drv/kdebug.c +endif + diff --git a/app/test/empty_main.c b/app/test/empty_main.c new file mode 100644 index 00000000..66a8e4ad --- /dev/null +++ b/app/test/empty_main.c @@ -0,0 +1,47 @@ +/** + * \file + * + * + * \brief Hardware-specific definitions + * + * \version $Id$ + * + * \author Daniele Basile + */ + +int main(void) +{ + for(;;) + { + } + + return 0; +} diff --git a/test/gen_mk_src.sh b/test/gen_mk_src.sh new file mode 100755 index 00000000..2e0af804 --- /dev/null +++ b/test/gen_mk_src.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# This file is part of BeRTOS. +# +# Bertos is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# As a special exception, you may use this file as part of a free software +# library without restriction. Specifically, if other files instantiate +# templates or use macros or inline functions from this file, or you compile +# this file and link it with other files to produce an executable, this +# file does not by itself cause the resulting executable to be covered by +# the GNU General Public License. This exception does not however +# invalidate any other reasons why the executable file might be covered by +# the GNU General Public License. +# +# Copyright 2008 Develer S.r.l. (http://www.develer.com/) +# +# Nighlty test for BeRTOS. +# +# Author Daniele Basile + +#Bertos dir, write with escape char for sed regrepx +BERTOS_DIR_RE="\\.\\/bertos" + +#Test script dir, where are test script +TEST_SCRIPT_DIR="test" + +#Test directory, where are the test makefile +TEST_APP_DIR="app/test/" + +#Dir list for ARM, write with escape char for sed regrepx +ARM_DRV="${BERTOS_DIR_RE}\\/cpu\\/arm\\/drv" +ARM_DRV_C_EXCLUDE_LIST="ser_arm pwm_arm twi_arm stepper_arm" + +if [ $# \< 1 ] ; then + printf "You must specify a cpu target!\n\n" + printf "EXAMPLE:\n $0 \n\n" + + exit 1 +fi + +#Get list of source for selected cpu target +CSRC=`${TEST_SCRIPT_DIR}/get_source_list.sh $1 c` +#ASRC=`${TEST_SCRIPT_DIR}/get_source_list.sh $1 s` +ASRC= + + +#Source to skip: +if [ $1 = 'avr' ] ; then + CSRC=`echo $CSRC | sed "-e {s/${BERTOS_DIR_RE}\\/drv\\/kdebug\\.c//g}"` + CSRC=`echo $CSRC | sed "-e {s/${BERTOS_DIR_RE}\\/mware\\/formatwr\\.c//g}"` +fi + +if [ $1 = 'arm' ] ; then + for i in $ARM_DRV_C_EXCLUDE_LIST ; + do + CSRC=`echo $CSRC | sed "-e {s/${ARM_DRV}\\/$i\\.c//g}"` + done +fi + + + +printf "#This makefile was generate automatically.\n\n" > ${TEST_APP_DIR}/$1_src.mk +printf "${1}_CSRC = $CSRC\n\n" >> ${TEST_APP_DIR}/$1_src.mk +printf "${1}_ASRC = $ASRC\n\n" >> ${TEST_APP_DIR}/$1_src.mk + diff --git a/test/get_source_list.sh b/test/get_source_list.sh new file mode 100755 index 00000000..4755c439 --- /dev/null +++ b/test/get_source_list.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# This file is part of BeRTOS. +# +# Bertos is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# As a special exception, you may use this file as part of a free software +# library without restriction. Specifically, if other files instantiate +# templates or use macros or inline functions from this file, or you compile +# this file and link it with other files to produce an executable, this +# file does not by itself cause the resulting executable to be covered by +# the GNU General Public License. This exception does not however +# invalidate any other reasons why the executable file might be covered by +# the GNU General Public License. +# +# Copyright 2008 Develer S.r.l. (http://www.develer.com/) +# +# Nighlty test for BeRTOS. +# +# Author Daniele Basile + +#Directories +BERTOS_DIR="./bertos" +CPU_DIR="${BERTOS_DIR}/cpu" + +#Directory to exclude +OS_DIR="${BERTOS_DIR}/os" +EMUL_DIR="${BERTOS_DIR}/emul" +APP_DIR="./app" + +if [ $# \< 2 ] ; then + printf "You must specify a cpu target, and source file type!\n" + printf "EXAMPLE:\n $0 \n\n" + + exit 1 +fi + +#Create a list of source file whitout a cpu specific source +GEN_SRC=`find . \( -name '\.svn' -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` + +#Select c and asm sources for selected cpu target +TRG_SRC=`find ${CPU_DIR}/${1} -name "\.svn" -prune -o -name "*.${2}" -print | xargs` + +#Generate a list of all source for each cpu +SRC_ALL=${GEN_SRC}" "${TRG_SRC} + + +printf "${SRC_ALL}" + diff --git a/test/nightly_test.sh b/test/nightly_test.sh new file mode 100755 index 00000000..100b833a --- /dev/null +++ b/test/nightly_test.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# This file is part of BeRTOS. +# +# Bertos is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# As a special exception, you may use this file as part of a free software +# library without restriction. Specifically, if other files instantiate +# templates or use macros or inline functions from this file, or you compile +# this file and link it with other files to produce an executable, this +# file does not by itself cause the resulting executable to be covered by +# the GNU General Public License. This exception does not however +# invalidate any other reasons why the executable file might be covered by +# the GNU General Public License. +# +# Copyright 2008 Develer S.r.l. (http://www.develer.com/) +# +# Nighlty test for BeRTOS. +# +# Author Daniele Basile + +#Makefile test directory +MAKEFILE_TEST_DIR="." +TEST_DIR="test" + +#Cpu target that we want to test +TRG="avr arm" + +for i in $TRG ; +do + ${TEST_DIR}/gen_mk_src.sh $i +done + +#Clean and launch make on all +make -f ${MAKEFILE_TEST_DIR}/Makefile.test clean +make -f ${MAKEFILE_TEST_DIR}/Makefile.test -- 2.25.1