-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathstart.sh
executable file
·63 lines (58 loc) · 1.44 KB
/
start.sh
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
#!/bin/sh
__CURRENT__=`pwd`
__DIR__=$(cd "$(dirname "$0")";pwd)
clear_php()
{
ps -A | grep \.php$ | grep -v phpstorm | grep -v php-fpm | awk '{print $1}' | xargs kill -9 > /dev/null 2>&1
}
## before tests
clear_php
if [ `ulimit -n` -le 16384 ]; then
ulimit -n 16384 > /dev/null 2>&1
fi
# run tests
if [ -z "${TEST_PHP_EXECUTABLE}" ]; then
export TEST_PHP_EXECUTABLE=`which php`
fi
if [ -z "${1}" ]; then
glob="swoole_*"
else
if [ "${1}x" = "basex" ]; then
glob="\
swoole_atomic \
swoole_event \
swoole_function \
swoole_global \
swoole_process \
swoole_process_pool \
swoole_table \
swoole_coroutine* \
swoole_channel_coro \
swoole_client_coro \
swoole_http_client_coro \
swoole_http2_client_coro \
swoole_server \
swoole_http_server \
swoole_websocket_server \
swoole_redis_server \
swoole_socket_coro \
swoole_runtime"
if [ ${#} -gt 1 ]; then
args="${@}"
args="${args#* }"
glob="${args} ${glob}"
fi
else
glob="$@"
if [ $(expr substr "$glob" 1 6) = "tests/" ]; then
# 去掉 tests/ 前缀
glob="${glob#tests/}"
fi
fi
fi
if [ $? -eq 0 ]; then
PHPT=1 ${TEST_PHP_EXECUTABLE} -d "memory_limit=1024m" ${__DIR__}/run-tests ${glob}
fi
# after tests
clear_php
rm -f /tmp/swoole.log > /dev/null 2>&1