Skip to content

Commit 24172a7

Browse files
authored
Merge pull request #289 from sodabrew/fix-travis-2.0
2 parents ee95725 + 33d7098 commit 24172a7

File tree

8 files changed

+108
-53
lines changed

8 files changed

+108
-53
lines changed

.travis.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1+
sudo: required
2+
dist: trusty
3+
14
language: php
25
php:
36
- 5.5
4-
#- 5.4
5-
#- 5.3
7+
- 5.6
8+
69
env:
7-
- LIBMEMCACHED_VERSION=1.0.17
8-
- LIBMEMCACHED_VERSION=1.0.16
9-
- LIBMEMCACHED_VERSION=1.0.15
10-
- LIBMEMCACHED_VERSION=1.0.14
11-
- LIBMEMCACHED_VERSION=1.0.10
12-
- LIBMEMCACHED_VERSION=1.0.8
13-
- LIBMEMCACHED_VERSION=1.0.7
14-
- LIBMEMCACHED_VERSION=1.0.6
15-
- LIBMEMCACHED_VERSION=1.0.2
16-
- LIBMEMCACHED_VERSION=0.53
17-
- LIBMEMCACHED_VERSION=0.49
18-
- LIBMEMCACHED_VERSION=0.44
10+
- LIBMEMCACHED_VERSION=1.0.18 # Debian Jessie / Ubuntu Xenial
11+
- LIBMEMCACHED_VERSION=1.0.16 # RHEL / CentOS 7
12+
- LIBMEMCACHED_VERSION=1.0.8 # Debian Wheezy / Ubuntu Trusty
13+
- LIBMEMCACHED_VERSION=1.0.2 # Ancient
14+
- LIBMEMCACHED_VERSION=0.53 # Ancient
1915

20-
services:
21-
- memcached # will start memcached
16+
addons:
17+
apt:
18+
packages:
19+
- sasl2-bin
20+
- libsasl2-dev
21+
- libevent-dev
2222

2323
before_script:
2424
- ./.travis/travis.sh before_script $LIBMEMCACHED_VERSION
2525

2626
script:
2727
- ./.travis/travis.sh script $LIBMEMCACHED_VERSION
28+
29+
cache:
30+
directories:
31+
- $HOME/cache

.travis/travis.sh

