
* tests/unit_test/build_unit_test.sh: Simplify argument checking. (ECHO_N): New. Set to printf. Use it instead of `echo -n'. Remove only `mln_*.cc' files. Aesthetic changes. --- milena/ChangeLog | 9 ++++++++ milena/tests/unit_test/build_unit_test.sh | 32 +++++++++++++++++++---------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index f1da513..ca2b90b 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,14 @@ 2009-02-03 Roland Levillain <roland@lrde.epita.fr> + Improve build_unit_test.sh's portability. + + * tests/unit_test/build_unit_test.sh: Simplify argument checking. + (ECHO_N): New. Set to printf. Use it instead of `echo -n'. + Remove only `mln_*.cc' files. + Aesthetic changes. + +2009-02-03 Roland Levillain <roland@lrde.epita.fr> + Catch up with names in configure.ac. * mln/version.hh.in: Add guards. diff --git a/milena/tests/unit_test/build_unit_test.sh b/milena/tests/unit_test/build_unit_test.sh index d08a0a6..f19d1ed 100755 --- a/milena/tests/unit_test/build_unit_test.sh +++ b/milena/tests/unit_test/build_unit_test.sh @@ -1,25 +1,35 @@ -#!/bin/sh +#! /bin/sh -if [ $# -ne 1 ]; then - echo "Usage: $0 <mln_path>" -fi +## 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... +## +## As an ugly workaround, use `printf' instead. The right approach +## would be to only emit lines ended with newlines. +ECHO_N=printf + +test $# -eq 1 || { echo "Usage: $0 <mln path>" && exit 1; } + +## 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 "mln/core/concept/doc" | sed -e 's/.*\/mln\/\(.*\)/mln\/\1/g' | sed 's/\.\.\/\.\.\///g'` rm -f Makefile.am -rm -f *.hh *.cc +rm -f mln_*.cc -#build Makefile.am +# Build Makefile.am. +## FIXME: How about using a here-doc instead of `echo'? echo "## Process this file through Automake to create Makefile.in -*- Makefile -*-" >> Makefile.am echo "" >> Makefile.am echo "include \$(top_srcdir)/milena/tests/tests.mk" >> Makefile.am echo "" >> Makefile.am -echo -n "check_PROGRAMS = " >> Makefile.am +$ECHO_N "check_PROGRAMS = " >> Makefile.am for i in $HEADERS; do FILE_CC=`echo $i | sed 's/[/.]/_/g' | sed 's/_hh/\.cc/g'` -#Build .cc + # Build .cc. cat > $FILE_CC << EOF // Unit test for $i. // Generated by $0, do not modify. @@ -34,13 +44,13 @@ int main() } EOF -#build Makefile.am + # Build Makefile.am. TARGET=`echo "${FILE_CC}" | sed 's/\.cc//'` echo " \\" >> Makefile.am - echo -n "${TARGET}" >> Makefile.am + $ECHO_N "${TARGET}" >> Makefile.am done -#build Makefile.am +# Build Makefile.am. echo "" >> Makefile.am echo "" >> Makefile.am for i in $HEADERS; do -- 1.6.1.2