File: check.sh

package info (click to toggle)
glimpse 4.18.7-12
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,832 kB
  • sloc: ansic: 37,606; makefile: 847; sh: 242; perl: 142
file content (71 lines) | stat: -rw-r--r-- 1,968 bytes parent folder | download | duplicates (5)
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
70
71
#!/bin/sh

#----------------------------------------------
# Check target suite
#----------------------------------------------
ERROR_LOG="../make_check.errors"

echo "Start check suite"
cd test
rm -f $ERROR_LOG

#----------------------------------------------
# Make simple index database for test.txt file
#----------------------------------------------
echo ""
echo "run test 1 [1 of 2]"
echo -en "index test... "
GLIMPSEINDEX_OUTPUT=`../bin/glimpseindex -b -H . test.txt`
GLIMPSEINDEX_EXIT_CODE="$?"

if [ "$GLIMPSEINDEX_EXIT_CODE" -ne "0" ]; then
  echo "Error occured when running command: ../bin/glimpseindex -b -H . test.txt" >>"$ERROR_LOG"
  echo "Exit code: ${GLIMPSEINDEX_EXIT_CODE}" >>"$ERROR_LOG"
  echo "Eror output: ${GLIMPSEINDEX_OUTPUT}" >>"$ERROR_LOG"
  echo "" >>"$ERROR_LOG"
fi

#----------------------------------------------
# Analyse indexing results
#----------------------------------------------
GREP_INDEX=`grep "glimpse" .glimpse_index`
if [ -f ".glimpse_index" -a -n "$GREP_INDEX" ]; then
	echo "ok"
else
	echo "fail"
fi

#----------------------------------------------
# Perform boolean search using generated db
#----------------------------------------------
echo ""
echo "run test 2 [2 of 2]"
echo -en "search test... "
GLIMPSE_OUTPUT=`../bin/glimpse -c -h -i -y -H . 'test;suite'`
GLIMPSE_EXIT_CODE="$?"

if [ "$GLIMPSE_EXIT_CODE" -ne "0" ]; then
  echo "Error occured when running command: ../bin/glimpse -c -h -i -y -H . 'test;suite'" >>"$ERROR_LOG"
  echo "Exit code: ${GLIMPSE_EXIT_CODE}" >>"$ERROR_LOG"
  echo "Eror output: ${GLIMPSE_OUTPUT}" >>"$ERROR_LOG"
  echo "" >>"$ERROR_LOG"
fi

#----------------------------------------------
# Analyse search results
#----------------------------------------------
if [ "$GLIMPSE_OUTPUT" = "1" ]; then
	echo "ok"
else
	echo "fail"
fi


#----------------------------------------------
# Clean up
#----------------------------------------------
rm -f .glimpse_*

cd ..
echo ""
echo "Done"