Commit 0545aad9 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Setup conditional unit-tests in Scribo.

	* tests/tests.mk: Add specific flags for external dependencies.

	* tests/unit_test/Makefile.am
	(EXTRA_DIST): Add const_tests_* files.
	(regen-am): Use build-aux/build_unit_test.sh.
	(scribo_*FLAGS): Remove specific flags for conditional unit-tests.

	* tests/unit_test/build_unit_test.sh: Remove. Useless since
	build-aux/build_unit_test.sh is used instead.

	* tests/unit_test/cond_tests_qt,
	* tests/unit_test/cond_tests_qt_tesseract_tiff,
	* tests/unit_test/cond_tests_tesseract_tiff: New.

	* tests/unit_test/unit-tests.mk: Regen.
parent 324908fe
2010-08-10 Guillaume Lazzara <z@lrde.epita.fr>
Setup conditional unit-tests in Scribo.
* tests/tests.mk: Add specific flags for external dependencies.
* tests/unit_test/Makefile.am
(EXTRA_DIST): Add const_tests_* files.
(regen-am): Use build-aux/build_unit_test.sh.
(scribo_*FLAGS): Remove specific flags for conditional unit-tests.
* tests/unit_test/build_unit_test.sh: Remove. Useless since
build-aux/build_unit_test.sh is used instead.
* tests/unit_test/cond_tests_qt,
* tests/unit_test/cond_tests_qt_tesseract_tiff,
* tests/unit_test/cond_tests_tesseract_tiff: New.
* tests/unit_test/unit-tests.mk: Regen.
2010-08-09 Guillaume Lazzara <z@lrde.epita.fr> 2010-08-09 Guillaume Lazzara <z@lrde.epita.fr>
* tests/unit_test/disabled_tests: Update list of disabled tests. * tests/unit_test/disabled_tests: Update list of disabled tests.
......
...@@ -18,3 +18,17 @@ AM_CPPFLAGS = -I$(top_srcdir)/ -I$(top_builddir)/ -I$(top_srcdir)/milena -I$(top ...@@ -18,3 +18,17 @@ AM_CPPFLAGS = -I$(top_srcdir)/ -I$(top_builddir)/ -I$(top_srcdir)/milena -I$(top
SCRIBO_TESTS_CXXFLAGS = @SCRIBO_TESTS_CXXFLAGS@ SCRIBO_TESTS_CXXFLAGS = @SCRIBO_TESTS_CXXFLAGS@
AM_CXXFLAGS = $(SCRIBO_TESTS_CXXFLAGS) AM_CXXFLAGS = $(SCRIBO_TESTS_CXXFLAGS)
# Flags for optional dependencies.
MAGICKXX_CPPFLAGS = @MAGICKXX_CPPFLAGS@
MAGICKXX_LDFLAGS = @MAGICKXX_LDFLAGS@
TIFF_CPPFLAGS = @TIFF_CPPFLAGS@
TIFF_LDFLAGS = @TIFF_LDFLAGS@
QT_CPPFLAGS = @QT_CPPFLAGS@
QT_LDFLAGS = @QT_LDFLAGS@ @QT_LIBS@
TESSERACT_CPPFLAGS = @TESSERACT_CPPFLAGS@
TESSERACT_LDFLAGS = @TESSERACT_LDFLAGS@
\ No newline at end of file
...@@ -16,16 +16,23 @@ ...@@ -16,16 +16,23 @@
include $(top_srcdir)/scribo/tests/tests.mk include $(top_srcdir)/scribo/tests/tests.mk
EXTRA_DIST = build_unit_test.sh disabled_tests COND_TESTS = cond_tests_qt \
cond_tests_qt_tesseract_tiff \
cond_tests_tesseract_tiff
EXTRA_DIST = disabled_tests \
$(COND_TESTS)
# Regen files. # Regen files.
include $(top_srcdir)/build-aux/regen-recursive.mk include $(top_srcdir)/build-aux/regen-recursive.mk
regen-am: regen-am:
cd $(top_srcdir) \ cd $(top_srcdir) \
&& scribo/tests/unit_test/build_unit_test.sh \ && ./build-aux/build_unit_test.sh \
scribo \ scribo \
scribo/tests/unit_test \ scribo/tests/unit_test \
scribo/tests/unit_test/disabled_tests scribo/tests/unit_test/disabled_tests \
scribo
# FIXME: Change build_unit_test.sh so that the action looks like this: # FIXME: Change build_unit_test.sh so that the action looks like this:
# #
...@@ -33,47 +40,17 @@ regen-am: ...@@ -33,47 +40,17 @@ regen-am:
# #
# `$(abs_top_srcdir)' is required because of the change of directory # `$(abs_top_srcdir)' is required because of the change of directory
# at the beginning og the action. # at the beginning og the action.
$(srcdir)/unit-tests.mk: build_unit_test.sh disabled_tests $(srcdir)/unit-tests.mk: build_unit_test.sh disabled_tests $(COND_TESTS)
cd $(top_srcdir) \ cd $(top_srcdir) \
&& scribo/tests/unit_test/build_unit_test.sh \ && ./build-aux/build_unit_test.sh \
scribo \ scribo \
scribo/tests/unit_test \ scribo/tests/unit_test \
scribo/tests/unit_test/disabled_tests scribo/tests/unit_test/disabled_tests \
scribo
include $(srcdir)/unit-tests.mk include $(srcdir)/unit-tests.mk
#FIXME: how to handle that automaticaly during the unit test list
#generation?
scribo_convert_from_qimage_CPPFLAGS=\
$(QT_CPPFLAGS) $(AM_CPPFLAGS) -I$(srcdir)
scribo_convert_from_qimage_CXXFLAGS=\
$(QT_CXXFLAGS) $(AM_CXXFLAGS)
scribo_convert_from_qimage_LDFLAGS=\
$(QT_LDFLAGS) $(LDFLAGS)
scribo_convert_from_qimage_LDADD=\
$(QT_LIBS) $(LDADD)
scribo_toolchain_nepomuk_text_extraction_CPPFLAGS=\
$(QT_CPPFLAGS) $(TESSERACT_CPPFLAGS) $(TIFF_CPPFLAGS) \
$(AM_CPPFLAGS) -I$(srcdir)
scribo_toolchain_nepomuk_text_extraction_CXXFLAGS=\
$(QT_CXXFLAGS) $(AM_CXXFLAGS)
scribo_toolchain_nepomuk_text_extraction_LDFLAGS=\
$(QT_LDFLAGS) $(TESSERACT_LDFLAGS) $(TIFF_LDFLAGS) \
$(LDFLAGS)
scribo_toolchain_nepomuk_text_extraction_LDADD=\
$(QT_LIBS) $(LDADD)
scribo_text_recognition_CPPFLAGS=\
$(TESSERACT_CPPFLAGS) $(TIFF_CPPFLAGS) \
$(AM_CPPFLAGS) -I$(srcdir)
scribo_text_recognition_LDFLAGS=\
$(TESSERACT_LDFLAGS) $(TIFF_LDFLAGS) \
$(LDFLAGS)
MAINTAINERCLEANFILES = $(srcdir)/scribo_*.cc MAINTAINERCLEANFILES = $(srcdir)/scribo_*.cc
TESTS = $(check_PROGRAMS) TESTS = $(check_PROGRAMS)
#! /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-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
HEADERS=$(find $scanned_dir -type f -name "*.hh" \
| sort \
| sed -e 's/.*\/scribo\/\(.*\)/scribo\/\1/g' | sed 's/\.\.\/\.\.\///g' \
| comm -23 - "$disabled_tests")
output="$output_dir/unit-tests.mk"
rm -f "$output"
rm -f scribo_*.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
scribo/convert/from_qimage.hh
scribo/toolchain/nepomuk/text_extraction.hh
This diff is collapsed.
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