Annotation of parser3/tests/httpd/code-cache/run_tests.sh, revision 1.1
1.1 ! moko 1: #!/bin/sh
! 2: # the code caching for httpd mode records and then replays the compilation using the cached methods (feature #1302)
! 3:
! 4: PARSER=`pwd`/../../../src/targets/cgi/parser3
! 5: PORT=8101
! 6:
! 7: class_file() { # file, class, method, text
! 8: printf '@CLASS\n%s\n\n@%s[]\n%s\n' "$2" "$3" "$4" > "$1"
! 9: }
! 10:
! 11: get() { # the response body of the test @name in site/tests.p
! 12: printf 'GET /?%s HTTP/1.0\r\n\r\n' "$1" | nc localhost $PORT | tr -d '\r' | sed '1,/^$/d'
! 13: echo
! 14: }
! 15:
! 16: run() { # httpd mode, code cache: on or off
! 17: echo "=== $1, code cache $2"
! 18: class_file site/changing.p Changing version before
! 19: no_cache=; [ $2 = off ] && no_cache=1
! 20:
! 21: (cd site && TEST_HTTPD_MODE=$1 TEST_NO_CODE_CACHE=$no_cache CGI_PARSER_CONFIG=`pwd`/config.p exec $PARSER -p $PORT) &
! 22: server=$!
! 23: # wait for the server listens
! 24: for i in 1 2 3 4 5; do nc -z localhost $PORT 2>/dev/null && break; sleep 0.2; done
! 25:
! 26: echo "fields are fresh in each request:"; get fresh; get fresh
! 27: echo "an error in the cached code:"; get failed
! 28: echo "^use of a cached file:"; get use_cached
! 29: echo "a cached partial class extended by the file named in ^process[...][$.file[...]] of the config:"; get extended
! 30: echo "a file compiled into a cached class takes its options:"; get options
! 31: echo "a cached class already defined:"; get defined
! 32: echo "a cached partial class extending one not marked as partial:"; get not_partial
! 33: echo "a cached class with the undefined base:"; get no_base
! 34: echo "a cached file changed after the start:"; get changing
! 35: class_file site/changing.p Changing version after; get changing
! 36: if [ $2 = on ]; then
! 37: chmod a-r site/cached.p
! 38: echo "a cached file unreadable after the start:"; get use_cached
! 39: chmod a+r site/cached.p
! 40: fi
! 41:
! 42: kill $server; wait $server 2>/dev/null
! 43: }
! 44:
! 45: {
! 46: run sequental on
! 47: run parallel on
! 48: run threaded on
! 49: run sequental off
! 50: } >tests.log 2>&1
! 51:
! 52: rm -f site/changing.p site/parser3.log
! 53: diff -u ok.log tests.log
E-mail: