summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2017-02-08 07:07:40 +0100
committerRemi Collet <fedora@famillecollet.com>2017-02-08 07:07:40 +0100
commitae04014b3ca0f619bafeb982fc0b831ed81221c9 (patch)
treef7c16906e75cf6f68cc3c760da94b2ac3e0bbc88
parent8d988d728718884ac41bc08742f9804adf3f6198 (diff)
php-pecl-mongodb: test build for pr #526
-rw-r--r--526.patch444
-rw-r--r--mongodb-tests.patch32
-rw-r--r--php-pecl-mongodb.spec9
3 files changed, 447 insertions, 38 deletions
diff --git a/526.patch b/526.patch
new file mode 100644
index 0000000..3e9b869
--- /dev/null
+++ b/526.patch
@@ -0,0 +1,444 @@
+From 1cfffa55894eb8a95e1fd4a4e19f2f9cc442ca41 Mon Sep 17 00:00:00 2001
+From: Jeremy Mikola <jmikola@gmail.com>
+Date: Fri, 13 Jan 2017 14:30:36 -0500
+Subject: [PATCH 1/7] Use exactly representable floating point numbers in tests
+
+CDRIVER-1945 increased the precision when rendering floating point numbers in JavaScript. Using numbers that can be exactly represented in floating point will allow us to keep the expected output consistent with our input.
+---
+ tests/bson/bson-decode-001.phpt | 5 ++---
+ tests/bson/bson-encode-001.phpt | 6 +++---
+ 2 files changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/tests/bson/bson-decode-001.phpt b/tests/bson/bson-decode-001.phpt
+index 2153dd9..64b2443 100644
+--- a/tests/bson/bson-decode-001.phpt
++++ b/tests/bson/bson-decode-001.phpt
+@@ -10,8 +10,7 @@ $tests = array(
+ array((object)array("hello" => "world")),
+ array(null),
+ array(123),
+-
+- array(4.23),
++ array(4.125),
+ array(true),
+ array(false),
+ array("string"),
+@@ -60,7 +59,7 @@ Test#2 { "0" : null }
+ OK
+ Test#3 { "0" : 123 }
+ OK
+-Test#4 { "0" : 4.23 }
++Test#4 { "0" : 4.125 }
+ OK
+ Test#5 { "0" : true }
+ OK
+diff --git a/tests/bson/bson-encode-001.phpt b/tests/bson/bson-encode-001.phpt
+index 257e0de..f3d2649 100644
+--- a/tests/bson/bson-encode-001.phpt
++++ b/tests/bson/bson-encode-001.phpt
+@@ -15,7 +15,7 @@ $tests = array(
+ array(array("0" => 1, "1" => 2, "2" => 3, "3" => 4, "4" => 5, "5" => 6, "6" => 7, "7" => 8, "8" => 9)),
+ array(null),
+ array(123),
+- array(4.23),
++ array(4.125),
+ array(true),
+ array(false),
+ array("string"),
+@@ -74,8 +74,8 @@ Test#7 { "0" : null }
+ 0 : 08 00 00 00 0a 30 00 00 [.....0..]
+ Test#8 { "0" : 123 }
+ 0 : 0c 00 00 00 10 30 00 7b 00 00 00 00 [.....0.{....]
+-Test#9 { "0" : 4.23 }
+- 0 : 10 00 00 00 01 30 00 ec 51 b8 1e 85 eb 10 40 00 [.....0..Q.....@.]
++Test#9 { "0" : 4.125 }
++ 0 : 10 00 00 00 01 30 00 00 00 00 00 00 80 10 40 00 [.....0........@.]
+ Test#10 { "0" : true }
+ 0 : 09 00 00 00 08 30 00 01 00 [.....0...]
+ Test#11 { "0" : false }
+
+From 77be3df93d58d74ddf8d9e4f8c996798ac85af4a Mon Sep 17 00:00:00 2001
+From: Jeremy Mikola <jmikola@gmail.com>
+Date: Tue, 7 Feb 2017 16:28:41 -0500
+Subject: [PATCH 2/7] Manager::executeQuery() without assignment test is
+ obsolete
+
+Testing query execution without return value assignment is already handled by tests/query/bug0705-001.phpt.
+---
+ .../manager-executequery-without-assignment.phpt | 29 ----------------------
+ 1 file changed, 29 deletions(-)
+ delete mode 100644 tests/manager/manager-executequery-without-assignment.phpt
+
+diff --git a/tests/manager/manager-executequery-without-assignment.phpt b/tests/manager/manager-executequery-without-assignment.phpt
+deleted file mode 100644
+index cf1172b..0000000
+--- a/tests/manager/manager-executequery-without-assignment.phpt
++++ /dev/null
+@@ -1,29 +0,0 @@
+---TEST--
+-MongoDB\Driver\Manager: Executing Query without assignment still executes
+---SKIPIF--
+-<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM uses HHVM's logging functionality"); ?>
+-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+---FILE--
+-<?php
+-require_once __DIR__ . "/../utils/basic.inc";
+-
+-$manager = new MongoDB\Driver\Manager(STANDALONE);
+-
+-$bulk = new MongoDB\Driver\BulkWrite();
+-$bulk->insert(array('_id' => 1, 'x' => 1));
+-$bulk->insert(array('_id' => 2, 'x' => 1));
+-$manager->executeBulkWrite(NS, $bulk);
+-
+-ini_set("mongodb.debug", "stdout");
+-$manager->executeQuery(NS, new MongoDB\Driver\Query(array("x" => 1)));
+-ini_set("mongodb.debug", "off");
+-
+-?>
+-===DONE===
+-<?php exit(0); ?>
+---EXPECTF--
+-%a
+-[%s] cursor: TRACE > ENTRY: mongoc_cursor_next():%d
+-%a
+-[%s] cursor: TRACE > EXIT: mongoc_cursor_destroy():%d
+-===DONE===
+
+From e3c4439ae3b7520ba19e6c3f075bc8ff15ab0794 Mon Sep 17 00:00:00 2001
+From: Jeremy Mikola <jmikola@gmail.com>
+Date: Tue, 7 Feb 2017 16:30:04 -0500
+Subject: [PATCH 3/7] Remove Manager::executeBulkWrite() insert error test
+
+In libmongoc 1.6.0, insert documents are validated during BulkWrite::insert(). This is a fragile test that fails when v1.2 is compiled against libmongoc 1.6.0 as a system library.
+---
+ .../manager-executeBulkWrite_error-005.phpt | 48 ----------------------
+ 1 file changed, 48 deletions(-)
+ delete mode 100644 tests/manager/manager-executeBulkWrite_error-005.phpt
+
+diff --git a/tests/manager/manager-executeBulkWrite_error-005.phpt b/tests/manager/manager-executeBulkWrite_error-005.phpt
+deleted file mode 100644
+index 81c965a..0000000
+--- a/tests/manager/manager-executeBulkWrite_error-005.phpt
++++ /dev/null
+@@ -1,48 +0,0 @@
+---TEST--
+-MongoDB\Driver\Manager::executeBulkWrite() insert write error
+---SKIPIF--
+-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+---FILE--
+-<?php
+-require_once __DIR__ . "/../utils/basic.inc";
+-
+-$manager = new MongoDB\Driver\Manager(STANDALONE);
+-
+-$bulk = new MongoDB\Driver\BulkWrite();
+-$bulk->insert(['$foo' => 1]);
+-
+-try {
+- $manager->executeBulkWrite(NS, $bulk);
+-} catch (MongoDB\Driver\Exception\BulkWriteException $e) {
+- printf("BulkWriteException: %s\n", $e->getMessage());
+-
+- echo "\n===> WriteResult\n";
+- printWriteResult($e->getWriteResult());
+-}
+-
+-?>
+-===DONE===
+-<?php exit(0); ?>
+---EXPECTF--
+-BulkWriteException: Document can't have $ prefixed field names: $foo
+-
+-===> WriteResult
+-server: %s:%d
+-insertedCount: 0
+-matchedCount: 0
+-modifiedCount: 0
+-upsertedCount: 0
+-deletedCount: 0
+-object(MongoDB\Driver\WriteError)#%d (%d) {
+- ["message"]=>
+- string(48) "Document can't have $ prefixed field names: $foo"
+- ["code"]=>
+- int(2)
+- ["index"]=>
+- int(0)
+- ["info"]=>
+- NULL
+-}
+-writeError[0].message: Document can't have $ prefixed field names: $foo
+-writeError[0].code: 2
+-===DONE===
+
+From 8edd0c903416f7ff4b6a3d478720ee7cd8f935b5 Mon Sep 17 00:00:00 2001
+From: Jeremy Mikola <jmikola@gmail.com>
+Date: Tue, 7 Feb 2017 16:31:54 -0500
+Subject: [PATCH 4/7] Do not assert error message in fromJSON() error test
+
+libbson 1.6.0 switched JSON parsers, which means this test fails when compiled against libbson 1.6.0 as a system library. Removing the error message assertion keeps the test portable.
+---
+ tests/bson/bson-fromJSON_error-001.phpt | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/tests/bson/bson-fromJSON_error-001.phpt b/tests/bson/bson-fromJSON_error-001.phpt
+index a86ca7a..a0f91a0 100644
+--- a/tests/bson/bson-fromJSON_error-001.phpt
++++ b/tests/bson/bson-fromJSON_error-001.phpt
+@@ -5,17 +5,13 @@ MongoDB\BSON\fromJSON(): invalid JSON
+
+ require_once __DIR__ . '/../utils/tools.php';
+
+-echo throws(function() {
++throws(function() {
+ fromJSON('foo');
+-}, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n";
++}, 'MongoDB\Driver\Exception\UnexpectedValueException');
+
+ ?>
+ ===DONE===
+ <?php exit(0); ?>
+ --EXPECT--
+ OK: Got MongoDB\Driver\Exception\UnexpectedValueException
+-lexical error: invalid string in json text.
+- foo
+- (right here) ------^
+-
+ ===DONE===
+
+From 04bd60be6334a083ba47d874cb262b8d453e9277 Mon Sep 17 00:00:00 2001
+From: Jeremy Mikola <jmikola@gmail.com>
+Date: Tue, 7 Feb 2017 16:34:10 -0500
+Subject: [PATCH 5/7] Make JavaScript::jsonSerialize() tests portable for
+ libbson 1.5 and 1.6
+
+---
+ tests/bson/bson-javascript-jsonserialize-003.phpt | 6 +++---
+ tests/bson/bson-javascript-jsonserialize-004.phpt | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/tests/bson/bson-javascript-jsonserialize-003.phpt b/tests/bson/bson-javascript-jsonserialize-003.phpt
+index 0478bb4..c551483 100644
+--- a/tests/bson/bson-javascript-jsonserialize-003.phpt
++++ b/tests/bson/bson-javascript-jsonserialize-003.phpt
+@@ -20,9 +20,9 @@ var_dump(toPHP(fromJSON($json)));
+ {"foo":{"$code":"function foo(bar) { return bar; }"}}
+ object(stdClass)#%d (%d) {
+ ["foo"]=>
+- object(stdClass)#%d (%d) {
+- ["$code"]=>
++ object(%r(stdClass|MongoDB\\BSON\\Javascript)%r)#%d (%d) {
++ ["%r(\$?)%rcode"]=>
+ string(33) "function foo(bar) { return bar; }"
+- }
++ %A}
+ }
+ ===DONE===
+diff --git a/tests/bson/bson-javascript-jsonserialize-004.phpt b/tests/bson/bson-javascript-jsonserialize-004.phpt
+index a3daaa5..f134edb 100644
+--- a/tests/bson/bson-javascript-jsonserialize-004.phpt
++++ b/tests/bson/bson-javascript-jsonserialize-004.phpt
+@@ -20,10 +20,10 @@ var_dump(toPHP(fromJSON($json)));
+ {"foo":{"$code":"function foo(bar) { return bar; }","$scope":{"foo":42}}}
+ object(stdClass)#%d (%d) {
+ ["foo"]=>
+- object(stdClass)#%d (%d) {
+- ["$code"]=>
++ object(%r(stdClass|MongoDB\\BSON\\Javascript)%r)#%d (%d) {
++ ["%r(\$?)%rcode"]=>
+ string(33) "function foo(bar) { return bar; }"
+- ["$scope"]=>
++ ["%r(\$?)%rscope"]=>
+ object(stdClass)#%d (%d) {
+ ["foo"]=>
+ int(42)
+
+From 6ed6a34f5bbc15e427886411982bbff97b04ba82 Mon Sep 17 00:00:00 2001
+From: Jeremy Mikola <jmikola@gmail.com>
+Date: Tue, 7 Feb 2017 16:37:12 -0500
+Subject: [PATCH 6/7] Only assert mongodb.debug INI in phpinfo() tests
+
+The current phpinfo() tests were fragile and not compatible when build against libbson/libmongoc system libraries, which might also have different SSL options.
+---
+ tests/functional/phpinfo-1.phpt | 20 +-------------------
+ tests/functional/phpinfo-2.phpt | 20 +-------------------
+ 2 files changed, 2 insertions(+), 38 deletions(-)
+
+diff --git a/tests/functional/phpinfo-1.phpt b/tests/functional/phpinfo-1.phpt
+index 045c540..c752cd9 100644
+--- a/tests/functional/phpinfo-1.phpt
++++ b/tests/functional/phpinfo-1.phpt
+@@ -1,11 +1,9 @@
+ --TEST--
+-phpinfo()
++phpinfo() reports mongodb.debug (no value)
+ --SKIPIF--
+ <?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM does not do phpinfo() this way"); ?>
+-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+ --FILE--
+ <?php
+-require_once __DIR__ . "/../utils/basic.inc";
+
+ phpinfo();
+
+@@ -14,22 +12,6 @@ phpinfo();
+ <?php exit(0); ?>
+ --EXPECTF--
+ %a
+-mongodb
+-
+-MongoDB support => enabled
+-MongoDB extension version => 1.%d.%d%S
+-MongoDB extension stability => %s
+-libbson bundled version => 1.%d.%d%S
+-libmongoc bundled version => 1.%d.%d%S
+-libmongoc SSL => enabled
+-libmongoc SSL library => %s
+-libmongoc crypto => enabled
+-libmongoc crypto library => %s
+-libmongoc crypto system profile => %s
+-libmongoc SASL => enabled
+-
+-Directive => Local Value => Master Value
+ mongodb.debug => no value => no value
+-
+ %a
+ ===DONE===
+diff --git a/tests/functional/phpinfo-2.phpt b/tests/functional/phpinfo-2.phpt
+index 91b3236..7549077 100644
+--- a/tests/functional/phpinfo-2.phpt
++++ b/tests/functional/phpinfo-2.phpt
+@@ -1,13 +1,11 @@
+ --TEST--
+-phpinfo()
++phpinfo() reports mongodb.debug (default and overridden)
+ --INI--
+ mongodb.debug=stderr
+ --SKIPIF--
+ <?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM does not do phpinfo() this way"); ?>
+-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+ --FILE--
+ <?php
+-require_once __DIR__ . "/../utils/basic.inc";
+
+ ini_set("mongodb.debug", "stdout");
+ phpinfo();
+@@ -17,22 +15,6 @@ phpinfo();
+ <?php exit(0); ?>
+ --EXPECTF--
+ %a
+-mongodb
+-
+-MongoDB support => enabled
+-MongoDB extension version => 1.%d.%d%S
+-MongoDB extension stability => %s
+-libbson bundled version => 1.%d.%d%S
+-libmongoc bundled version => 1.%d.%d%S
+-libmongoc SSL => enabled
+-libmongoc SSL library => %s
+-libmongoc crypto => enabled
+-libmongoc crypto library => %s
+-libmongoc crypto system profile => %s
+-libmongoc SASL => enabled
+-
+-Directive => Local Value => Master Value
+ mongodb.debug => stdout => stderr
+-
+ %a
+ ===DONE===
+
+From 44ac5c48891f017a654b2cf13513d82a284dd914 Mon Sep 17 00:00:00 2001
+From: Jeremy Mikola <jmikola@gmail.com>
+Date: Tue, 7 Feb 2017 16:39:10 -0500
+Subject: [PATCH 7/7] Manager debug ouput tests should not depend on libmongoc
+ tracing
+
+These tests were fragile and could fail when using libmongoc as a system library where tracing may not be enabled.
+---
+ tests/manager/manager-debug-001.phpt | 27 ++++++++-------------------
+ tests/manager/manager-debug-002.phpt | 13 +++----------
+ 2 files changed, 11 insertions(+), 29 deletions(-)
+
+diff --git a/tests/manager/manager-debug-001.phpt b/tests/manager/manager-debug-001.phpt
+index dc34bb6..68a4ece 100644
+--- a/tests/manager/manager-debug-001.phpt
++++ b/tests/manager/manager-debug-001.phpt
+@@ -2,38 +2,27 @@
+ MongoDB\Driver\Manager: Writing debug log files
+ --SKIPIF--
+ <?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM uses HHVM's logging functionality"); ?>
+-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+ --FILE--
+ <?php
+-require_once __DIR__ . "/../utils/basic.inc";
+
+ $name = tempnam(sys_get_temp_dir(), "PHONGO");
+ unlink($name);
+ mkdir($name);
++
+ ini_set('mongodb.debug', $name);
+-$manager = new MongoDB\Driver\Manager(STANDALONE);
+-$bulk = new MongoDB\Driver\BulkWrite();
+-$bulk->insert(array('_id' => 1, 'x' => 1));
+-$result = $manager->executeBulkWrite(NS, $bulk);
++$manager = new MongoDB\Driver\Manager;
+ ini_set('mongodb.debug', 'off');
+-foreach(glob($name."/*") as $file);
+-$content = file($file);
+-unlink($file);
+-rmdir($name);
+
+-echo $content[0], $content[1];
+-foreach($content as $line) {
+- if (strpos($line, "mongoc_bulk_operation_execute")) {
+- echo $line;
+- }
++foreach (glob($name."/*") as $file) {
++ echo file_get_contents($file);
++ unlink($file);
+ }
++rmdir($name);
+
+ ?>
+ ===DONE===
+ <?php exit(0); ?>
+ --EXPECTF--
+-[%s] PHONGO: DEBUG > Connection string: '%s'
++%A[%s] PHONGO: DEBUG > Connection string: '%s'
+ [%s] PHONGO: DEBUG > Creating Manager, phongo-1.%d.%d%S[%s] - mongoc-1.%s(%s), libbson-1.%s(%s), php-%s
+-[%s] mongoc: TRACE > ENTRY: mongoc_bulk_operation_execute():%d
+-[%s] mongoc: TRACE > EXIT: mongoc_bulk_operation_execute():%d
+-===DONE===
++%A===DONE===%A
+diff --git a/tests/manager/manager-debug-002.phpt b/tests/manager/manager-debug-002.phpt
+index f68f736..e98aa27 100644
+--- a/tests/manager/manager-debug-002.phpt
++++ b/tests/manager/manager-debug-002.phpt
+@@ -2,24 +2,17 @@
+ MongoDB\Driver\Manager: mongodb.debug=stderr
+ --SKIPIF--
+ <?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM uses HHVM's logging functionality"); ?>
+-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+ --INI--
+ mongodb.debug=stderr
+ --FILE--
+ <?php
+-require_once __DIR__ . "/../utils/basic.inc";
+
+-$manager = new MongoDB\Driver\Manager(STANDALONE);
+-$bulk = new MongoDB\Driver\BulkWrite();
+-$bulk->insert(array('_id' => 1, 'x' => 1));
+-$result = $manager->executeBulkWrite(NS, $bulk);
++$manager = new MongoDB\Driver\Manager;
+
+ ?>
+ ===DONE===
+ <?php exit(0); ?>
+ --EXPECTF--
+-%a
++%A[%s] PHONGO: DEBUG > Connection string: '%s'
+ [%s] PHONGO: DEBUG > Creating Manager, phongo-1.%d.%d%S[%s] - mongoc-1.%s(%s), libbson-1.%s(%s), php-%s
+-%a
+-===DONE===
+-%a
++%A===DONE===%A
diff --git a/mongodb-tests.patch b/mongodb-tests.patch
deleted file mode 100644
index aaf4137..0000000
--- a/mongodb-tests.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff -up tests/functional/phpinfo-1.phpt.old tests/functional/phpinfo-1.phpt
---- tests/functional/phpinfo-1.phpt.old 2016-06-03 14:31:22.438746223 +0200
-+++ tests/functional/phpinfo-1.phpt 2016-06-03 14:31:33.197800761 +0200
-@@ -19,8 +19,10 @@ mongodb
- mongodb support => enabled
- mongodb version => 1.%d.%d%S
- mongodb stability => %s
--libmongoc version => 1.%s
--libbson version => 1.%s
-+libmongoc headers version => 1.%s
-+libmongoc library version => 1.%s
-+libbson headers version => 1.%s
-+libbson library version => 1.%s
-
- Directive => Local Value => Master Value
- mongodb.debug => no value => no value
-diff -up tests/functional/phpinfo-2.phpt.old tests/functional/phpinfo-2.phpt
---- tests/functional/phpinfo-2.phpt.old 2016-06-03 14:31:28.598777448 +0200
-+++ tests/functional/phpinfo-2.phpt 2016-06-03 14:31:38.655828427 +0200
-@@ -22,8 +22,10 @@ mongodb
- mongodb support => enabled
- mongodb version => 1.%d.%d%S
- mongodb stability => %s
--libmongoc version => 1.%s
--libbson version => 1.%s
-+libmongoc headers version => 1.%s
-+libmongoc library version => 1.%s
-+libbson headers version => 1.%s
-+libbson library version => 1.%s
-
- Directive => Local Value => Master Value
- mongodb.debug => stdout => stderr
diff --git a/php-pecl-mongodb.spec b/php-pecl-mongodb.spec
index b08243d..fd320ca 100644
--- a/php-pecl-mongodb.spec
+++ b/php-pecl-mongodb.spec
@@ -47,8 +47,8 @@ Group: Development/Languages
URL: http://pecl.php.net/package/%{pecl_name}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz
-# Fix tests when using system libraries
-Patch0: %{pecl_name}-tests.patch
+# https://github.com/mongodb/mongo-php-driver/pull/526
+Patch1: 526.patch
BuildRequires: %{?scl_prefix}php-devel > 5.4
BuildRequires: %{?scl_prefix}php-pear
@@ -129,7 +129,7 @@ sed -e 's/role="test"/role="src"/' \
cd NTS
%if %{with_syslib}
-%patch0 -p0 -b .rpm
+%patch1 -p1 -b .526
%endif
# Sanity check, really often broken
@@ -272,10 +272,7 @@ if [ -s server.pid ] ; then
: Drop known to fail tests
%if "%{mongo_version}" < "3.4"
### With mongodb 3.2
- rm ?TS/tests/manager/manager-debug-001.phpt
- rm ?TS/tests/manager/manager-executequery-without-assignment.phpt
rm ?TS/tests/standalone/bug0487-002.phpt
- rm ?TS/tests/standalone/bug0655.phpt
%endif
%if "%{mongo_version}" < "3.2"
### With mongodb 3.0