Annotation of parser3/tests/redis/run_tests.sh, revision 1.1
1.1 ! moko 1: #!/bin/sh
! 2: # the redis class: the pages are run by the console parser3 against a temporal redis-server
! 3:
! 4: PARSER=`pwd`/../../src/targets/cgi/parser3
! 5: DIR=`pwd`
! 6:
! 7: PORT=6399
! 8: TLS_PORT=6400
! 9:
! 10: # a ca with the server and a client certificate, and another ca with a client certificate
! 11: TLS=$DIR/tls
! 12: mkdir -p $TLS
! 13: for ca in ca other-ca; do
! 14: openssl req -x509 -newkey rsa:2048 -nodes -days 1 -subj /CN=$ca -keyout $TLS/$ca.key -out $TLS/$ca.crt 2>/dev/null
! 15: done
! 16: for cert in ca/server ca/client other-ca/other-client; do
! 17: ca=${cert%/*} name=${cert#*/}
! 18: openssl req -newkey rsa:2048 -nodes -subj /CN=localhost -keyout $TLS/$name.key -out $TLS/$name.csr 2>/dev/null
! 19: openssl x509 -req -days 1 -in $TLS/$name.csr -CA $TLS/$ca.crt -CAkey $TLS/$ca.key -CAcreateserial -out $TLS/$name.crt 2>/dev/null
! 20: done
! 21:
! 22: redis-server --port $PORT --unixsocket $DIR/redis.sock --unixsocketperm 700 --requirepass test \
! 23: --tls-port $TLS_PORT --tls-cert-file $TLS/server.crt --tls-key-file $TLS/server.key \
! 24: --tls-ca-cert-file $TLS/ca.crt --tls-auth-clients optional \
! 25: --save '' --appendonly no --dir $DIR --logfile $DIR/redis.log &
! 26: server=$!
! 27:
! 28: # wait for the server listens
! 29: for i in 1 2 3 4 5; do nc -z localhost $PORT 2>/dev/null && break; sleep 0.2; done
! 30:
! 31: {
! 32: for page in *.html; do
! 33: printf '\n=== %s\n' $page
! 34: REDIS_SOCKET=$DIR/redis.sock REDIS_TLS=$TLS $PARSER -f config.p $page
! 35: done
! 36: } >tests.log 2>&1
! 37:
! 38: kill $server; wait $server 2>/dev/null
! 39: rm -rf redis.log redis.sock $TLS
! 40: diff -u ok.log tests.log
E-mail: