This repository has been archived by the owner on Dec 28, 2022. It is now read-only.
/
run-tests
executable file
·103 lines (87 loc) · 4.35 KB
/
run-tests
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
MODULE_ROOT="$1"
NGX_OBJS="$2"
NGINX="$NGX_OBJS/nginx"
PIDFILE="/tmp/nginx-js.pid"
TIME=$(date +%s)
PADDING="$MODULE_ROOT/padding.txt"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/"
if [ "$WITH_MASTER" == "yes" ]; then
NGINX_OPTS=""
else
NGINX_OPTS="daemon off; master_process off;"
fi
function kill_process {
if [ -f $PIDFILE ]; then
PID=$(cat $PIDFILE)
kill -QUIT $PID
sleep 1
if [ -f $PIDFILE ]; then
kill -KILL $PID
fi
fi
}
mkdir -p $MODULE_ROOT/logs
cat $PADDING >> $MODULE_ROOT/logs/error.log
kill_process
# gdb --args
$NGINX -p $MODULE_ROOT -c nginx.conf -g "$NGINX_OPTS" &
sleep 1
OPTS="-m 5 --connect-timeout 1" # --http1.0
curl $OPTS "http://127.0.0.1:19090/run/nginx-object?prefix=$MODULE_ROOT&pid=$(cat $PIDFILE)"
curl $OPTS "http://127.0.0.1:19090/run/request-object?nginx=yes&uri=/run/request-object&method=GET&internal=false"
curl $OPTS "http://127.0.0.1:19090/rewrite/run/request-object?nginx=yes&uri=/run/request-object&method=GET&internal=true"
curl $OPTS --data "@${MODULE_ROOT}request-body-file.txt" "http://127.0.0.1:19090/run/request-body-discard"
curl $OPTS --data "some text body, ля-ля-ля" "http://127.0.0.1:19090/run/request-body?body=some+text+body,+ля-ля-ля"
curl $OPTS --http1.0 --data "@${MODULE_ROOT}request-body-file.txt" "http://127.0.0.1:19090/run/request-body-file?body=some+text+body,+ля-ля-ля"
curl $OPTS http://127.0.0.1:19090/run/file
if [ "$WITH_MASTER" == "yes" ]; then
curl $OPTS "http://127.0.0.1:19090/run/process-cycle?fname=process-cycle-worker-exited-$TIME.txt"
fi
curl $OPTS --cookie "foo1=bar1; foo2=bar2" "http://127.0.0.1:19090/run/request-cookies?count=2&name1=foo1&value1=bar1&name2=foo2&value2=bar2"
BIG_STRING="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # 100
curl $OPTS --cookie "foo1=$BIG_STRING" "http://127.0.0.1:19090/run/request-cookies?count=1&name1=foo1&value1=$BIG_STRING"
curl $OPTS -H "Foo1: bar1" -H "Foo2: bar2" 'http://127.0.0.1:19090/run/request-headers-in?\{"Foo1":"bar1","Foo2":"bar2"\}'
curl $OPTS -H "Cookie: foo1=bar1; foo2=bar2" 'http://127.0.0.1:19090/run/request-headers-in?\{"Cookie":"foo1=bar1;+foo2=bar2"\}'
curl $OPTS -H "Big: $BIG_STRING" "http://127.0.0.1:19090/run/request-headers-in?\{\"Big\":\"$BIG_STRING\"\}"
curl $OPTS -A "Tester/1.0" "http://127.0.0.1:19090/run/request-headers-in?\{\"Host\":\"127.0.0.1:19090\",\"User-Agent\":\"Tester/1.0\"\}"
curl $OPTS --data "12345" "http://127.0.0.1:19090/run/request-headers-in?\{\"Content-Length\":5,\"Content-Type\":\"application/x-www-form-urlencoded\"\}"
curl $OPTS -r 3-55 "http://127.0.0.1:19090/run/request-headers-in?\{\"Range\":\"bytes=3-55\"\}"
curl $OPTS "http://127.0.0.1:19090/run/request-headers-in-set-get"
curl $OPTS "http://127.0.0.1:19090/run/request-headers-out-set-get"
curl $OPTS "http://127.0.0.1:19090/variable-set" # will be rewritten to th /run/variable-set
curl $OPTS "http://127.0.0.1:19090/run/request-variables"
curl $OPTS "http://127.0.0.1:19090/run/standart-classes"
curl $OPTS "http://127.0.0.1:19090/run/subrequests"
curl $OPTS "http://127.0.0.1:19090/run/subrequest-headers-out"
curl $OPTS "http://127.0.0.1:19090/run/subrequest-headers-in"
curl $OPTS "http://127.0.0.1:19090/run/request-sendfile"
curl $OPTS "http://127.0.0.1:19090/run/request-redirect"
# curl $OPTS "http://127.0.0.1:19090/demo/request-headers-out"
# curl $OPTS "http://127.0.0.1:19090/demo/delayed-output"
# curl $OPTS "http://127.0.0.1:19090/demo/delayed-output-2"
# curl $OPTS "http://127.0.0.1:19090/demo/return-an-error"
# curl $OPTS "http://127.0.0.1:19090/demo/return-error-500"
# curl $OPTS "http://127.0.0.1:19090/demo/random"
# curl $OPTS "http://127.0.0.1:19090/demo/msie6"
# curl $OPTS -I "http://127.0.0.1:19090/demo/handler"
# curl $OPTS "http://127.0.0.1:19090/demo/handler"
# curl $OPTS "http://127.0.0.1:19090/demo/subrequest-long"
# ab -kc 20 -n 200 http://127.0.0.1:19090/run/file
MASTER_PID=$(cat $PIDFILE)
kill_process
if [ "$WITH_MASTER" == "yes" ]; then
if [ -f "$MODULE_ROOT/process-cycle-worker-exited-$TIME.txt" ]; then
echo "exitWorker() worked"
rm "$MODULE_ROOT/process-cycle-worker-exited-$TIME.txt"
else
echo "exitWorker() failed"
fi
if [ -f "$MODULE_ROOT/process-cycle-master-exited-$MASTER_PID.txt" ]; then
echo "exitMaster() worked"
rm "$MODULE_ROOT/process-cycle-master-exited-$MASTER_PID.txt"
else
echo "exitMaster() failed"
fi
fi
echo