Lines changed: 50 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ function validate_package_xml() {
4444

4545
function install_libmemcached() {
4646

47+
if test -d "${LIBMEMCACHED_PREFIX}"
48+
then
49+
echo "Using cached libmemcached: ${LIBMEMCACHED_PREFIX}"
50+
return
51+
fi
52+
4753
wget "https://launchpad.net/libmemcached/1.0/${LIBMEMCACHED_VERSION}/+download/libmemcached-${LIBMEMCACHED_VERSION}.tar.gz" -O libmemcached-${LIBMEMCACHED_VERSION}.tar.gz
4854

4955
tar xvfz libmemcached-${LIBMEMCACHED_VERSION}.tar.gz
@@ -81,35 +87,52 @@ function install_msgpack() {
8187
popd
8288
}
8389

84-
function install_sasl() {
90+
function install_memcached() {
91+
local prefix="${HOME}/cache/memcached-sasl-${MEMCACHED_VERSION}"
92+
93+
if test -d "$prefix"
94+
then
95+
echo "Using cached memcached: ${prefix}"
96+
return
97+
fi
8598

86-
wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz -O memcached-1.4.15.tar.gz
87-
tar xfz memcached-1.4.15.tar.gz
99+
wget http://www.memcached.org/files/memcached-${MEMCACHED_VERSION}.tar.gz -O memcached-${MEMCACHED_VERSION}.tar.gz
100+
tar xfz memcached-${MEMCACHED_VERSION}.tar.gz
88101

89-
pushd memcached-1.4.15
90-
./configure --enable-sasl --prefix="${HOME}/memcached"
102+
pushd memcached-${MEMCACHED_VERSION}
103+
./configure --enable-sasl --enable-sasl-pwdb --prefix="${prefix}"
91104
make
92105
make install
93106
popd
107+
}
108+
109+
function run_memcached() {
110+
local prefix="${HOME}/cache/memcached-sasl-${MEMCACHED_VERSION}"
94111

95-
sudo apt-get install sasl2-bin
96-
export SASL_CONF_PATH="${HOME}/sasl2"
112+
export SASL_CONF_PATH="/tmp/sasl2"
113+
114+
if test -d "${SASL_CONF_PATH}"
115+
then
116+
rm -rf "${SASL_CONF_PATH}"
117+
fi
97118

98-
# Create config path
99119
mkdir "${SASL_CONF_PATH}"
120+
export MEMCACHED_SASL_PWDB="${SASL_CONF_PATH}/sasldb2"
100121

101122
# Create configuration
102123
cat<<EOF > "${SASL_CONF_PATH}/memcached.conf"
103124
mech_list: PLAIN
104125
plainlog_level: 5
105-
sasldb_path: ${SASL_CONF_PATH}/sasldb2
126+
sasldb_path: ${MEMCACHED_SASL_PWDB}
106127
EOF
107128

108-
# Create password
109-
echo "test" | /usr/sbin/saslpasswd2 -c memcached -a memcached -f "${SASL_CONF_PATH}/sasldb2"
129+
echo "test" | /usr/sbin/saslpasswd2 -c memcached -a memcached -f "${MEMCACHED_SASL_PWDB}"
130+
131+
# Run normal memcached
132+
"${prefix}/bin/memcached" -d -p 11211
110133

111134
# Run memcached on port 11212 with SASL support
112-
"${HOME}/memcached/bin/memcached" -S -d -p 11212
135+
"${prefix}/bin/memcached" -S -d -p 11212
113136
}
114137

115138
function build_php_memcached() {
@@ -129,7 +152,8 @@ function build_php_memcached() {
129152
sasl_flag="--enable-memcached-sasl"
130153
fi
131154

132-
./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag --enable-memcached-json --enable-memcached-igbinary --enable-memcached-msgpack
155+
# ./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag
156+
./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag --enable-memcached-json --enable-memcached-msgpack --enable-memcached-igbinary
133157
make
134158
make install
135159
popd
@@ -152,30 +176,24 @@ EOF
152176
function run_memcached_tests() {
153177
export NO_INTERACTION=1
154178
export REPORT_EXIT_STATUS=1
155-
export TEST_PHP_EXECUTABLE=`which php`
179+
export TEST_PHP_EXECUTABLE=$(which php)
156180

157181
pushd "${PHP_MEMCACHED_BUILD_DIR}/memcached-${PHP_MEMCACHED_VERSION}"
158182
# We have one xfail test, we run it separately
159-
php run-tests.php -d extension=msgpack.so -d extension=igbinary.so -d extension=memcached.so -n ./tests/expire.phpt
183+
php run-tests.php -d extension=memcached.so -n ./tests/expire.phpt
160184
rm ./tests/expire.phpt
161185

162186
# Run normal tests
163-
php run-tests.php -d extension=msgpack.so -d extension=igbinary.so -d extension=memcached.so -n ./tests/*.phpt
187+
php run-tests.php --show-diff -d extension=modules/memcached.so -d extension=msgpack.so -d extension=igbinary.so -n ./tests/*.phpt
164188
retval=$?
165-
for i in `ls tests/*.out 2>/dev/null`; do
166-
echo "-- START ${i}";
167-
cat $i;
168-
echo "";
169-
echo "-- END";
170-
done
171189
popd
172-
173190
return $retval;
174191
}
175192

176193
# Command line arguments
177194
ACTION=$1
178195
LIBMEMCACHED_VERSION=$2
196+
MEMCACHED_VERSION="1.4.25"
179197

180198
if test "x$ACTION" = "x"; then
181199
echo "Usage: $0 <action> <libmemcached version>"
@@ -187,11 +205,15 @@ if test "x$LIBMEMCACHED_VERSION" = "x"; then
187205
exit 1
188206
fi
189207

208+
if test "x$3" != "x"; then
209+
MEMCACHED_VERSION=$3
210+
fi
211+
190212
# the extension version
191213
PHP_MEMCACHED_VERSION=$(php -r '$sxe = simplexml_load_file ("package.xml"); echo (string) $sxe->version->release;')
192214

193215
# Libmemcached install dir
194-
LIBMEMCACHED_PREFIX="${HOME}/libmemcached-${LIBMEMCACHED_VERSION}"
216+
LIBMEMCACHED_PREFIX="${HOME}/cache/libmemcached-${LIBMEMCACHED_VERSION}"
195217

196218
# Where to do the build
197219
PHP_MEMCACHED_BUILD_DIR="/tmp/php-memcached-build"
@@ -216,13 +238,11 @@ case $ACTION in
216238
# Install igbinary extension
217239
install_igbinary
218240

219-
# install msgpack
241+
# Install msgpack extension
220242
install_msgpack
221-
222-
# install SASL
223-
if test "x$ENABLE_SASL" = "xyes"; then
224-
install_sasl
225-
fi
243+
244+
install_memcached
245+
run_memcached
226246
;;
227247

228248
script)

tests/config.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ function memc_create_combinations ($name, $serializer, $ignore_object_type = fal
6464
),
6565
);
6666
}
67+
68+
function memc_get_version($memc, $host = '') {
69+
$version = $memc->getVersion();
70+
return array_pop($version);
71+
}

tests/expire.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ Memcached store, fetch & touch expired key
33
--XFAIL--
44
https://code.google.com/p/memcached/issues/detail?id=275
55
--SKIPIF--
6-
<?php if (!extension_loaded("memcached")) print "skip";
6+
<?php
7+
$min_version = "1.4.8";
8+
include dirname(__FILE__) . "/skipif.inc";
79
if (!method_exists("memcached", "touch")) die ("skip memcached::touch is not available");
810
?>
911
--FILE--

tests/gh_155.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
--TEST--
22
Test for bug 155
33
--SKIPIF--
4-
<?php if (!extension_loaded("memcached")) print "skip"; ?>
4+
<?php
5+
$min_version = "1.4.8";
6+
include dirname(__FILE__) . "/skipif.inc";
7+
if (Memcached::LIBMEMCACHED_VERSION_HEX < 0x01000016) die ('skip too old libmemcached');
8+
?>
59
--FILE--
610
<?php
711
include dirname (__FILE__) . '/config.inc';
@@ -38,4 +42,4 @@ TOUCH: SUCCESS
3842
TOUCH: SUCCESS
3943
GET: SUCCESS
4044
GET: SUCCESS
41-
DONE
45+
DONE

tests/gh_77.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
--TEST--
22
Test for Github issue #77
33
--SKIPIF--
4-
<?php if (!extension_loaded("memcached")) print "skip";
5-
if (Memcached::LIBMEMCACHED_VERSION_HEX < 0x01000016) die ('skip too old libmemcached');
4+
<?php
5+
$min_version = "1.4.8";
6+
include dirname(__FILE__) . "/skipif.inc";
7+
if (Memcached::LIBMEMCACHED_VERSION_HEX < 0x01000016) die ('skip too old libmemcached');
68
?>
79
--FILE--
810
<?php

tests/skipif.inc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
if (!extension_loaded("memcached")) {
3+
die("skip memcached is not loaded\n");
4+
}
5+
6+
include dirname(__FILE__) . "/config.inc";
7+
8+
if (($m = memc_get_instance()) === NULL) {
9+
die ("skip can not connect to server\n");
10+
}
11+
12+
if (isset($min_version)) {
13+
if (version_compare(memc_get_version($m), $min_version, "<")) {
14+
die("skip version of server pool is too old, $min_version is required\n");
15+
}
16+
}

tests/touch_binary.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
--TEST--
22
Touch in binary mode
33
--SKIPIF--
4-
<?php if (!extension_loaded("memcached")) print "skip";
5-
if (Memcached::LIBMEMCACHED_VERSION_HEX < 0x01000016) die ('skip too old libmemcached');
4+
<?php
5+
$min_version = "1.4.8"; //TOUCH is added since 1.4.8
6+
include dirname(__FILE__) . "/skipif.inc";
7+
if (Memcached::LIBMEMCACHED_VERSION_HEX < 0x01000016) die ('skip too old libmemcached');
68
?>
79
--FILE--
810
<?php

0 commit comments

Comments
 (0)