From 695d2dfa32c5b1ac92c13238323b5041ff567b58 Mon Sep 17 00:00:00 2001 From: batt Date: Tue, 1 Sep 2009 10:37:56 +0000 Subject: [PATCH] Test all configuration options. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2838 38d2e660-2303-0410-9eaa-f027e97ec537 --- test/enablecfg.py | 65 ++++++++++++++++++++++++++++++++++++++++++++ test/nightly_test.sh | 6 +++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100755 test/enablecfg.py diff --git a/test/enablecfg.py b/test/enablecfg.py new file mode 100755 index 00000000..22f11dde --- /dev/null +++ b/test/enablecfg.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +# 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/) +# +# Author David Mugnai + +# This file scan a module configuration file (cfg_module.h) +# and tries to enable all configuration options. +# This is useful in nightly test to test all possible configurations. + +# A whitelist of options that should not be enabled is supplied. + +import sys +import re + +# Options that should be left disabled +whitelist = [ + 'CONFIG_BATTFS_SHUFFLE_FREE_PAGES', + 'CONFIG_FAT_FS_READONLY', + 'CONFIG_INTERNAL_COMMANDS', + 'CONFIG_KERN_IRQ', + 'CONFIG_KERN_HEAP', + 'CONFIG_KERN_PREEMPT', + 'RAMP_USE_FLOATING_POINT', +] + +pattern = r'\s*#define\s+(\w+)\s+(0)\W?' + +def f(match): + if match.group(1) in whitelist: + return match.group(0) + else: + data = match.group(0) + sx = match.start(2) - match.start(0) + ex = match.end(2) - match.end(0) + return data[:sx] + '1' + data[ex:] + +data = file(sys.argv[1]).read() +data, count = re.subn(pattern, f, data) +if count: + file(sys.argv[1], 'w').write(data) diff --git a/test/nightly_test.sh b/test/nightly_test.sh index d7916d12..7cfedcb5 100755 --- a/test/nightly_test.sh +++ b/test/nightly_test.sh @@ -54,6 +54,11 @@ printf "Starting nightlytest..\n" #Strip away TODOs and FIXME find $BERTOS_DIR -name "*.[ch]" | xargs perl -p -i -e 's/^\s*#warning\s*(TODO|FIXME).*//g;' + CFG_LIST=`find $BERTOS_DIR/cfg -name "cfg_*.h"` + for i in $CFG_LIST ; + do + $TEST_DIR/enablecfg.py $i + done fi #Cpu targets that we want to test @@ -68,7 +73,6 @@ done make -f ${MAKEFILE_TEST_DIR}/Makefile.test clean make -f ${MAKEFILE_TEST_DIR}/Makefile.test - if [ $OPTS = 1 ] ; then #Restore original sources if [ -d $BERTOS_DIR_BAK ] ; then -- 2.25.1