@@ -44,6 +44,12 @@ function validate_package_xml() {
44
44
45
45
function install_libmemcached() {
46
46
47
+ if test -d " ${LIBMEMCACHED_PREFIX} "
48
+ then
49
+ echo " Using cached libmemcached: ${LIBMEMCACHED_PREFIX} "
50
+ return
51
+ fi
52
+
47
53
wget " https://launchpad.net/libmemcached/1.0/${LIBMEMCACHED_VERSION} /+download/libmemcached-${LIBMEMCACHED_VERSION} .tar.gz" -O libmemcached-${LIBMEMCACHED_VERSION} .tar.gz
48
54
49
55
tar xvfz libmemcached-${LIBMEMCACHED_VERSION} .tar.gz
@@ -81,35 +87,52 @@ function install_msgpack() {
81
87
popd
82
88
}
83
89
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
85
98
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
88
101
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} "
91
104
make
92
105
make install
93
106
popd
107
+ }
108
+
109
+ function run_memcached() {
110
+ local prefix=" ${HOME} /cache/memcached-sasl-${MEMCACHED_VERSION} "
94
111
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
97
118
98
- # Create config path
99
119
mkdir " ${SASL_CONF_PATH} "
120
+ export MEMCACHED_SASL_PWDB=" ${SASL_CONF_PATH} /sasldb2"
100
121
101
122
# Create configuration
102
123
cat<< EOF > "${SASL_CONF_PATH} /memcached.conf"
103
124
mech_list: PLAIN
104
125
plainlog_level: 5
105
- sasldb_path: ${SASL_CONF_PATH} /sasldb2
126
+ sasldb_path: ${MEMCACHED_SASL_PWDB}
106
127
EOF
107
128
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
110
133
111
134
# 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
113
136
}
114
137
115
138
function build_php_memcached() {
@@ -153,30 +176,24 @@ EOF
153
176
function run_memcached_tests() {
154
177
export NO_INTERACTION=1
155
178
export REPORT_EXIT_STATUS=1
156
- export TEST_PHP_EXECUTABLE=` which php`
179
+ export TEST_PHP_EXECUTABLE=$( which php)
157
180
158
181
pushd " ${PHP_MEMCACHED_BUILD_DIR} /memcached-${PHP_MEMCACHED_VERSION} "
159
182
# We have one xfail test, we run it separately
160
183
php run-tests.php -d extension=memcached.so -n ./tests/expire.phpt
161
184
rm ./tests/expire.phpt
162
185
163
186
# Run normal tests
164
- php run-tests.php -d extension=memcached.so -n ./tests/* .phpt
187
+ php run-tests.php --show-diff - d extension=memcached.so -n ./tests/* .phpt
165
188
retval=$?
166
- for i in ` ls tests/* .out 2> /dev/null` ; do
167
- echo " -- START ${i} " ;
168
- cat $i ;
169
- echo " " ;
170
- echo " -- END" ;
171
- done
172
189
popd
173
-
174
190
return $retval ;
175
191
}
176
192
177
193
# Command line arguments
178
194
ACTION=$1
179
195
LIBMEMCACHED_VERSION=$2
196
+ MEMCACHED_VERSION=" 1.4.25"
180
197
181
198
if test " x$ACTION " = " x" ; then
182
199
echo " Usage: $0 <action> <libmemcached version>"
@@ -188,11 +205,15 @@ if test "x$LIBMEMCACHED_VERSION" = "x"; then
188
205
exit 1
189
206
fi
190
207
208
+ if test " x$3 " ! = " x" ; then
209
+ MEMCACHED_VERSION=$3
210
+ fi
211
+
191
212
# the extension version
192
213
PHP_MEMCACHED_VERSION=$( php -r ' $sxe = simplexml_load_file ("package.xml"); echo (string) $sxe->version->release;' )
193
214
194
215
# Libmemcached install dir
195
- LIBMEMCACHED_PREFIX=" ${HOME} /libmemcached-${LIBMEMCACHED_VERSION} "
216
+ LIBMEMCACHED_PREFIX=" ${HOME} /cache/ libmemcached-${LIBMEMCACHED_VERSION} "
196
217
197
218
# Where to do the build
198
219
PHP_MEMCACHED_BUILD_DIR=" /tmp/php-memcached-build"
@@ -219,11 +240,9 @@ case $ACTION in
219
240
220
241
# install msgpack
221
242
# install_msgpack
222
-
223
- # install SASL
224
- if test " x$ENABLE_SASL " = " xyes" ; then
225
- install_sasl
226
- fi
243
+
244
+ install_memcached
245
+ run_memcached
227
246
;;
228
247
229
248
script)
0 commit comments