Merge branch 'master' of github.com:unbit/uwsgi

This commit is contained in:
Roberto De Ioris
2012-11-16 19:58:05 +00:00
3 changed files with 160 additions and 3 deletions
+44 -2
View File
@@ -1,5 +1,47 @@
language: c
compiler:
- clang
- gcc
script: python uwsgiconfig.py --build
- clang
script:
- echo -e "\n\n>>> Building uWSGI binary"
- /usr/bin/python uwsgiconfig.py --build base
- echo -e "\n\n>>> Building python25 plugin"
- /usr/bin/python2.5 -V
- /usr/bin/python2.5 uwsgiconfig.py --plugin plugins/python base python25
- echo -e "\n\n>>> Building python26 plugin"
- /usr/bin/python2.6 -V
- /usr/bin/python2.6 uwsgiconfig.py --plugin plugins/python base python26
- echo -e "\n\n>>> Building python27 plugin"
- /usr/bin/python2.7 -V
- /usr/bin/python2.7 uwsgiconfig.py --plugin plugins/python base python27
- echo -e "\n\n>>> Building python31 plugin"
- /usr/bin/python3.1 -V
- /usr/bin/python3.1 uwsgiconfig.py --plugin plugins/python base python31
- echo -e "\n\n>>> Building python32 plugin"
- /usr/bin/python3.2 -V
- /usr/bin/python3.2 uwsgiconfig.py --plugin plugins/python base python32
- echo -e "\n\n>>> Building python33 plugin"
- /usr/bin/python3.3 -V
- /usr/bin/python3.3 uwsgiconfig.py --plugin plugins/python base python33
- echo -e "\n\n>>> Building rack 1.8.7 plugin"
- /usr/bin/ruby1.8 -v
- UWSGICONFIG_RUBYPATH=/usr/bin/ruby1.8 /usr/bin/python uwsgiconfig.py --plugin plugins/rack base rack187
- echo -e "\n\n>>> Building rack 1.9.1 plugin"
- /usr/bin/ruby1.9.1 -v
- UWSGICONFIG_RUBYPATH=/usr/bin/ruby1.9.1 /usr/bin/python uwsgiconfig.py --plugin plugins/rack base rack191
- echo -e "\n\n>>> Building cgi plugin"
- /usr/bin/python uwsgiconfig.py --plugin plugins/cgi base
- echo -e "\n\n>>> Building dummy plugin"
- /usr/bin/python uwsgiconfig.py --plugin plugins/dummy base
- echo -e "\n\n>>> Building done, starting tests"
- ./tests/travis.sh
before_install:
- sudo add-apt-repository -y ppa:fkrull/deadsnakes
- sudo apt-get update -qq
- sudo apt-get install -qqyf python2.5-dev python2.6-dev python2.7-dev python3.1-dev python3.2-dev python3.3-dev rubygems1.8 ruby1.8-dev ruby1.9.1-dev
- sudo apt-get install -qqyf libxml2-dev libpcre3-dev libcap2-dev
- sudo apt-get install -qqyf curl
+3 -1
View File
@@ -308,6 +308,8 @@ static const luaL_reg uwsgi_api[] = {
static int uwsgi_lua_input(lua_State *L) {
struct wsgi_request *wsgi_req = current_wsgi_req();
int fd = wsgi_req->async_post ?
fileno(wsgi_req->async_post) : wsgi_req->poll.fd;
ssize_t sum, len, total;
char *buf, *ptr;
@@ -330,7 +332,7 @@ static int uwsgi_lua_input(lua_State *L) {
ptr = buf;
while(total) {
len = read(wsgi_req->poll.fd, ptr, total);
len = read(fd, ptr, total);
ptr += len;
total -= len;
}
+113
View File
@@ -0,0 +1,113 @@
#!/bin/bash
txtund=$(tput sgr 0 1) # underline
txtbld=$(tput bold) # bold
bldred=${txtbld}$(tput setaf 1) # red
bldgre=${txtbld}$(tput setaf 2) # green
bldyel=${txtbld}$(tput setaf 3) # yellow
bldblu=${txtbld}$(tput setaf 4) # blue
txtcya=$(tput setaf 6) # cyan
bldwht=${txtbld}$(tput setaf 7) # white
txtrst=$(tput sgr0) # reset
ERROR=0
SUCCESS=0
die() {
date > reload.txt
sleep 3
pidof uwsgi && killall uwsgi
sleep 1
pidof uwsgi && killall -9 uwsgi
echo -e "$@"
if [ -e uwsgi.log ]; then
echo -e "${bldyel}>>> uwsgi.log:${txtrst}"
echo -e "${txtcya}"
cat uwsgi.log
echo -e "${txtrst}"
fi
}
http_test() {
URL=$1
UPID=`pidof uwsgi`
if [ "$UPID" != "" ]; then
echo -e "${bldgre}>>> Spawned PID $UPID, running tests${txtrst}"
sleep 5
curl -I $URL
RET=$?
if [ $RET != 0 ]; then
die "${bldred}>>> Error during curl run${txtrst}"
ERROR=$((ERROR+1))
else
SUCCESS=$((SUCCESS+1))
fi
die "${bldyel}>>> SUCCESS: Done${txtrst}"
else
die "${bldred}>>> ERROR: uWSGI did not start${txtrst}"
ERROR=$((ERROR+1))
fi
}
test_python() {
date > reload.txt
rm -f uwsgi.log
echo -e "${bldyel}================== TESTING $1 =====================${txtrst}"
echo -e "${bldyel}>>> Spawning uWSGI python app${txtrst}"
echo -en "${bldred}"
./uwsgi --master --plugin 0:$1 --http :8080 --exit-on-reload --touch-reload reload.txt --wsgi-file tests/staticfile.py --daemonize uwsgi.log
echo -en "${txtrst}"
http_test "http://localhost:8080/"
echo -e "${bldyel}===================== DONE $1 =====================${txtrst}\n\n"
}
test_rack() {
date > reload.txt
rm -f uwsgi.log
echo -e "${bldyel}================== TESTING $1 =====================${txtrst}"
case "$1" in
"rack187")
GEMS_BINARY="/usr/bin/gem1.8"
;;
"rack191")
GEMS_BINARY="/usr/bin/gem1.9.1"
;;
"rack193")
GEMS_BINARY="/usr/bin/gem1.9.3"
;;
esac
echo -e "${bldyel}>>> Installing sinatra gem using ${GEMS_BINARY}${txtrst}"
$GEMS_BINARY install sinatra || die
echo -e "${bldyel}>>> Spawning uWSGI rack app${txtrst}"
echo -en "${bldred}"
./uwsgi --master --plugin 0:$1 --http :8080 --exit-on-reload --touch-reload reload.txt --rack config2.ru --daemonize uwsgi.log
echo -en "${txtrst}"
http_test "http://localhost:8080/hi"
echo -e "${bldyel}===================== DONE $1 =====================${txtrst}\n\n"
}
while read PV ; do
test_python $PV
done < <(cat .travis.yml | grep "plugins/python base" | awk '{print $7}')
while read RV ; do
test_rack $RV
done < <(cat .travis.yml | grep "plugins/rack base" | awk '{print $8}')
echo "${bldgre}>>> $SUCCESS SUCCESSFUL PLUGIN(S)${txtrst}"
if [ $ERROR -ge 1 ]; then
echo "${bldred}>>> $ERROR FAILED PLUGIN(S)${txtrst}"
exit 1
fi
exit 0