-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.sh
executable file
·70 lines (51 loc) · 1.52 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh -e
export PATH=$PATH:$(pwd)
tmpf=$(mktemp -t $(basename $0).$$)
trap "rm -f $tmpf" EXIT
# just make sure it runs
fts --help
echo creating data
./rando.py
echo deleting old data
rm -f .fts.db
echo creating initial db
fts --logging=debug --init --ignore-re '^fts$' --ignore-glob '*~' --ignore-simple bigrando
search=$(cat $(ls rando/* | unsort | head -n 1) | unsort | head -n 1)
echo test search "($search)"
fts "$search"
echo test search --re "($search)"
fts --re "$search"
echo more data
./rando.py
echo test sync
fts --sync
echo more data
./rando.py
pushd rando > /dev/null
echo sync from in rando
fts --sync
search=$(cat $(ls | unsort | head -n 1) | unsort | head -n 1)
echo search from in rando "($search)"
fts -l "$search" | tee $tmpf
ignorefile=$(cat $tmpf | head -n 1)
echo ignoring $ignorefile for search $search
fts --ignore-simple $ignorefile
fts --sync
if fts "$search" | grep $(cat $tmpf | head -n 1); then
echo "Shouldn't have been able to find $ignorefile in $search"
exit 1
fi
somefile=$(ls|unsort|head -n 1)
here=$(pwd)
echo "thefile" >> $somefile
thefile="$here/$somefile"
pushd / > /dev/null
echo sync $thefile from /
if ! fts --logging=debug --sync-one "$thefile" 2>&1 | grep -- "$somefile"; then
# run again to get the error
fts --logging=debug --sync-one "$thefile"
echo "Unable to --sync-one $thefile from /"
exit 1
fi
popd > /dev/null
popd > /dev/null