tests: create the index in the temp directory instead of src tree

This commit is contained in:
Jean-Francois Dockes 2020-08-20 09:15:05 +02:00
parent 061e06a711
commit 1d7868d93c
6 changed files with 96 additions and 74 deletions

1
.gitignore vendored
View File

@ -94,6 +94,7 @@ tests/config/index.pid
tests/config/missing
tests/config/ocrcache
tests/config/xapiandb
tests/config/recoll.conf
tests/indexedmimetypes/aspdict.en.rws
tests/indexedmimetypes/idxstatus.txt
tests/indexedmimetypes/index.pid

View File

@ -11,7 +11,7 @@ initvariables $0
# is not trivial. We do not use recollq here because any change in the
# indexing process is going to change the order of results.
xadump -d $RECOLL_CONFDIR/xapiandb -t maildir_uniquexxx -F | \
xadump -d $RECOLL_TESTCACHEDIR/xapiandb -t maildir_uniquexxx -F | \
grep FreqFor > $mystdout 2> $mystderr
diff -w ${myname}.txt $mystdout > $mydiffs 2>&1

View File

@ -1,3 +1,8 @@
# The actual recoll.conf is created from this by the top level runtest.sh
# not by the configure script
cachedir = @RECOLL_TESTCACHEDIR@
loglevel = 6
logfilename = /tmp/logrcltst
idxlogfilename = /tmp/idxlogrcltst
@ -10,7 +15,7 @@ systemfilecommand = xdg-mime query filetype
indexStripChars = 1
detectxattronly = 1
topdirs = /home/dockes/projets/fulltext/testrecoll
topdirs = @RECOLL_TESTDATA@
#thrQSizes = -1 -1 -1
@ -27,48 +32,48 @@ noContentSuffixes- = .md5
# Comics_12 causes rclppt to loop. We keep it around for general testing
# but it takes too much time when running the test-set
skippedPaths = \
/home/dockes/projets/fulltext/testrecoll/.hg \
/home/dockes/projets/fulltext/testrecoll/skipped/real* \
/home/dockes/projets/fulltext/testrecoll/config \
/home/dockes/projets/fulltext/testrecoll/ppt/Comics_12.pps
@RECOLL_TESTDATA@/.hg \
@RECOLL_TESTDATA@/skipped/real* \
@RECOLL_TESTDATA@/config \
@RECOLL_TESTDATA@/ppt/Comics_12.pps
daemSkippedPaths = \
/home/dockes/projets/fulltext/testrecoll/.hg \
/home/dockes/projets/fulltext/testrecoll/skipped/real* \
/home/dockes/projets/fulltext/testrecoll/config
@RECOLL_TESTDATA@/.hg \
@RECOLL_TESTDATA@/skipped/real* \
@RECOLL_TESTDATA@/config
unac_except_trans = åå Åå ää Ää öö Öö üü Üü ßss œoe Œoe æae ÆAE fifi flfl
pdfextrameta = pdf:Producer dc:identifier
pdfextrametafix = /home/dockes/projets/fulltext/recoll/tests/config/pdfemf.py
pdfextrametafix = @RECOLL_TESTS@/config/pdfemf.py
[/home/dockes/projets/fulltext/testrecoll/pdf]
[@RECOLL_TESTDATA@/pdf]
ocrprogs = tesseract
pdfocr = 1
pdfocrlang = eng
[/home/dockes/projets/fulltext/testrecoll/utf8]
[@RECOLL_TESTDATA@/utf8]
defaultcharset = utf-8
[/home/dockes/projets/fulltext/testrecoll/ru_RU.KOI8-R]
[@RECOLL_TESTDATA@/ru_RU.KOI8-R]
defaultcharset = KOI8-R
[/home/dockes/projets/fulltext/testrecoll/info]
[@RECOLL_TESTDATA@/info]
localfields = rclaptg=gnuinfo
[/home/dockes/projets/fulltext/testrecoll/mail/thunderbird]
[@RECOLL_TESTDATA@/mail/thunderbird]
mhmboxquirks = tbird
[/home/dockes/projets/fulltext/testrecoll/cjk]
[@RECOLL_TESTDATA@/cjk]
localfields= ; keyword = ckjtsthuniique; blabla= "some string"
[/home/dockes/projets/fulltext/testrecoll/idxtypes]
[@RECOLL_TESTDATA@/idxtypes]
indexedmimetypes = text/plain
[/home/dockes/projets/fulltext/testrecoll/excltypes]
[@RECOLL_TESTDATA@/excltypes]
excludedmimetypes = text/plain
[/home/dockes/projets/fulltext/testrecoll/excludehtml]
[@RECOLL_TESTDATA@/excludehtml]
indexedmimetypes = application/pdf
[/home/dockes/projets/fulltext/testrecoll/onlynames]
[@RECOLL_TESTDATA@/onlynames]
onlyNames = *.matchesonepat *.matchestwopat

View File

