]> granicus.if.org Git - php/commitdiff
Adding XFAIL for some tests which expect the zval cache of mysqlnd to be on. It has...
authorUlf Wendel <uw@php.net>
Wed, 1 Jul 2009 12:51:40 +0000 (12:51 +0000)
committerUlf Wendel <uw@php.net>
Wed, 1 Jul 2009 12:51:40 +0000 (12:51 +0000)
ext/mysqli/tests/mysqli_get_cache_stats.phpt
ext/mysqli/tests/mysqli_get_cache_stats_free_buffered.phpt
ext/mysqli/tests/mysqli_get_cache_stats_off.phpt [new file with mode: 0644]
ext/mysqli/tests/mysqli_get_client_stats_off.phpt
ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt
ext/mysqli/tests/mysqli_get_connection_stats.phpt
ext/mysqli/tests/mysqli_get_connection_stats_off.phpt [new file with mode: 0644]

index c9dcc095982b41ae149a1d5b67f0cfa994c8be3a..745787f7ffad1bed73f4fd75bc11fbe38af3ba86 100644 (file)
@@ -1,5 +1,10 @@
 --TEST--
 mysqli_get_cache_stats()
+--XFAIL--
+zval caching has been temporarily disabled for the 5.3.0 release
+--INI--
+mysqlnd.collect_statistics="1"
+mysqlnd.collect_memory_statistics="1"
 --SKIPIF--
 <?PHP
 require_once('skipif.inc');
@@ -22,9 +27,9 @@ if (!function_exists('mysqli_get_cache_stats')) {
 
        var_dump($info);
 
-       if ($info['size'] !== $info['free_items'])
+       if ($info["size"] !== $info['free_items'])
                printf("[003] Unused cache should have size (%d) == free_items (%d)\n",
-                       $info['size'], $info['free_items']);
+                       $info["size"], $info['free_items']);
 
        require_once('table.inc');
 
index 969a21be92b14fb77ba576fdeb8c378f87f7447c..50369a3723b8016dbf4cbb996c2f759da707689e 100644 (file)
@@ -1,5 +1,10 @@
 --TEST--
 mysqli_get_cache_stats() - freeing for buffered result sets
+--XFAIL--
+zval caching has been temporarily disabled for the 5.3.0 release
+--INI--
+mysqlnd.collect_statistics="1"
+mysqlnd.collect_memory_statistics="1"
 --SKIPIF--
 <?PHP
 require_once('skipif.inc');
diff --git a/ext/mysqli/tests/mysqli_get_cache_stats_off.phpt b/ext/mysqli/tests/mysqli_get_cache_stats_off.phpt
new file mode 100644 (file)
index 0000000..0ec64f7
--- /dev/null
@@ -0,0 +1,55 @@
+--TEST--
+mysqli_get_cache_stats() - disabled via php.ini
+--INI--
+mysqlnd.collect_statistics="0"
+mysqlnd.collect_memory_statistics="0"
+--SKIPIF--
+<?PHP
+require_once('skipif.inc');
+require_once('skipifemb.inc');
+require_once('skipifconnectfailure.inc');
+if (!function_exists('mysqli_get_cache_stats')) {
+       die("skip only available with mysqlnd");
+}
+?>
+--FILE--
+<?php
+       $before = mysqli_get_cache_stats();
+       if (!is_array($before) || empty($before)) {
+               printf("[001] Expecting non-empty array, got %s.\n", gettype($before));
+               var_dump($before);
+       }
+
+       require_once('table.inc');
+       if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
+               printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+       }
+       while ($row = mysqli_fetch_assoc($res))
+               ;
+       if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
+               printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+       }
+       while ($row = mysqli_fetch_assoc($res))
+               ;
+
+       $after = mysqli_get_cache_stats();
+       if ($before !== $after) {
+               printf("[004] Statistics have changed\n");
+               var_dump($before);
+               var_dump($after);
+       }
+
+       $ignore = array("size" => true, "free_items" => true, "references" => true);
+       foreach ($after as $k => $v) {
+               if ($v != 0 && !isset($ignore[$k])) {
+                       printf("[005] Field %s should not have any other value but 0, got %s.\n",
+                               $k, $v);
+               }
+       }
+
+       mysqli_close($link);
+
+       print "done!";
+?>
+--EXPECTF--
+done!
\ No newline at end of file
index 8a731ca7464bdc72cb2bdafd9f1e2b263d27892a..9594eb526f2100a0e5adb738edff2cff5dc68e99 100644 (file)
@@ -15,19 +15,25 @@ mysqlnd.collect_memory_statistics=0
 --FILE--
 <?php
        $before = mysqli_get_client_stats();
