1#!/bin/bash 2# 3# $1: path to minimal example binaries... 4# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1 5# that will be ./bin from your build dir 6# 7# $2: path for logs and results. The results will go 8# in a subdir named after the directory this script 9# is in 10# 11# $3: offset for test index count 12# 13# $4: total test count 14# 15# $5: path to ./minimal-examples dir in lws 16# 17# Test return code 0: OK, 254: timed out, other: error indication 18 19. $5/selftests-library.sh 20 21COUNT_TESTS=4 22 23FAILS=0 24 25# 26# let's make an index with just Dorian first 27# 28dotest $1 $2 apitest -c -i /tmp/lws-fts-dorian.index \ 29 "../minimal-examples/api-tests/api-test-fts/the-picture-of-dorian-gray.txt" 30 31# and let's hear about autocompletes for "b" 32 33dotest $1 $2 apitest -i /tmp/lws-fts-dorian.index b 34cat $2/api-test-fts/apitest.log | cut -d' ' -f5- > /tmp/fts1 35diff -urN /tmp/fts1 "../minimal-examples/api-tests/api-test-fts/canned-1.txt" 36if [ $? -ne 0 ] ; then 37 echo "Test 1 failed" 38 FAILS=$(( $FAILS + 1 )) 39fi 40 41# 42# let's make an index with Dorian + Les Mis in French (ie, UTF-8) as well 43# 44dotest $1 $2 apitest -c -i /tmp/lws-fts-both.index \ 45 "../minimal-examples/api-tests/api-test-fts/the-picture-of-dorian-gray.txt" \ 46 "../minimal-examples/api-tests/api-test-fts/les-mis-utf8.txt" 47 48# and let's hear about "help", which appears in both 49 50dotest $1 $2 apitest -i /tmp/lws-fts-both.index -f -l help 51cat $2/api-test-fts/apitest.log | cut -d' ' -f5- > /tmp/fts2 52diff -urN /tmp/fts2 "../minimal-examples/api-tests/api-test-fts/canned-2.txt" 53if [ $? -ne 0 ] ; then 54 echo "Test 1 failed" 55 FAILS=$(( $FAILS + 1 )) 56fi 57 58exit $FAILS 59