mirror of
https://github.com/danog/ext-pq.git
synced 2024-12-02 09:18:02 +01:00
now we're brave!
This commit is contained in:
parent
add042bd76
commit
8b7efa3deb
86
.travis.yml
86
.travis.yml
@ -1,62 +1,44 @@
|
|||||||
# autogenerated file; do not edit
|
# autogenerated file; do not edit
|
||||||
language: c
|
language: c
|
||||||
|
|
||||||
env:
|
addons:
|
||||||
global:
|
postgresql: 9.4
|
||||||
- BUILD_SRC_DIR=/src
|
|
||||||
- BUILD_INSTALL_DIR=/install
|
|
||||||
- PHP_EXTENSIONS="--enable-json --with-mhash"
|
|
||||||
- PG_TEST_DB_NAME=pq_test
|
|
||||||
- PG_TEST_DB_USER=postgres
|
|
||||||
- REPORT_EXIT_STATUS=1
|
|
||||||
|
|
||||||
matrix:
|
env:
|
||||||
include:
|
global:
|
||||||
- env: PHP_TARGET_REF="PHP-5.4" PHP_CONFIGURE_OPTS=""
|
- PQ_DSN="postgres://postgres@localhost/test"
|
||||||
addons:
|
matrix:
|
||||||
postgresql: 9.4
|
- PHP=5.4 enable_debug=no enable_maintainer_zts=no enable_json=no enable_hash=yes
|
||||||
- env: PHP_TARGET_REF="PHP-5.4" PHP_CONFIGURE_OPTS="--enable-debug"
|
- PHP=5.5 enable_debug=no enable_maintainer_zts=no enable_json=no enable_hash=yes
|
||||||
addons:
|
- PHP=5.6 enable_debug=no enable_maintainer_zts=no enable_json=no enable_hash=yes
|
||||||
postgresql: 9.4
|
- PHP=5.4 enable_debug=yes enable_maintainer_zts=no enable_json=no enable_hash=yes
|
||||||
- env: PHP_TARGET_REF="PHP-5.4" PHP_CONFIGURE_OPTS="--enable-maintainer-zts"
|
- PHP=5.5 enable_debug=yes enable_maintainer_zts=no enable_json=no enable_hash=yes
|
||||||
addons:
|
- PHP=5.6 enable_debug=yes enable_maintainer_zts=no enable_json=no enable_hash=yes
|
||||||
postgresql: 9.4
|
- PHP=5.4 enable_debug=no enable_maintainer_zts=yes enable_json=no enable_hash=yes
|
||||||
- env: PHP_TARGET_REF="PHP-5.4" PHP_CONFIGURE_OPTS="--enable-debug --enable-maintainer-zts"
|
- PHP=5.5 enable_debug=no enable_maintainer_zts=yes enable_json=no enable_hash=yes
|
||||||
addons:
|
- PHP=5.6 enable_debug=no enable_maintainer_zts=yes enable_json=no enable_hash=yes
|
||||||
postgresql: 9.4
|
- PHP=5.4 enable_debug=yes enable_maintainer_zts=yes enable_json=no enable_hash=yes
|
||||||
- env: PHP_TARGET_REF="PHP-5.5" PHP_CONFIGURE_OPTS=""
|
- PHP=5.5 enable_debug=yes enable_maintainer_zts=yes enable_json=no enable_hash=yes
|
||||||
addons:
|
- PHP=5.6 enable_debug=yes enable_maintainer_zts=yes enable_json=no enable_hash=yes
|
||||||
postgresql: 9.4
|
- PHP=5.4 enable_debug=no enable_maintainer_zts=no enable_json=yes enable_hash=yes
|
||||||
- env: PHP_TARGET_REF="PHP-5.5" PHP_CONFIGURE_OPTS="--enable-debug"
|
- PHP=5.5 enable_debug=no enable_maintainer_zts=no enable_json=yes enable_hash=yes
|
||||||
addons:
|
- PHP=5.6 enable_debug=no enable_maintainer_zts=no enable_json=yes enable_hash=yes
|
||||||
postgresql: 9.4
|
- PHP=5.4 enable_debug=yes enable_maintainer_zts=no enable_json=yes enable_hash=yes
|
||||||
- env: PHP_TARGET_REF="PHP-5.5" PHP_CONFIGURE_OPTS="--enable-maintainer-zts"
|
- PHP=5.5 enable_debug=yes enable_maintainer_zts=no enable_json=yes enable_hash=yes
|
||||||
addons:
|
- PHP=5.6 enable_debug=yes enable_maintainer_zts=no enable_json=yes enable_hash=yes
|
||||||
postgresql: 9.4
|
- PHP=5.4 enable_debug=no enable_maintainer_zts=yes enable_json=yes enable_hash=yes
|
||||||
- env: PHP_TARGET_REF="PHP-5.5" PHP_CONFIGURE_OPTS="--enable-debug --enable-maintainer-zts"
|
- PHP=5.5 enable_debug=no enable_maintainer_zts=yes enable_json=yes enable_hash=yes
|
||||||
addons:
|
- PHP=5.6 enable_debug=no enable_maintainer_zts=yes enable_json=yes enable_hash=yes
|
||||||
postgresql: 9.4
|
- PHP=5.4 enable_debug=yes enable_maintainer_zts=yes enable_json=yes enable_hash=yes
|
||||||
- env: PHP_TARGET_REF="PHP-5.6" PHP_CONFIGURE_OPTS=""
|
- PHP=5.5 enable_debug=yes enable_maintainer_zts=yes enable_json=yes enable_hash=yes
|
||||||
addons:
|
- PHP=5.6 enable_debug=yes enable_maintainer_zts=yes enable_json=yes enable_hash=yes
|
||||||
postgresql: 9.4
|
|
||||||
- env: PHP_TARGET_REF="PHP-5.6" PHP_CONFIGURE_OPTS="--enable-debug"
|
|
||||||
addons:
|
|
||||||
postgresql: 9.4
|
|
||||||
- env: PHP_TARGET_REF="PHP-5.6" PHP_CONFIGURE_OPTS="--enable-maintainer-zts"
|
|
||||||
addons:
|
|
||||||
postgresql: 9.4
|
|
||||||
- env: PHP_TARGET_REF="PHP-5.6" PHP_CONFIGURE_OPTS="--enable-debug --enable-maintainer-zts"
|
|
||||||
addons:
|
|
||||||
postgresql: 9.4
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- ./travis/compile-php.sh
|
- make -f travis/pecl/Makefile php
|
||||||
- ./travis/compile-ext-raphf.sh
|
- make -f travis/pecl/Makefile pecl PECL=raphf
|
||||||
- ./travis/compile-ext-pq.sh
|
- make -f travis/pecl/Makefile ext PECL=pq
|
||||||
- ./travis/configure-postgres.sh
|
|
||||||
- $HOME$BUILD_INSTALL_DIR/bin/php --ri pq
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- $HOME$BUILD_INSTALL_DIR/bin/php ./run-tests.php -q -p $HOME$BUILD_INSTALL_DIR/bin/php --show-diff
|
- make -f travis/pecl/Makefile test
|
||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
36
gen_travis_yml.php
Executable file
36
gen_travis_yml.php
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
# autogenerated file; do not edit
|
||||||
|
language: c
|
||||||
|
|
||||||
|
addons:
|
||||||
|
postgresql: 9.4
|
||||||
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- PQ_DSN="postgres://postgres@localhost/test"
|
||||||
|
matrix:
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$gen = include "./travis/pecl/gen-matrix.php";
|
||||||
|
$env = $gen([
|
||||||
|
"PHP" => ["5.4", "5.5", "5.6"],
|
||||||
|
"enable_debug",
|
||||||
|
"enable_maintainer_zts",
|
||||||
|
"enable_json",
|
||||||
|
"enable_hash" => ["yes"],
|
||||||
|
]);
|
||||||
|
foreach ($env as $e) {
|
||||||
|
printf(" - %s\n", $e);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- make -f travis/pecl/Makefile php
|
||||||
|
- make -f travis/pecl/Makefile pecl PECL=raphf
|
||||||
|
- make -f travis/pecl/Makefile ext PECL=pq
|
||||||
|
|
||||||
|
script:
|
||||||
|
- make -f travis/pecl/Makefile test
|
||||||
|
|
||||||
|
sudo: false
|
@ -1,2 +1,2 @@
|
|||||||
<?php
|
<?php
|
||||||
define("PQ_DSN", "host=localhost");
|
define("PQ_DSN", getenv("PQ_DSN") ?: "host=localhost");
|
||||||
|
@ -20,7 +20,7 @@ var_dump($lob->tell());
|
|||||||
|
|
||||||
$lob->seek(0, SEEK_SET);
|
$lob->seek(0, SEEK_SET);
|
||||||
$dat = $lob->read(filesize(__FILE__));
|
$dat = $lob->read(filesize(__FILE__));
|
||||||
var_dump(hash("md5", $dat)==hash_file("md5", __FILE__));
|
var_dump(md5($dat)===md5_file(__FILE__));
|
||||||
|
|
||||||
$lob->truncate(5);
|
$lob->truncate(5);
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ DONE
|
|||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Test
|
Test
|
||||||
bool(true)
|
bool(true)
|
||||||
int(489)
|
int(474)
|
||||||
bool(true)
|
bool(true)
|
||||||
string(5) "%c?php"
|
string(5) "%c?php"
|
||||||
DONE
|
DONE
|
||||||
|
@ -17,7 +17,7 @@ var_dump(ftell($lob->stream));
|
|||||||
|
|
||||||
fseek($lob->stream, 0, SEEK_SET);
|
fseek($lob->stream, 0, SEEK_SET);
|
||||||
$dat = fread($lob->stream, filesize(__FILE__));
|
$dat = fread($lob->stream, filesize(__FILE__));
|
||||||
var_dump(hash("md5", $dat)==hash_file("md5", __FILE__));
|
var_dump(md5($dat)===md5_file(__FILE__));
|
||||||
|
|
||||||
ftruncate($lob->stream, 5);
|
ftruncate($lob->stream, 5);
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ $t->unlinkLOB($lob->oid);
|
|||||||
DONE
|
DONE
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Test
|
Test
|
||||||
int(503)
|
int(488)
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
||||||
Warning: ftruncate(): Can't truncate this stream! in %s on line %d
|
Warning: ftruncate(): Can't truncate this stream! in %s on line %d
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
large object import/export
|
large object import/export
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php include "_skipif.inc"; ?>
|
<?php include "_skipif.inc"; ?>
|
||||||
--CLEANUP--
|
--CLEAN--
|
||||||
rm lob004.tmp
|
<?php unlink("lob004.tmp"); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
echo "Test\n";
|
echo "Test\n";
|
||||||
@ -17,7 +17,7 @@ $oid = $t->importLOB(__FILE__);
|
|||||||
var_dump($oid);
|
var_dump($oid);
|
||||||
$t->exportLOB($oid, "lob004.tmp");
|
$t->exportLOB($oid, "lob004.tmp");
|
||||||
|
|
||||||
var_dump(hash_file("md5",__FILE__)===hash_file("md5","lob004.tmp"));
|
var_dump(md5_file(__FILE__)===md5_file("lob004.tmp"));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
DONE
|
DONE
|
||||||
|
97
travis/pecl/Makefile
Normal file
97
travis/pecl/Makefile
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
export
|
||||||
|
|
||||||
|
PHP = 5.6
|
||||||
|
JOBS ?= 2
|
||||||
|
PHP_MIRROR ?= http://us1.php.net/distributions/
|
||||||
|
|
||||||
|
prefix ?= $(HOME)
|
||||||
|
exec_prefix ?= $(prefix)
|
||||||
|
bindir = $(exec_prefix)/bin
|
||||||
|
srcdir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
|
||||||
|
|
||||||
|
enable_maintainer_zts ?= no
|
||||||
|
enable_debug ?= no
|
||||||
|
enable_all ?= no
|
||||||
|
with_config_file_scan_dir ?= $(prefix)/etc/php.d
|
||||||
|
|
||||||
|
with_php_config ?= $(bindir)/php-config
|
||||||
|
extdir = $(shell $(with_php_config) --extension-dir 2>/dev/null)
|
||||||
|
|
||||||
|
PECL_MIRROR ?= http://pecl.php.net/get/
|
||||||
|
PECL_EXTENSION ?= $(shell cut -d: -f1 <<<"$(PECL)")
|
||||||
|
PECL_SONAME ?= $(if $(shell cut -d: -f2 <<<"$(PECL)"),$(shell cut -d: -f2 <<<"$(PECL)"),$(PECL_EXTENSION))
|
||||||
|
PECL_VERSION ?= $(shell cut -d: -f3 -s <<<"$(PECL)")
|
||||||
|
PECL_INI = $(with_config_file_scan_dir)/pecl.ini
|
||||||
|
|
||||||
|
PHP_VERSION ?= $(shell php $(srcdir)/php-version.php $(PHP) < php-versions.json)
|
||||||
|
|
||||||
|
.PHONY: all php check clean reconf pecl ext test
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
all: php
|
||||||
|
|
||||||
|
## -- PHP
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@if test -d $(srcdir)/php-$(PHP_VERSION); then cd $(srcdir)/php-$(PHP_VERSION); make distclean || true; done
|
||||||
|
|
||||||
|
check: $(srcdir)/php-versions.json
|
||||||
|
@if test -z "$(PHP)"; then echo "No php version specified, e.g. PHP=5.6"; exit 1; fi
|
||||||
|
|
||||||
|
reconf: check $(srcdir)/php-$(PHP_VERSION)/configure
|
||||||
|
cd $(srcdir)/php-$(PHP_VERSION) && ./configure -C --prefix=$(prefix)
|
||||||
|
|
||||||
|
php: check $(bindir)/php
|
||||||
|
|
||||||
|
$(srcdir)/php-versions.json: $(srcdir)/php-version.php
|
||||||
|
curl -Sso $@ http://php.net/releases/active.php
|
||||||
|
|
||||||
|
$(srcdir)/php-$(PHP_VERSION)/configure: | $(srcdir)/php-versions.json
|
||||||
|
curl -Ss $(PHP_MIRROR)/php-$(PHP_VERSION).tar.bz2 | tar xj -C $(srcdir)
|
||||||
|
|
||||||
|
$(srcdir)/php-$(PHP_VERSION)/Makefile: $(srcdir)/php-$(PHP_VERSION)/configure | $(srcdir)/php-versions.json
|
||||||
|
cd $(srcdir)/php-$(PHP_VERSION) && ./configure -C --prefix=$(prefix)
|
||||||
|
|
||||||
|
$(srcdir)/php-$(PHP_VERSION)/sapi/cli/php: $(srcdir)/php-$(PHP_VERSION)/Makefile | $(srcdir)/php-versions.json
|
||||||
|
cd $(srcdir)/php-$(PHP_VERSION) && make -s -j $(JOBS) V=0 || make
|
||||||
|
|
||||||
|
$(bindir)/php: $(srcdir)/php-$(PHP_VERSION)/sapi/cli/php | $(srcdir)/php-versions.json
|
||||||
|
cd $(srcdir)/php-$(PHP_VERSION) && make -s install V=0
|
||||||
|
|
||||||
|
$(with_config_file_scan_dir):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
## -- PECL
|
||||||
|
|
||||||
|
pecl-check:
|
||||||
|
@if test -z "$(PECL)"; then echo "No pecl extension specified, e.g. PECL=pecl_http:http"; exit 1; fi
|
||||||
|
|
||||||
|
$(PECL_INI): | $(with_config_file_scan_dir)
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
$(srcdir)/pecl-$(PECL_EXTENSION):
|
||||||
|
test -e $@ || ln -s $(CURDIR) $@
|
||||||
|
|
||||||
|
$(srcdir)/pecl-$(PECL_EXTENSION)/config.m4:
|
||||||
|
mkdir -p $(srcdir)/pecl-$(PECL_EXTENSION)
|
||||||
|
curl -Ss $(PECL_MIRROR)/$(PECL_EXTENSION)$(if $(PECL_VERSION),/$(PECL_VERSION)) | tar xz --strip-components 1 -C $(srcdir)/pecl-$(PECL_EXTENSION)
|
||||||
|
|
||||||
|
$(srcdir)/pecl-$(PECL_EXTENSION)/configure: $(srcdir)/pecl-$(PECL_EXTENSION)/config.m4
|
||||||
|
cd $(srcdir)/pecl-$(PECL_EXTENSION) && $(bindir)/phpize
|
||||||
|
|
||||||
|
$(srcdir)/pecl-$(PECL_EXTENSION)/Makefile: $(srcdir)/pecl-$(PECL_EXTENSION)/configure
|
||||||
|
cd $(srcdir)/pecl-$(PECL_EXTENSION) && ./configure -C
|
||||||
|
|
||||||
|
$(srcdir)/pecl-$(PECL_EXTENSION)/.libs/$(PECL_SONAME).so: $(srcdir)/pecl-$(PECL_EXTENSION)/Makefile
|
||||||
|
cd $(srcdir)/pecl-$(PECL_EXTENSION) && make -s -j $(JOBS) V=0 || make
|
||||||
|
|
||||||
|
$(extdir)/$(PECL_SONAME).so: $(srcdir)/pecl-$(PECL_EXTENSION)/.libs/$(PECL_SONAME).so
|
||||||
|
cd $(srcdir)/pecl-$(PECL_EXTENSION) && make -s install V=0
|
||||||
|
|
||||||
|
pecl: pecl-check php $(extdir)/$(PECL_SONAME).so | $(PECL_INI)
|
||||||
|
grep -q extension=$(PECL_SONAME).so $(PECL_INI) || echo extension=$(PECL_SONAME).so >> $(PECL_INI)
|
||||||
|
|
||||||
|
ext: pecl-check $(srcdir)/pecl-$(PECL_EXTENSION) pecl
|
||||||
|
|
||||||
|
test: php
|
||||||
|
REPORT_EXIT_STATUS=1 NO_INTERACTION=1 $(bindir)/php run-tests.php -p $(bindir)/php --show-diff tests
|
26
travis/pecl/gen-matrix.php
Normal file
26
travis/pecl/gen-matrix.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return function ($array) {
|
||||||
|
foreach ($array as $key => $values) {
|
||||||
|
if (is_numeric($key) && is_string($values)) {
|
||||||
|
$key = $values;
|
||||||
|
$values = ["no","yes"];
|
||||||
|
}
|
||||||
|
if (empty($apc)) {
|
||||||
|
// seed
|
||||||
|
foreach ($values as $val) {
|
||||||
|
$apc[] = "$key=$val";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// combine
|
||||||
|
$cpc = $apc;
|
||||||
|
$apc = [];
|
||||||
|
foreach ($values as $val) {
|
||||||
|
foreach ($cpc as $e) {
|
||||||
|
$apc[] = "$e $key=$val";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $apc;
|
||||||
|
};
|
10
travis/pecl/php-version.php
Normal file
10
travis/pecl/php-version.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$version = $argv[1];
|
||||||
|
$versions = json_decode(stream_get_contents(STDIN), 1);
|
||||||
|
|
||||||
|
list($major) = explode(".", $version, 2);
|
||||||
|
|
||||||
|
if (isset($versions[$major][$version])) {
|
||||||
|
printf("%s\n", $versions[$major][$version]["version"]);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user