+       if (!is_array($before) || empty($before)) {
+               printf("[001] Expecting non-empty array, got %s.\n", gettype($before));
+               var_dump($before);
+       }
+
        // connect and table inc connect to mysql and create tables
        require_once('connect.inc');
        require_once('table.inc');
        $after = mysqli_get_client_stats();
 
-       if (!is_array($before) || empty($before)) {
-               printf("[001] Expecting non-empty array, got %s.\n", gettype($before));
+       if ($before !== $after) {
+               printf("[002] Statistics have changed\n");
                var_dump($before);
+               var_dump($after);
        }
 
        foreach ($after as $k => $v)
                if ($v != 0) {
-                       printf("[002] Field %s should not have any other value but 0, got %s.\n",
+                       printf("[003] Field %s should not have any other value but 0, got %s.\n",
                                $k, $v);
                }
 
index 9dd802db0dd7525ec27cb3d413cc3276e61d0835..0358656ab550e9b828f209324776a5f5ed7b06c4 100644 (file)
@@ -1,5 +1,8 @@
 --TEST--
 mysqli_get_client_stats() - skipped rows
+--INI--
+mysqlnd.collect_statistics="1"
+mysqlnd.collect_memory_statistics="1"
 --SKIPIF--
 <?PHP
 require_once('skipif.inc');
index ba71cd649a4e79546d5165af51ab239520f0097f..ede0b3b41d574ae4cc0a829cb843e47e75612850 100644 (file)
@@ -1,5 +1,8 @@
 --TEST--
 mysqli_get_connection_stats()
+--INI--
+mysqlnd.collect_statistics="1"
+mysqlnd.collect_memory_statistics="1"
 --SKIPIF--
 <?PHP
 require_once('skipif.inc');
@@ -39,7 +42,7 @@ if (!function_exists('mysqli_get_connection_stats')) {
        }
 
        if ($info !== $info2) {
-               printf("[005] The hashes should be identical\n");
+               printf("[005] The hashes should be identical except of the memory related fields\n");
                var_dump($info);
                var_dump($info2);
        }
diff --git a/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt b/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt
new file mode 100644 (file)
index 0000000..4c5a7b7
--- /dev/null
@@ -0,0 +1,53 @@
+--TEST--
+mysqli_get_connection_stats() - disable via php.ini
+--INI--
+mysqlnd.collect_statistics="0"
+mysqlnd.collect_memory_statistics="0"
+--SKIPIF--
+<?PHP
+require_once('skipif.inc');
+require_once('skipifemb.inc');
+require_once('skipifconnectfailure.inc');
+if (!function_exists('mysqli_get_connection_stats')) {
+       die("skip only available with mysqlnd");
+}
+?>
+--FILE--
+<?php
+       // connect and table inc connect to mysql and create tables
+       require_once('connect.inc');
+
+       if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+               printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+                       $host, $user, $db, $port, $socket);
+       }
+       $before = mysqli_get_connection_stats($link);
+       if (!is_array($before) || empty($before)) {
+               printf("[002] Expecting non-empty array, got %s.\n", gettype($before));
+               var_dump($before);
+       }
+
+       mysqli_close($link);
+       if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+               printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+                       $host, $user, $db, $port, $socket);
+       }
+       $after = mysqli_get_connection_stats($link);
+
+       if ($before !== $after) {
+               printf("[004] Statistics differ!");
+               var_dump($before);
+               var_dump($after);
+       }
+
+       foreach ($after as $k => $v)
+               if ($v != 0) {
+                       printf("[004] Field %s should not have any other value but 0, got %s.\n",
+                               $k, $v);
+               }
+
+       mysqli_close($link);
+       print "done!";
+?>
+--EXPECTF--
+done!
\ No newline at end of file