@ -1,15 +1,33 @@
#!/bin/sh
if test ! -f shared.sh ; then
echo must be run in the top test directory
exit 1
fi
fatal()
{
echo $*;exit 1
}
. shared.sh
rerootResults()
{
savedcd=`pwd`
dirs=`ls -F | grep / | grep -v CVS | grep -v non-auto | grep -v config`
for dir in $dirs ; do
cd $dir
resfile=`basename $dir`.txt
sed -i.bak \
-e "s!file:///.*/testrecoll/!file://$RECOLL_TESTDATA/!g" \
$resfile
cd ..
done
if test ! x$reroot = x ; then
rerootResults
fi
cd $RECOLL_CONFDIR
sed -i.bak \
-e "s!/.*/testrecoll/!$RECOLL_TESTDATA/!g" \
recoll.conf
sed -i.bak \
-e "s!/.*/testrecoll/!$RECOLL_TESTDATA/!g" \
mimemap
cd $savedcd
}
iscmd()
{
@ -40,13 +58,6 @@ checkcmds()
return $result
}
checkcmds recollq recollindex pxattr xadump || exit 1
# Unset DISPLAY because xdg-mime may be affected by the desktop
# environment on the X server
unset DISPLAY
export LC_ALL=en_US.UTF-8
makeindex() {
echo "Zeroing Index"
rm -rf $RECOLL_CONFDIR/xapiandb $RECOLL_CONFDIR/aspdict.*.rws
@ -55,26 +66,54 @@ makeindex() {
recollindex -c $RECOLL_CONFDIR -z
}
if test x$noindex = x ; then
makeindex
if test ! -f shared.sh ; then
fatal must be run in the top test directory
fi
checkcmds recollq recollindex pxattr xadump || exit 1
if test ! x$reroot = x ; then
rerootResults
fi
# Yes, we could/should use the $toptmp from shared.sh here, but what if
# this is unset ?
# Make sure this is computed in the same way as in shared.sh
toptmp=${TMPDIR:-/tmp}/recolltsttmp
test X"$toptmp" = X && fatal "empty toptmp??"
test X"$toptmp" = X/ && fatal "toptmp == / ??"
if test -d "$toptmp" ; then
rm -rf $toptmp/*
else
mkdir $toptmp || fatal cant create temp dir $toptmp
fi
# Unset DISPLAY because xdg-mime may be affected by the desktop
# environment on the X server
unset DISPLAY
export LC_ALL=en_US.UTF-8
RECOLL_TESTS=`pwd`
RECOLL_TESTDATA=${RECOLL_TESTDATA:-/home/dockes/projets/fulltext/testrecoll}
export RECOLL_CONFDIR=$RECOLL_TESTS/config/
# Some test need to access RECOLL_TESTCACHEDIR
export RECOLL_TESTCACHEDIR=$toptmp
sed -e "s,@RECOLL_TESTS@,$RECOLL_TESTS,g" \
-e "s,@RECOLL_TESTDATA@,$RECOLL_TESTDATA,g" \
-e "s,@RECOLL_TESTCACHEDIR@,$RECOLL_TESTCACHEDIR,g" \
< $RECOLL_CONFDIR/recoll.conf.in \
> $RECOLL_CONFDIR/recoll.conf || exit 1
if test x$noindex = x ; then
makeindex
fi
dirs=`ls -F | grep / | grep -v CVS | grep -v non-auto | grep -v config`
echo
echo "Running query tests:"
for dir in $dirs ; do
cd $dir && $ECHON "$dir "
cd $dir && echo -n "$dir "
sh `basename $dir`.sh
cd ..
done

View File

@ -5,8 +5,9 @@ topdir=`dirname $0`/..
initvariables $0
recollq Scribus_sla_uniqueterm OR Chaturbhuja 2> $mystderr |
egrep -v '^Recoll query: ' > $mystdout
(
recollq -S url Scribus_sla_uniqueterm OR Chaturbhuja
) 2> $mystderr | egrep -v '^Recoll query: ' > $mystdout
diff -w ${myname}.txt $mystdout > $mydiffs 2>&1

View File

@ -1,14 +1,14 @@
# @(#$Id: shared.sh,v 1.4 2009-01-06 18:47:33 dockes Exp $ (C) 2006 J.F.Dockes
# shared code and variables for all tests
RECOLL_TESTDATA=/home/dockes/projets/fulltext/testrecoll
RECOLL_TESTDATA=${RECOLL_TESTDATA:-/home/dockes/projets/fulltext/testrecoll}
# All source'rs should set topdir as a relative path from their location to
# this directory
# this directory. Computing RECOLL_CONFDIR this way allows to rerun an
# individual test from its directory.
topdir=${topdir:-.}
RECOLL_CONFDIR=$topdir/config/
export RECOLL_CONFDIR
export RECOLL_CONFDIR=$topdir/config/
ECHON="/bin/echo -n"
@ -22,35 +22,11 @@ initvariables() {
mydiffs=$toptmp/${myname}.diffs
}
rerootResults()
{
savedcd=`pwd`
dirs=`ls -F | grep / | grep -v CVS | grep -v non-auto | grep -v config`
for dir in $dirs ; do
cd $dir
resfile=`basename $dir`.txt
sed -i.bak \
-e "s!file:///.*/testrecoll/!file://$RECOLL_TESTDATA/!g" \
$resfile
cd ..
done
cd $RECOLL_CONFDIR
sed -i.bak \
-e "s!/.*/testrecoll/!$RECOLL_TESTDATA/!g" \
recoll.conf
sed -i.bak \
-e "s!/.*/testrecoll/!$RECOLL_TESTDATA/!g" \
mimemap
cd $savedcd
}
fatal () {
set -f
echo
echo $*
exit 1
set -f
echo
echo $*
exit 1
}
checkresult() {