File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ # 1) start server:
4+ # without caching:
5+ # REDIS_HOST=None CHEATSH_PORT=50000 python bin/srv.py
6+ # (recommended)
7+ # with caching:
8+ # REDIS_PREFIX=TEST1 CHEATSH_PORT=50000 python bin/srv.py
9+ # (for complex search queries + to test caching)
10+ # 2) configure CHTSH_URL
11+ # 3) run the script
12+
313TMP=$( mktemp /tmp/cht.sh.tests-XXXXXXXXXXXXXX)
414TMP2=$( mktemp /tmp/cht.sh.tests-XXXXXXXXXXXXXX)
515TMP3=$( mktemp /tmp/cht.sh.tests-XXXXXXXXXXXXXX)
616trap ' rm -rf $TMP $TMP2 $TMP3' EXIT
717
818export CHTSH_URL=http://cht.sh:50000
9- CHTSH_SCRIPT=$( dirname $( dirname $( readlink -f " $0 " ) ) ) /share/cht.sh.txt
19+ CHTSH_SCRIPT=$( dirname " $( dirname " $( readlink -f " $0 " ) " ) " ) /share/cht.sh.txt
1020
1121i=0
1222failed=0
1323{
1424 if [ -z " $1 " ]; then
1525 cat -n tests.txt
1626 else
17- cat -n tests.txt | sed -n " $( echo $* | sed ' s/ /p; /g;s/$/p/' ) "
27+ cat -n tests.txt | sed -n " $( echo " $* " | sed ' s/ /p; /g;s/$/p/' ) "
1828 fi
1929} > " $TMP3 "
2030while read -r number test_line; do
@@ -25,14 +35,13 @@ while read -r number test_line; do
2535 else
2636 eval " curl -s $CHTSH_URL /$test_line " > " $TMP "
2737 fi
28- diff results/" $number " " $TMP " > " $TMP2 "
29- if [ " $? " != 0 ]; then
38+ if ! diff results/" $number " " $TMP " > " $TMP2 " ; then
3039 echo " FAILED: [$number ] $test_line "
3140 (( failed++ ))
3241 fi
3342 (( i++ ))
3443done < " $TMP3 "
3544
36- echo TESTS/OK/FAILED " $i /$[ i-failed] /$failed "
45+ echo TESTS/OK/FAILED " $i /$(( i- failed)) /$failed "
3746
3847
You can’t perform that action at this time.
0 commit comments