Skip to content

Commit c41c56c

Browse files
committed
Backport travis.sh from master / php7 branch
1 parent ee95725 commit c41c56c

File tree

1 file changed

+50
-30
lines changed

1 file changed

+50
-30
lines changed

.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)

0 commit comments

Comments
 (0)