Commit ce7a86ac authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Add build_unit_test.sh and generate_dist_headers.sh to build-aux.

	* build-aux/build_unit_test.sh,
	* build-aux/generate_dist_headers.sh: copy scripts from milena/ and
	milena/tests/unit_test.

	* build-aux/Makefile.am: add the previous scripts to EXTRA_DIST.

	* bootstrap,
	* Makefile.am: update the use of these scripts.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@4168 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 0c2492db
2009-06-19 Guillaume Lazzara <lazzara@lrde.epita.fr>
Add build_unit_test.sh and generate_dist_headers.sh to build-aux.
* build-aux/build_unit_test.sh,
* build-aux/generate_dist_headers.sh: copy scripts from milena/ and
milena/tests/unit_test.
* build-aux/Makefile.am: add the previous scripts to EXTRA_DIST.
* bootstrap,
* Makefile.am: update the use of these scripts.
2009-06-18 Roland Levillain <roland@lrde.epita.fr>
* m4/with-swilena.m4 (_OLN_WITH_SWIG): Require Python 2.5.
......
......@@ -97,6 +97,10 @@ dist-hook:
$(top_srcdir)/build-aux/strip-lrde $$f; \
done; \
rm -rf $(LRDE_NODIST_FILES) && \
$(top_srcdir)/build-aux/build_unit_test.sh \
$(distdir)/milena/mln \
$(distdir)/milena/tests/unit_test \
$(top_srcdir)/milena/tests/unit_test/disabled_tests && \
( \
cd $(distdir); \
set -evx; \
......
......@@ -129,20 +129,20 @@ require $libtoolize 1.5.22
set -x
# Generate milena/headers.mk
run milena ./generate_dist_headers.sh
run milena `pwd`/build-aux/generate_dist_headers.sh mln ./headers.mk ./nodist-headers
# Generate scribo/headers.mk
run scribo ./generate_dist_headers.sh
run . `pwd`/build-aux/generate_dist_headers.sh scribo scribo/headers.mk scribo/nodist-headers
# Generate lists of files to be part of the distribution
# for the tutorial.
run milena/doc ./generate_dist_files.sh
# Generate unit test files.
run milena/tests/unit_test ./build_unit_test.sh `pwd`/milena/mln
run . ./build-aux/build_unit_test.sh `pwd`/milena/mln milena/tests/unit_test milena/tests/unit_test/disabled_tests
# Generate unit test files for Scribo.
run scribo/tests/unit_test ./build_unit_test.sh `pwd`/scribo
run scribo/tests/unit_test ./build_unit_test.sh `pwd`/scribo .
# Install the GNU Build System.
autoreconf -f -v -i
......@@ -16,3 +16,4 @@
#
## Process this file through Automake to produce Makefile.in.
EXTRA_DIST = generate_dist_headers.sh build_unit_test.sh
#! /bin/sh
# Copyright (C) 2007, 2009 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: Don't use `echo -n', as echo's options are not portable.
##
## http://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Builtins.html#Limitations-of-Builtins
##
## As an ugly workaround, use `printf' instead. The right approach
## would be to only emit lines ended with newlines.
ECHO_N=printf
# Use the C locale to have a deterministic sort.
export LC_ALL=C
test $# -eq 3 || { echo "Usage: $0 <scanned dir> <output_dir> <disabled_tests>" && exit 1; }
scanned_dir=$1
output_dir=$2
disabled_tests=$3
## FIXME: We do not include these directories
##
## mln/io/dicom
## mln/io/fits
## mln/io/magick
## mln/io/tiff
##
## because they contain files depending on optional (external)
## libraries. We should test them conditionally.
HEADERS=$(find $scanned_dir -type f -name "*.hh" \
| sort \
| sed -e 's/.*\/mln\/\(.*\)/mln\/\1/g' | sed 's/\.\.\/\.\.\///g' \
| comm -23 - "$disabled_tests")
output="$output_dir/unit-tests.mk"
rm -f "$output"
rm -f mln_*.cc
# Build unit-tests.mk.
echo "## Generated by $0, do not modify." >"$output"
echo >>"$output"
$ECHO_N "check_PROGRAMS = " >>"$output"
for i in $HEADERS; do
FILE_CC=`echo $i | sed 's/[/.]/_/g' | sed 's/_hh/\.cc/g'`
# Build .cc.
cat > $output_dir/$FILE_CC << EOF
// Unit test for $i.
// Generated by $0, do not modify.
// Include the file twice, so we detect missing inclusion guards.
#include <$i>
#include <$i>
int main()
{
// Nothing.
}
EOF
# Build unit-tests.mk.
TARGET=`echo "${FILE_CC}" | sed 's/\.cc//'`
echo " \\" >>"$output"
$ECHO_N "${TARGET}" >>"$output"
done
# Build "$output".
echo "" >>"$output"
echo "" >>"$output"
for i in $HEADERS; do
FILE_CC=`echo $i | sed 's/[/.]/_/g' | sed 's/_hh/\.cc/g'`
NAME=`echo $FILE_CC | sed 's/\.cc//g'`
echo "${NAME}_SOURCES = $FILE_CC" >>"$output"
done
#! /bin/sh
# Generate a list of distributed files w.r.t. a list of file which must
# be excluded.
# --------------------
# List all the headers in order to make them part of distribution.
# Use the C locale to have a deterministic sort.
export LC_ALL=C
if [ $# -ne 3 ]; then
echo "$0 <scanned_dir> <output> <nodist-headers>"
exit 1
fi
me=`basename $0`
scanned_dir=$1
output=$2
nodist_headers=$3
test -f "$nodist_headers" \
|| { echo "$me: Cannot find \`$nodist_headers' in `pwd`."; exit 1; }
echo "Generating $output..." >&2
rm -f "$output"
cat <<EOF >"$output"
## Generated by \`$me', do not edit by hand.
nobase_include_HEADERS = \\
EOF
find $scanned_dir -type f -a \( -name '*.hh' -o -name '*.hxx' \) \
| sort \
| comm -23 - "$nodist_headers" \
| sed -e 's/$/ \\/g' >> $output
last_line=`tail -n 1 $output | sed -e 's/\\\//g'` # remove '\' in last line
sed '$d' < $output > $output.tmp # remove last line
mv $output.tmp $output
echo $last_line >> $output # put the cleaned last line back.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment