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/missing
tests/config/ocrcache tests/config/ocrcache
tests/config/xapiandb tests/config/xapiandb
tests/config/recoll.conf
tests/indexedmimetypes/aspdict.en.rws tests/indexedmimetypes/aspdict.en.rws
tests/indexedmimetypes/idxstatus.txt tests/indexedmimetypes/idxstatus.txt
tests/indexedmimetypes/index.pid 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 # is not trivial. We do not use recollq here because any change in the
# indexing process is going to change the order of results. # 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 grep FreqFor > $mystdout 2> $mystderr
diff -w ${myname}.txt $mystdout > $mydiffs 2>&1 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 loglevel = 6
logfilename = /tmp/logrcltst logfilename = /tmp/logrcltst
idxlogfilename = /tmp/idxlogrcltst idxlogfilename = /tmp/idxlogrcltst
@ -10,7 +15,7 @@ systemfilecommand = xdg-mime query filetype
indexStripChars = 1 indexStripChars = 1
detectxattronly = 1 detectxattronly = 1
topdirs = /home/dockes/projets/fulltext/testrecoll topdirs = @RECOLL_TESTDATA@
#thrQSizes = -1 -1 -1 #thrQSizes = -1 -1 -1
@ -27,48 +32,48 @@ noContentSuffixes- = .md5
# Comics_12 causes rclppt to loop. We keep it around for general testing # Comics_12 causes rclppt to loop. We keep it around for general testing
# but it takes too much time when running the test-set # but it takes too much time when running the test-set
skippedPaths = \ skippedPaths = \
/home/dockes/projets/fulltext/testrecoll/.hg \ @RECOLL_TESTDATA@/.hg \
/home/dockes/projets/fulltext/testrecoll/skipped/real* \ @RECOLL_TESTDATA@/skipped/real* \
/home/dockes/projets/fulltext/testrecoll/config \ @RECOLL_TESTDATA@/config \
/home/dockes/projets/fulltext/testrecoll/ppt/Comics_12.pps @RECOLL_TESTDATA@/ppt/Comics_12.pps
daemSkippedPaths = \ daemSkippedPaths = \
/home/dockes/projets/fulltext/testrecoll/.hg \ @RECOLL_TESTDATA@/.hg \
/home/dockes/projets/fulltext/testrecoll/skipped/real* \ @RECOLL_TESTDATA@/skipped/real* \
/home/dockes/projets/fulltext/testrecoll/config @RECOLL_TESTDATA@/config
unac_except_trans = åå Åå ää Ää öö Öö üü Üü ßss œoe Œoe æae ÆAE fifi flfl unac_except_trans = åå Åå ää Ää öö Öö üü Üü ßss œoe Œoe æae ÆAE fifi flfl
pdfextrameta = pdf:Producer dc:identifier 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 ocrprogs = tesseract
pdfocr = 1 pdfocr = 1
pdfocrlang = eng pdfocrlang = eng
[/home/dockes/projets/fulltext/testrecoll/utf8] [@RECOLL_TESTDATA@/utf8]
defaultcharset = utf-8 defaultcharset = utf-8
[/home/dockes/projets/fulltext/testrecoll/ru_RU.KOI8-R] [@RECOLL_TESTDATA@/ru_RU.KOI8-R]
defaultcharset = KOI8-R defaultcharset = KOI8-R
[/home/dockes/projets/fulltext/testrecoll/info] [@RECOLL_TESTDATA@/info]
localfields = rclaptg=gnuinfo localfields = rclaptg=gnuinfo
[/home/dockes/projets/fulltext/testrecoll/mail/thunderbird] [@RECOLL_TESTDATA@/mail/thunderbird]
mhmboxquirks = tbird mhmboxquirks = tbird
[/home/dockes/projets/fulltext/testrecoll/cjk] [@RECOLL_TESTDATA@/cjk]
localfields= ; keyword = ckjtsthuniique; blabla= "some string" localfields= ; keyword = ckjtsthuniique; blabla= "some string"
[/home/dockes/projets/fulltext/testrecoll/idxtypes] [@RECOLL_TESTDATA@/idxtypes]
indexedmimetypes = text/plain indexedmimetypes = text/plain
[/home/dockes/projets/fulltext/testrecoll/excltypes] [@RECOLL_TESTDATA@/excltypes]
excludedmimetypes = text/plain excludedmimetypes = text/plain
[/home/dockes/projets/fulltext/testrecoll/excludehtml] [@RECOLL_TESTDATA@/excludehtml]
indexedmimetypes = application/pdf indexedmimetypes = application/pdf
[/home/dockes/projets/fulltext/testrecoll/onlynames] [@RECOLL_TESTDATA@/onlynames]
onlyNames = *.matchesonepat *.matchestwopat onlyNames = *.matchesonepat *.matchestwopat

View File

@ -1,15 +1,33 @@
#!/bin/sh #!/bin/sh
if test ! -f shared.sh ; then fatal()
echo must be run in the top test directory {
exit 1 echo $*;exit 1
fi }
. 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 cd $RECOLL_CONFDIR
rerootResults sed -i.bak \
fi -e "s!/.*/testrecoll/!$RECOLL_TESTDATA/!g" \
recoll.conf
sed -i.bak \
-e "s!/.*/testrecoll/!$RECOLL_TESTDATA/!g" \
mimemap
cd $savedcd
}
iscmd() iscmd()
{ {
@ -40,13 +58,6 @@ checkcmds()
return $result 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() { makeindex() {
echo "Zeroing Index" echo "Zeroing Index"
rm -rf $RECOLL_CONFDIR/xapiandb $RECOLL_CONFDIR/aspdict.*.rws rm -rf $RECOLL_CONFDIR/xapiandb $RECOLL_CONFDIR/aspdict.*.rws
@ -55,26 +66,54 @@ makeindex() {
recollindex -c $RECOLL_CONFDIR -z recollindex -c $RECOLL_CONFDIR -z
} }
if test x$noindex = x ; then if test ! -f shared.sh ; then
makeindex 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 fi
# Yes, we could/should use the $toptmp from shared.sh here, but what if # Make sure this is computed in the same way as in shared.sh
# this is unset ?
toptmp=${TMPDIR:-/tmp}/recolltsttmp toptmp=${TMPDIR:-/tmp}/recolltsttmp
test X"$toptmp" = X && fatal "empty toptmp??"
test X"$toptmp" = X/ && fatal "toptmp == / ??"
if test -d "$toptmp" ; then if test -d "$toptmp" ; then
rm -rf $toptmp/* rm -rf $toptmp/*
else else
mkdir $toptmp || fatal cant create temp dir $toptmp mkdir $toptmp || fatal cant create temp dir $toptmp
fi 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` dirs=`ls -F | grep / | grep -v CVS | grep -v non-auto | grep -v config`
echo echo
echo "Running query tests:" echo "Running query tests:"
for dir in $dirs ; do for dir in $dirs ; do
cd $dir && $ECHON "$dir " cd $dir && echo -n "$dir "
sh `basename $dir`.sh sh `basename $dir`.sh
cd .. cd ..
done done

View File

@ -5,8 +5,9 @@ topdir=`dirname $0`/..
initvariables $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 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 # @(#$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 # 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 # 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:-.} topdir=${topdir:-.}
RECOLL_CONFDIR=$topdir/config/ export RECOLL_CONFDIR=$topdir/config/
export RECOLL_CONFDIR
ECHON="/bin/echo -n" ECHON="/bin/echo -n"
@ -22,30 +22,6 @@ initvariables() {
mydiffs=$toptmp/${myname}.diffs 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 () { fatal () {
set -f set -f
echo echo