travis: Use docker to test 32bit environment (#189)

* travis: testing matrix.include feature to use docker
* Add test script for 32bit
* Fix OverflowError in 32bit Environment
This commit is contained in:
INADA Naoki 2016-05-05 02:07:46 +09:00
parent fc2933853a
commit 63e23d37f9
3 changed files with 43 additions and 13 deletions

View file

@ -1,23 +1,39 @@
sudo: false sudo: false
language: python
python: 3.5
cache: cache:
directories: directories:
- $HOME/.cache/pip - $HOME/.cache/pip
language: python
python:
- 3.5
branches: branches:
only: only:
- master - master
env: env:
- TOXENV=py27-c,py33-c,py34-c,py35-c - TOXENV=py27-c,py33-c,py34-c,py35-c
- TOXENV=py27-pure,py33-pure,py34-pure,py35-pure - TOXENV=py27-pure,py33-pure,py34-pure,py35-pure
- TOXENV=pypy-pure,pypy3-pure - TOXENV=pypy-pure,pypy3-pure
matrix:
include:
- sudo: required
services:
- docker
env:
- DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
install:
- pip install -U pip
- pip install cython
- cython --cplus msgpack/_packer.pyx msgpack/_unpacker.pyx
- docker pull $DOCKER_IMAGE
script:
- docker run --rm -v `pwd`:/io -w /io $DOCKER_IMAGE /io/docker/runtests.sh
install: install:
- pip install -U pip - pip install -U pip
- pip install tox cython - pip install tox cython
- cython --cplus msgpack/_packer.pyx msgpack/_unpacker.pyx - cython --cplus msgpack/_packer.pyx msgpack/_unpacker.pyx
script: tox script: tox
# vim: sw=2 ts=2

14
docker/runtests.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
set -e -x
for V in cp35-cp35m cp34-cp34m cp27-cp27m cp27-cp27mu; do
PYBIN=/opt/python/$V/bin
$PYBIN/python setup.py install
rm -rf build/ # Avoid lib build by narrow Python is used by wide python
$PYBIN/pip install pytest
pushd test # prevent importing msgpack package in current directory.
$PYBIN/python -c 'import sys; print(hex(sys.maxsize))'
$PYBIN/python -c 'from msgpack import _packer, _unpacker'
$PYBIN/py.test -v
popd
done

View file

@ -272,7 +272,7 @@ cdef class Packer(object):
msgpack_pack_ext(&self.pk, typecode, len(data)) msgpack_pack_ext(&self.pk, typecode, len(data))
msgpack_pack_raw_body(&self.pk, data, len(data)) msgpack_pack_raw_body(&self.pk, data, len(data))
def pack_array_header(self, size_t size): def pack_array_header(self, long long size):
if size > ITEM_LIMIT: if size > ITEM_LIMIT:
raise PackValueError raise PackValueError
cdef int ret = msgpack_pack_array(&self.pk, size) cdef int ret = msgpack_pack_array(&self.pk, size)
@ -285,7 +285,7 @@ cdef class Packer(object):
self.pk.length = 0 self.pk.length = 0
return buf return buf
def pack_map_header(self, size_t size): def pack_map_header(self, long long size):
if size > ITEM_LIMIT: if size > ITEM_LIMIT:
raise PackValueError raise PackValueError
cdef int ret = msgpack_pack_map(&self.pk, size) cdef int ret = msgpack_pack_map(&self.pk, size)