last-svn-commit-134-gafefd84 Update Scribo's unit tests generator.

* tests/unit_test/build_unit_test.sh: Catch up with Milena's version of this script. * tests/unit_test/Makefile.am (regen-am, $(srcdir)/unit-tests.mk): Adjust. * tests/unit_test/disabled_tests: New. --- scribo/ChangeLog | 10 +++++++ scribo/tests/unit_test/Makefile.am | 18 ++++++++---- scribo/tests/unit_test/build_unit_test.sh | 42 ++++++++++++++++++++-------- scribo/tests/unit_test/disabled_tests | 2 + 4 files changed, 54 insertions(+), 18 deletions(-) create mode 100644 scribo/tests/unit_test/disabled_tests diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 2375a50..af5c670 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,3 +1,13 @@ +2010-04-21 Roland Levillain <roland@lrde.epita.fr> + + Update Scribo's unit tests generator. + + * tests/unit_test/build_unit_test.sh: Catch up with Milena's + version of this script. + * tests/unit_test/Makefile.am (regen-am, $(srcdir)/unit-tests.mk): + Adjust. + * tests/unit_test/disabled_tests: New. + 2010-04-09 Roland Levillain <roland@lrde.epita.fr> Help g++ 4.1 compile Scribo. diff --git a/scribo/tests/unit_test/Makefile.am b/scribo/tests/unit_test/Makefile.am index 7202de6..16d58b8 100644 --- a/scribo/tests/unit_test/Makefile.am +++ b/scribo/tests/unit_test/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE). +# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE). # # This file is part of Olena. # @@ -22,8 +22,11 @@ include $(top_srcdir)/scribo/tests/tests.mk # Regen files. include $(top_srcdir)/build-aux/regen-recursive.mk regen-am: - cd $(srcdir) \ - && ./build_unit_test.sh $(abs_top_srcdir)/scribo . + cd $(top_srcdir) \ + && scribo/tests/unit_test/build_unit_test.sh \ + scribo \ + scribo/tests/unit_test \ + scribo/tests/unit_test/disabled_tests # FIXME: Change build_unit_test.sh so that the action looks like this: # @@ -31,9 +34,12 @@ regen-am: # # `$(abs_top_srcdir)' is required because of the change of directory # at the beginning og the action. -$(srcdir)/unit-tests.mk: $(srcdir)/build_unit_test.sh - cd $(srcdir) \ - && ./build_unit_test.sh $(abs_top_srcdir)/scribo . +$(srcdir)/unit-tests.mk: build_unit_test.sh disabled_tests + cd $(top_srcdir) \ + && scribo/tests/unit_test/build_unit_test.sh \ + scribo \ + scribo/tests/unit_test \ + scribo/tests/unit_test/disabled_tests include $(srcdir)/unit-tests.mk diff --git a/scribo/tests/unit_test/build_unit_test.sh b/scribo/tests/unit_test/build_unit_test.sh index d4af384..415ff95 100755 --- a/scribo/tests/unit_test/build_unit_test.sh +++ b/scribo/tests/unit_test/build_unit_test.sh @@ -1,5 +1,24 @@ #! /bin/sh +# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory +# (LRDE) +# +# This file is part of Olena. +# +# Olena 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, version 2 of the License. +# +# Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. + +## FIXME: Unify with build-aux/build_unit_test.sh. + ## FIXME: Don't use `echo -n', as echo's options are not portable. ## ## http://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Builtin... @@ -11,19 +30,18 @@ ECHO_N=printf # Use the C locale to have a deterministic sort. export LC_ALL=C -test $# -eq 2 || { echo "Usage: $0 <scribo path> <output path>" && exit 1; } +test $# -eq 3 || { echo "Usage: $0 <scanned dir> <output_dir> <disabled_tests>" && exit 1; } + +scanned_dir=$1 +output_dir=$2 +disabled_tests=$3 -## FIXME: Ouch! Using `find' properly can probably save us some pipes, -## forks and characters here. -HEADERS=`find $1 -name "*.hh" \ - | grep -vE "*.spe.hh" \ - | grep -v "recognition" \ - | grep -v "demo" \ - | sort \ - | sed -e 's/.*\/scribo\/\(.*\)/scribo\/\1/g' \ - | sed 's/\.\.\/\.\.\///g'` +HEADERS=$(find $scanned_dir -type f -name "*.hh" \ + | sort \ + | sed -e 's/.*\/scribo\/\(.*\)/scribo\/\1/g' | sed 's/\.\.\/\.\.\///g' \ + | comm -23 - "$disabled_tests") -output=$2/unit-tests.mk +output="$output_dir/unit-tests.mk" rm -f "$output" rm -f scribo_*.cc @@ -37,7 +55,7 @@ for i in $HEADERS; do FILE_CC=`echo $i | sed 's/[/.]/_/g' | sed 's/_hh/\.cc/g'` # Build .cc. - cat > $FILE_CC << EOF + cat > "$output_dir/$FILE_CC" << EOF // Unit test for $i. // Generated by $0, do not modify. diff --git a/scribo/tests/unit_test/disabled_tests b/scribo/tests/unit_test/disabled_tests new file mode 100644 index 0000000..6e39306 --- /dev/null +++ b/scribo/tests/unit_test/disabled_tests @@ -0,0 +1,2 @@ +scribo/demo/src/mainwindow.hh +scribo/text/recognition.hh -- 1.5.6.5
participants (1)
-
Roland Levillain