Skip to content

Php7 #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jan 20, 2016
Merged

Php7 #209

23 changes: 17 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ php:
- 7.0

env:
- LIBMEMCACHED_VERSION=1.0.18
- LIBMEMCACHED_VERSION=1.0.17
- LIBMEMCACHED_VERSION=1.0.16
- LIBMEMCACHED_VERSION=1.0.15
Expand All @@ -12,15 +13,25 @@ env:
- LIBMEMCACHED_VERSION=1.0.7
- LIBMEMCACHED_VERSION=1.0.6
- LIBMEMCACHED_VERSION=1.0.2
- LIBMEMCACHED_VERSION=0.53
- LIBMEMCACHED_VERSION=0.49
- LIBMEMCACHED_VERSION=0.44

services:
- memcached # will start memcached
#- LIBMEMCACHED_VERSION=0.53
#- LIBMEMCACHED_VERSION=0.49
#- LIBMEMCACHED_VERSION=0.44
addons:
apt:
packages:
- sasl2-bin
- libsasl2-dev

before_script:
- ./.travis/travis.sh before_script $LIBMEMCACHED_VERSION

script:
- ./.travis/travis.sh script $LIBMEMCACHED_VERSION

sudo: false

cache:
directories:
- $HOME/cache


73 changes: 46 additions & 27 deletions .travis/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ function validate_package_xml() {

function install_libmemcached() {

if test -d "${LIBMEMCACHED_PREFIX}"
then
echo "Using cached libmemcached: ${LIBMEMCACHED_PREFIX}"
return
fi

wget "https://launchpad.net/libmemcached/1.0/${LIBMEMCACHED_VERSION}/+download/libmemcached-${LIBMEMCACHED_VERSION}.tar.gz" -O libmemcached-${LIBMEMCACHED_VERSION}.tar.gz

tar xvfz libmemcached-${LIBMEMCACHED_VERSION}.tar.gz
Expand Down Expand Up @@ -81,35 +87,52 @@ function install_msgpack() {
popd
}

function install_sasl() {
function install_memcached() {
local prefix="${HOME}/cache/memcached-sasl-${MEMCACHED_VERSION}"

if test -d "$prefix"
then
echo "Using cached memcached: ${prefix}"
return
fi

wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz -O memcached-1.4.15.tar.gz
tar xfz memcached-1.4.15.tar.gz
wget http://www.memcached.org/files/memcached-${MEMCACHED_VERSION}.tar.gz -O memcached-${MEMCACHED_VERSION}.tar.gz
tar xfz memcached-${MEMCACHED_VERSION}.tar.gz

pushd memcached-1.4.15
./configure --enable-sasl --prefix="${HOME}/memcached"
pushd memcached-${MEMCACHED_VERSION}
./configure --enable-sasl --enable-sasl-pwdb --prefix="${prefix}"
make
make install
popd
}

function run_memcached() {
local prefix="${HOME}/cache/memcached-sasl-${MEMCACHED_VERSION}"

sudo apt-get install sasl2-bin
export SASL_CONF_PATH="${HOME}/sasl2"
export SASL_CONF_PATH="/tmp/sasl2"

if test -d "${SASL_CONF_PATH}"
then
rm -rf "${SASL_CONF_PATH}"
fi

# Create config path
mkdir "${SASL_CONF_PATH}"
export MEMCACHED_SASL_PWDB="${SASL_CONF_PATH}/sasldb2"

# Create configuration
cat<<EOF > "${SASL_CONF_PATH}/memcached.conf"
mech_list: PLAIN
plainlog_level: 5
sasldb_path: ${SASL_CONF_PATH}/sasldb2
sasldb_path: ${MEMCACHED_SASL_PWDB}
EOF

# Create password
echo "test" | /usr/sbin/saslpasswd2 -c memcached -a memcached -f "${SASL_CONF_PATH}/sasldb2"
echo "test" | /usr/sbin/saslpasswd2 -c memcached -a memcached -f "${MEMCACHED_SASL_PWDB}"

# Run normal memcached
"${prefix}/bin/memcached" -d -p 11211

# Run memcached on port 11212 with SASL support
"${HOME}/memcached/bin/memcached" -S -d -p 11212
"${prefix}/bin/memcached" -S -d -p 11212
}

function build_php_memcached() {
Expand Down Expand Up @@ -153,30 +176,24 @@ EOF
function run_memcached_tests() {
export NO_INTERACTION=1
export REPORT_EXIT_STATUS=1
export TEST_PHP_EXECUTABLE=`which php`
export TEST_PHP_EXECUTABLE=$(which php)

pushd "${PHP_MEMCACHED_BUILD_DIR}/memcached-${PHP_MEMCACHED_VERSION}"
# We have one xfail test, we run it separately
php run-tests.php -d extension=memcached.so -n ./tests/expire.phpt
rm ./tests/expire.phpt

# Run normal tests
php run-tests.php -d extension=memcached.so -n ./tests/*.phpt
php run-tests.php --show-diff -d extension=memcached.so -n ./tests/*.phpt
retval=$?
for i in `ls tests/*.out 2>/dev/null`; do
echo "-- START ${i}";
cat $i;
echo "";
echo "-- END";
done
popd

return $retval;
}

# Command line arguments
ACTION=$1
LIBMEMCACHED_VERSION=$2
MEMCACHED_VERSION="1.4.25"

if test "x$ACTION" = "x"; then
echo "Usage: $0 <action> <libmemcached version>"
Expand All @@ -188,11 +205,15 @@ if test "x$LIBMEMCACHED_VERSION" = "x"; then
exit 1
fi

if test "x$3" != "x"; then
MEMCACHED_VERSION=$3
fi

# the extension version
PHP_MEMCACHED_VERSION=$(php -r '$sxe = simplexml_load_file ("package.xml"); echo (string) $sxe->version->release;')

# Libmemcached install dir
LIBMEMCACHED_PREFIX="${HOME}/libmemcached-${LIBMEMCACHED_VERSION}"
LIBMEMCACHED_PREFIX="${HOME}/cache/libmemcached-${LIBMEMCACHED_VERSION}"

# Where to do the build
PHP_MEMCACHED_BUILD_DIR="/tmp/php-memcached-build"
Expand All @@ -219,11 +240,9 @@ case $ACTION in

# install msgpack
# install_msgpack

# install SASL
if test "x$ENABLE_SASL" = "xyes"; then
install_sasl
fi

install_memcached
run_memcached
;;

script)
Expand Down
Loading